Friday 25 September 2020

Exoplayer Mediaplayer Android delay applying PlaybackParameters

I'm using Exoplayer to play a video in my application, what I want to do is change the speed of playback, for which Exoplayer provides a straightforward solution:

    val playbackParameters = PlaybackParameters(whateverSpeedFloat)
    exoPlayer.setPlaybackParameters(playbackParameters)

Now this works, but the problem I have is that the effect is not immediate, when you change the speed it takes a few frames for the actual speed to change. I guess it's because some of the frames are preloaded or buffered and the set playback parameters only affect the frames after this.

If I stop the video, and change speed from say 0.5x to 2x, then press play, it's very obvious that there is a delay in playback speed change. But, if I press stop, change the speed from 0.5x to 2x AND seek a different point in the video, and press play, it works great, there is no delay. I guess it reloads/buffers the new frames with the right playback parameters. I tried doing

   exoPlayer.clearVideoDecoderOutputBufferRenderer() 

after changing speeds to try and rebuffer the frames after setting the playback parameters but it doesn't seem to change anything. Any ideas on how to fix this? Or other video player libraries that wouldn't have this problem?



from Exoplayer Mediaplayer Android delay applying PlaybackParameters

No comments:

Post a Comment