Disable starting player service via media button when there is nothing to play (no active play queue)
This commit is contained in:
parent
8562fbdbbe
commit
e41218c46b
1 changed files with 5 additions and 0 deletions
|
@ -135,6 +135,11 @@ public final class MainPlayer extends Service {
|
||||||
Log.d(TAG, "onStartCommand() called with: intent = [" + intent
|
Log.d(TAG, "onStartCommand() called with: intent = [" + intent
|
||||||
+ "], flags = [" + flags + "], startId = [" + startId + "]");
|
+ "], flags = [" + flags + "], startId = [" + startId + "]");
|
||||||
}
|
}
|
||||||
|
if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())
|
||||||
|
&& playerImpl.playQueue == null) {
|
||||||
|
// Player is not working, no need to process media button's action
|
||||||
|
return START_NOT_STICKY;
|
||||||
|
}
|
||||||
|
|
||||||
if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())
|
if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())
|
||||||
|| intent.getStringExtra(VideoPlayer.PLAY_QUEUE_KEY) != null) {
|
|| intent.getStringExtra(VideoPlayer.PLAY_QUEUE_KEY) != null) {
|
||||||
|
|
Loading…
Reference in a new issue