Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #134防止阻止手机休眠 #137

Closed
wants to merge 1 commit into from
Closed

Conversation

282931
Copy link
Contributor

@282931 282931 commented Dec 4, 2023

去除原生的react-native-background-timer的wakelock,防止一直让手机不休眠

@lovegaoshi
Copy link

RN background timer 只会在启动的时候获取wakelock 完成时释放;
不释放的是RNTP的musicService - 继承headlessJSTaskService, 永远不释放wakelock。
你可以复制HeadlessJsTaskService出来然后把wakelock变公有,在播放时获取,暂停时释放
目前RNTP4 是用停止前台服务解决耗电问题的。

@xxnuo
Copy link

xxnuo commented Feb 29, 2024

现在确实存在耗电问题,在后台未播放内容也在持续耗电

@282931
Copy link
Contributor Author

282931 commented Feb 29, 2024

我原本以为是《定时关闭》这个功能里使用了react-native-background-timer的定时器导致一直没有释放wakelock,目前看来要解决这个问题可以尝试升级react-native-track-player到4版本,升级后里面的api改动比较大,如果需要升级可以再说。那我先撤回这个pr了。

@282931 282931 closed this Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants