Move item in playlist (iOS)

Hello,

I am using a Player with the Playlist feature to start loading multiple streams, however when re-implementing my Android code to iOS I ran into a curious error I cannot seem to fix.

I am doing the following:

player.pause() // Pause playback

let requestedSourceIndex = 4; // A valid playlist index
let requestedSource = player.playlist.sources[requestedSourceIndex] // Get the Source object from the playlist

player.playlist.remove(sourceAt: requestedSourceIndex) // Remove the source from the playlist
player.playlist.add(source: requestedSource) // Add it again to the playlist as the last entry

player.playlist.seek(source: player.playlist.sources.last!, time: 0) // Seek to the last source in the list

player.play() // Resume playback

This issue is when doing player.playlist.add(source: requestedSource) I am getting a Sources cannot be added after playback is finished. The error makes somewhat sense but also I am trying to add sources to the playlist to continue the playback, how would one add items to the playlist after the playback has ended without restarting the playlist first since that causes screen/audio flickering?

[BMP] [Player] [Warning] Sources cannot be added after playback is finished.
BitmovinPlayerCore/DefaultSource.swift:517: Fatal error: The source was not yet attached to a player

To be clear, this exact flow of code (using Kotlin) works great on Android, any help would be appreciated!

pod 'BitmovinAnalyticsCollector', '2.11.1'
pod 'BitmovinPlayer', '3.41.2'
1 Like

Hi @alex,

Unfortunately, as you already found out, on iOS, it’s not supported to add Sources after playback has already finished.

There is also currently no workaround for this.

BR,
David