[Android] Prevent audio player to be shown when playing video in popup
Nicolas Pomepuy
git at videolan.org
Thu May 28 07:24:32 CEST 2020
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue May 26 15:28:04 2020 +0200| [9190ecd94844ba1c3ab32400dac904d6fca0566e] | committer: Nicolas Pomepuy
Prevent audio player to be shown when playing video in popup
Fixes #1154
> https://code.videolan.org/videolan/vlc-android/commit/9190ecd94844ba1c3ab32400dac904d6fca0566e
---
application/vlc-android/src/org/videolan/vlc/PlaybackService.kt | 6 +++---
.../vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index 3e0b91aa8..7f5f094c2 100644
--- a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -1111,14 +1111,14 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner {
*/
@MainThread
- fun showWithoutParse(index: Int) {
+ fun showWithoutParse(index: Int, forPopup:Boolean = false) {
playlistManager.setVideoTrackEnabled(false)
val media = playlistManager.getMedia(index) ?: return
// Show an URI without interrupting/losing the current stream
if (BuildConfig.DEBUG) Log.v(TAG, "Showing index " + index + " with playing URI " + media.uri)
playlistManager.currentIndex = index
notifyTrackChanged()
- PlaylistManager.showAudioPlayer.value = !isVideoPlaying
+ PlaylistManager.showAudioPlayer.value = !isVideoPlaying && !forPopup
showNotification()
}
@@ -1129,7 +1129,7 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner {
@MainThread
fun switchToPopup(index: Int) {
playlistManager.saveMediaMeta()
- showWithoutParse(index)
+ showWithoutParse(index, true)
showPopup()
}
diff --git a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 19f82d774..00ac9abf6 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -354,6 +354,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
return false
val hasRenderer = player.hasRenderer
videoBackground = false
+ showAudioPlayer.postValue(false)
if (player.isVideoPlaying() && !hasRenderer) {//Player is already running, just send it an intent
player.setVideoTrackEnabled(true)
LocalBroadcastManager.getInstance(service).sendBroadcast(
More information about the Android
mailing list