Commit 589e1482 authored by Geoffrey Métais's avatar Geoffrey Métais

Properly stop when playback is not possible

parent 1cbd6a81
......@@ -554,6 +554,7 @@ public class PlaybackService extends MediaBrowserServiceCompat{
};
public void onPlaybackStopped() {
hideNotification();
if (mWakeLock.isHeld()) mWakeLock.release();
changeAudioFocus(false);
mMedialibrary.resumeBackgroundOperations();
......
......@@ -156,7 +156,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
Log.w(TAG, "Warning: invalid next index, aborted !")
//Close video player if started
LocalBroadcastManager.getInstance(ctx).sendBroadcast(Intent(Constants.EXIT_PLAYER))
player.stop()
stop()
return
}
videoBackground = !player.isVideoPlaying() && player.canSwitchToVideo()
......@@ -164,8 +164,10 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
}
fun stop(systemExit: Boolean = false) {
savePosition()
if (hasMedia()) saveMediaMeta()
if (hasCurrentMedia()) {
savePosition()
saveMediaMeta()
}
player.releaseMedia()
mediaList.removeEventListener(this)
previous.clear()
......@@ -175,7 +177,6 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
else {
player.restart()
service.onPlaybackStopped()
service.hideNotification()
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment