Merge pull request #336 from nitehu/fix/clear_playlist

Fixed clearing the playlist when MediaPlayerService isn't running
This commit is contained in:
Nite 2020-10-20 11:51:45 +02:00 committed by GitHub
commit 9341fd3df3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -361,7 +361,16 @@ public class MediaPlayerControllerImpl implements MediaPlayerController
public synchronized void clear(boolean serialize)
{
MediaPlayerService mediaPlayerService = MediaPlayerService.getRunningInstance();
if (mediaPlayerService != null) mediaPlayerService.clear(serialize);
if (mediaPlayerService != null) {
mediaPlayerService.clear(serialize);
} else {
// If no MediaPlayerService is available, just empty the playlist
downloader.clear();
if (serialize) {
downloadQueueSerializer.serializeDownloadQueue(downloader.downloadList,
downloader.getCurrentPlayingIndex(), getPlayerPosition());
}
}
jukeboxMediaPlayer.getValue().updatePlaylist();
}