Send play intent if service state is unknown
This commit is contained in:
parent
f48c75aa83
commit
58f931b575
|
@ -77,7 +77,6 @@ public class ExternalPlayerFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
controller = setupPlaybackController();
|
|
||||||
butPlay.setOnClickListener(v -> {
|
butPlay.setOnClickListener(v -> {
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
controller.playPause();
|
controller.playPause();
|
||||||
|
|
|
@ -508,6 +508,13 @@ public class PlaybackController {
|
||||||
playbackService.setStartWhenPrepared(true);
|
playbackService.setStartWhenPrepared(true);
|
||||||
playbackService.prepare();
|
playbackService.prepare();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
new PlaybackServiceStarter(activity, media)
|
||||||
|
.startWhenPrepared(true)
|
||||||
|
.streamIfLastWasStream()
|
||||||
|
.start();
|
||||||
|
Log.w(TAG, "Play/Pause button was pressed and PlaybackService state was unknown");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue