[Android] Workaround for the media option being lost
Nicolas Pomepuy
git at videolan.org
Tue Jul 27 05:45:07 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Jul 23 12:06:34 2021 +0200| [3916afa50d1320584a6f4bc1d2a6fa34ea292e82] | committer: Nicolas Pomepuy
Workaround for the media option being lost
See #2106
This is a workaround that should be reverted when a proper fix
for #2106 is done
> https://code.videolan.org/videolan/vlc-android/commit/3916afa50d1320584a6f4bc1d2a6fa34ea292e82
---
.../vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 10 ++++++++++
1 file changed, 10 insertions(+)
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 90dc6a7cf..ea9d2c0a7 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -86,6 +86,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
fun canShuffle() = mediaList.size() > 2
fun isValidPosition(position: Int) = position in 0 until mediaList.size()
+ private var shouldDisableCookieForwarding: Boolean = false
init {
repeating = settings.getInt(PLAYLIST_REPEAT_MODE_KEY, PlaybackStateCompat.REPEAT_MODE_NONE)
@@ -357,6 +358,11 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
val start = getStartTime(mw)
//todo restore position as well when we move to VLC 4.0
val media = mediaFactory.getFromUri(VLCInstance.getInstance(service), uri)
+ //fixme workaround to prevent the issue described in https://code.videolan.org/videolan/vlc-android/-/issues/2106
+ if (shouldDisableCookieForwarding) {
+ shouldDisableCookieForwarding = false
+ media.addOption(":no-http-forward-cookies")
+ }
//todo in VLC 4.0, this should be done by using libvlc_media_player_set_time instead of start-time
media.addOption(":start-time=${start/1000L}")
VLCOptions.setMediaOptions(media, ctx, flags or mw.flags, PlaybackService.hasRenderer())
@@ -655,6 +661,10 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
mediaList.remove(index)
for (i in 0 until ml.count) {
val child = ml.getMediaAt(i)
+ //fixme workaround to prevent the issue described in https://code.videolan.org/videolan/vlc-android/-/issues/2106
+ if (isSchemeHttpOrHttps(child.uri.scheme) && child.uri.authority?.endsWith(".youtube.com") == true) {
+ shouldDisableCookieForwarding = true
+ }
withContext(Dispatchers.IO) { child.parse() }
mediaList.insert(index+i, MLServiceLocator.getAbstractMediaWrapper(child))
child.release()
More information about the Android
mailing list