mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-25 12:32:31 +01:00
added reacquisition of CPU lock after resuming
This commit is contained in:
parent
6a741de7d1
commit
f2e761c07c
@ -216,11 +216,13 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
|
|||||||
mediaPlayer.pause();
|
mediaPlayer.pause();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
//reacquire CPU lock after releasing it on pause
|
||||||
|
mediaPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK);
|
||||||
mediaPlayer.start();
|
mediaPlayer.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(action.equals(ACTION_STOP)) {
|
else if(action.equals(ACTION_STOP)) {
|
||||||
mediaPlayer.stop();
|
mediaPlayer.stop();//this auto-releases CPU lock
|
||||||
afterPlayCleanup();
|
afterPlayCleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,7 +239,6 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare
|
|||||||
stopForeground(true);//remove foreground status of service; make us killable
|
stopForeground(true);//remove foreground status of service; make us killable
|
||||||
|
|
||||||
stopSelf();
|
stopSelf();
|
||||||
//todo:release cpu lock
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EndListener implements MediaPlayer.OnCompletionListener {
|
private class EndListener implements MediaPlayer.OnCompletionListener {
|
||||||
|
Loading…
Reference in New Issue
Block a user