diff --git a/app/src/main/java/org/schabi/newpipe/player/PlayerService.kt b/app/src/main/java/org/schabi/newpipe/player/PlayerService.kt index db6ed64e5..53ff9b1fd 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PlayerService.kt +++ b/app/src/main/java/org/schabi/newpipe/player/PlayerService.kt @@ -58,7 +58,7 @@ class PlayerService : MediaBrowserServiceCompat() { private var mediaBrowserConnector: MediaBrowserConnector? = null get() { if (field == null) { - return MediaBrowserConnector(this) + field = MediaBrowserConnector(this) } return field } diff --git a/app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserConnector.kt b/app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserConnector.kt index f08d89855..05cf2d843 100644 --- a/app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserConnector.kt +++ b/app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserConnector.kt @@ -263,7 +263,7 @@ class MediaBrowserConnector(private val playerService: PlayerService) : Playback try { val parentIdUri = Uri.parse(parentId) - val path = parentIdUri.pathSegments + val path = ArrayList(parentIdUri.pathSegments) if (path.isEmpty()) { val mediaItems: MutableList = ArrayList() @@ -431,7 +431,7 @@ class MediaBrowserConnector(private val playerService: PlayerService) : Playback private fun extractPlayQueueFromMediaId(mediaId: String): Single { try { val mediaIdUri = Uri.parse(mediaId) - val path = mediaIdUri.pathSegments + val path = ArrayList(mediaIdUri.pathSegments) if (path.isEmpty()) { throw parseError() @@ -461,14 +461,17 @@ class MediaBrowserConnector(private val playerService: PlayerService) : Playback @Throws(ContentNotAvailableException::class) private fun extractPlayQueueFromPlaylistMediaId( - mediaIdSegments: List, + mediaIdSegments: ArrayList, url: String?, ): Single { if (mediaIdSegments.isEmpty()) { throw parseError() } - when (val playlistType = mediaIdSegments.first()) { + val playlistType = mediaIdSegments.first() + mediaIdSegments.removeAt(0) + + when (playlistType) { ID_LOCAL, ID_REMOTE -> { if (mediaIdSegments.size != 2) { throw parseError()