简体   繁体   English

Android:MediaPlayer和AsyncTask唤醒锁

[英]Android: MediaPlayer and AsyncTask Wakelock

I have an Activity that uses AsnycTasks to reset and restart a MediaPlayer after it finishes. 我有一个使用AsnycTasks重设并在完成后重新启动MediaPlayer的活动。 This all works fine, but I want the MediaPlayer to continue playback even when the phone's screen is off. 一切正常,但是我希望MediaPlayer即使在手机屏幕关闭的情况下也可以继续播放。 My first thought was a "PARTIAL_WAKE_LOCK", and this works great until it is time for the MediaPlayer to re-start it using the AsyncTask, at which point it stops. 我的第一个念头是“ PARTIAL_WAKE_LOCK”,这很好用,直到需要使用AsyncTask重新启动MediaPlayer时,它才停止。

How can I keep the screen off but still keep my processes alive? 如何关闭屏幕,但仍使进程保持活动状态?

Try android Services to play your Media files. 尝试使用android 服务播放您的媒体文件。 You can also see this and this . 您也可以看到这个这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM