Skip to content

Scrubbing issue with HLS content #2598

@StaehliJ

Description

@StaehliJ

Version

Media3 pre-release (alpha, beta or RC not in this list)

More version details

1.8.0-rc01

Devices that reproduce the issue

  • Pixel 2 XL
  • Samsung A42,
  • Others

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

I create a test inside my fork of media3 because it needs some changes into the compose demo. The idea is to implement the new scrubbing feature of ExoPlayer and try using key-frame if they are available.

I added a Slider to seek when slider value changes and it activate scrubbingMode the first time. When slider finishing we disable scrubbingMode. The player is also configured with SeekParameters.CLOSEST_SYNC when scrubbing.

Before this feature we also implemented something similar waiting seek end before seek to the next position to fast seek in the content. It was working fine until this version of the player. The player error is exactly the same.

Expected result

The HLS content seeking fast while scrubbing and when scrubbing ends, the playback continues.

Actual result

The playback stop with a player error when we stop scrubbing, some times is doesn't have error, but most of the time it has.

15:14:38.032 E playerFailed [eventTime=2647.10, mediaPos=342.00, window=1, period=1, errorCode=ERROR_CODE_UNSPECIFIED (Ask Gemini)
androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:910)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:223)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=10; index=-1
at java.util.ArrayList.get(ArrayList.java:439)
at androidx.media3.exoplayer.hls.HlsSampleStreamWrapper.getLastMediaChunk(HlsSampleStreamWrapper.java:1544)
at androidx.media3.exoplayer.hls.HlsSampleStreamWrapper.getNextLoadPositionUs(HlsSampleStreamWrapper.java:759)
at androidx.media3.exoplayer.hls.HlsSampleStreamWrapper.seekInsideBufferUs(HlsSampleStreamWrapper.java:1567)
at androidx.media3.exoplayer.hls.HlsSampleStreamWrapper.seekToUs(HlsSampleStreamWrapper.java:519)
at androidx.media3.exoplayer.hls.HlsSampleStreamWrapper.selectTracks(HlsSampleStreamWrapper.java:464)
at androidx.media3.exoplayer.hls.HlsMediaPeriod.selectTracks(HlsMediaPeriod.java:326)
at androidx.media3.exoplayer.source.MaskingMediaPeriod.selectTracks(MaskingMediaPeriod.java:189)
at androidx.media3.exoplayer.MediaPeriodHolder.applyTrackSelection(MediaPeriodHolder.java:339)
at androidx.media3.exoplayer.ExoPlayerImplInternal.reselectTracksInternal(ExoPlayerImplInternal.java:2235)
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:742)
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:223) 
at android.os.HandlerThread.run(HandlerThread.java:67) 
]

The issue happens here, I suspect an race condition issue because it should not have an index=-1 when the list has items.

Media

The HLS media provide in videos.kt

Bug Report

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions