[Android] Fix crash after phone call
Geoffrey Métais
git at videolan.org
Tue Feb 13 13:05:36 CET 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb 13 13:05:10 2018 +0100| [94b38b61eb5434dbab2e7e7bef4d821806e049b1] | committer: Geoffrey Métais
Fix crash after phone call
> https://code.videolan.org/videolan/vlc-android/commit/94b38b61eb5434dbab2e7e7bef4d821806e049b1
---
vlc-android/src/org/videolan/vlc/PlaybackService.java | 1 -
vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 12 +++++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 7cfd96ed6..350e23cdb 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -287,7 +287,6 @@ public class PlaybackService extends MediaBrowserServiceCompat{
mRemoteControlClientReceiver = null;
}
playlistManager.onServiceDestroyed();
- updateWidget();
}
@Override
diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 3cb793404..f4f815ebc 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -146,7 +146,9 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
}
}
- fun play() = player.play()
+ fun play() {
+ if (hasMedia()) player.play()
+ }
fun pause() {
if (player.pause()) savePosition()
@@ -179,10 +181,8 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
currentIndex = -1
mediaList.clear()
if (systemExit) player.release()
- else {
- player.restart()
- service.onPlaybackStopped()
- }
+ else player.restart()
+ service.onPlaybackStopped()
}
@MainThread
@@ -670,4 +670,6 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
}
service.onMediaPlayerEvent(event)
}
+
+ fun isAudioList() = !player.canSwitchToVideo() && mediaList.isAudioList
}
\ No newline at end of file
More information about the Android
mailing list