Skip to content

Setting video surface after the player is ready causes a rebuffer #1973

Open
@sgosantos

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:

  1. Set playWhenReady=false
  2. Set an initial playback position (for example, seekTo=3_000L)
  3. Prepare the player
  4. The player moves to BUFFERING state
  5. The player moves to READY state
  6. Wait some time before setting the surface (for example, 2_000L)
  7. Set the surface in the player
  8. 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

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions