Skip to content

Question from SRF Apps Android #1206

@defagos

Description

@defagos

Question from @peyerc / @chjaeggi:

I have a question about playerError state behavior in Pillarbox 8.0.0
Last week, we upgraded Pillarbox in our Android apps from version 6.0.1 to 8.0.0. While testing the Livestream Countdown, we noticed some unexpected behavior:
When the Pillarbox player enters the error state PlaybackException (cause => StartDate), we display a countdown to the user. However, if we lock the test device, wait about 10 seconds, and then unlock it to resume the app, the Pillarbox player’s error state becomes null.
We are observing the error state using:
player.playerErrorAsFlow()
Have you noticed any similar behavior or made any recent changes related to the error state handling?

Update

Unfortunately it also happens with all the videos in our app. I watch something, I put it into background, and after restart we receive a different state / error and the video stops and can’t be reloaded as the state seems IDLE or READY in the Player… We need to restart / open the view. I could not reproduce it in the Pillarbox Demo and I look into it what we do differently and keep you posted

Update 2

I figured out why this happens on our side I think but I will invest more time tomorrow:

override fun onPlayerChanged(oldPlayer: PillarboxPlayer, newPlayer: PillarboxPlayer) {
    super.onPlayerChanged(oldPlayer, newPlayer)
    newPlayer.prepare()
    oldPlayer.stop()
    oldPlayer.clearMediaItems()
}

This callback triggers when we come back to the app after a short screen lock (onResume I guess)…
The oldplayer then is the CastPlayer and has zero items in it and in the super call
newPlayer.setMediaItems(oldPlayer.getCurrentMediaItems(), oldPlayer.currentMediaItemIndex, oldPlayer.currentPosition)
happens, which copies 0 items now into the running PillarBox on Screen

Remark

Can pair with the SRF app Android devs if this helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions