Setting video surface after the player is ready causes a rebuffer #1973
Open
Description
Version
Media3 1.5.0
More version details
No response
Devices that reproduce the issue
- Pixel 7 running Android 15
- Android Emulator Pixel 7 API 33
- Android Emulator Pixel 7 API 30
(there are the ones I tried to reproduce. I believe this happens in other devices also)
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
The issue happens when I prepare the player with an initialPosition
, playWhenReady=false
and with no surface. Later, after the player is READY
, I set the surface and playWhenReady=true
, then the player state changes back to BUFFERING
and READY
again.
Detailed steps:
- Set
playWhenReady=false
- Set an initial playback position (for example, seekTo=3_000L)
- Prepare the player
- The player moves to
BUFFERING
state - The player moves to
READY
state - Wait some time before setting the surface (for example, 2_000L)
- Set the surface in the player
- Set
playWhenReady=true
Reproducing in the ExoPlayer demo app.
- Apply the following patch in the Media3 git repo.
buffering-bug.patch - Run the ExoPlayer demo APP and select a video to play
- I could reproduce it 99%* of the times when:
- I play the Clear DASH UHD (MP4, H264) on the Pixel 7
- I play the Clear DASH UHD (MP4, H264) and HD (MP4, H264) on the Android Emulator Pixel 7 API 30
- I play the Clear DASH UHD (MP4, H264) and HD (MP4, H264) on the Android Emulator Pixel 7 API 33
*in the emulator it seems it didn't happen in the first playback, but it happened 100% of the times in the following attempts.
Other info
- I can only see the issue happening if I start the playback with an
initialPosition != 0
. - I could also reproduce the issue when I clip the media.
Expected result
The player starts playing and no new BUFFERING
event is trigged, since the player is already in the READY
state
Actual result
The player goes to BUFFERING
state again , although it was already on the READY
state.
Media
- Clear DASH UHD (MP4, H264) and HD (MP4, H264)
- Also reproduced with the HLS 16x9 basic stream (TS)
It probably happens with other media types, but these are the ones I played with the most.
Bug Report
- You will email the zip file produced by
adb bugreport
to android-media-github@google.com after filing this issue.