Skip to content

Attempting to play a specially encapsulated TS format video in ExoPlayer results in a pointer out-of-bounds exception. #1476

Closed
@Chadewik-junao

Description

@Chadewik-junao

Problem Description

I've integrated ExoPlayer into my application to play TS format videos from a server URL. However, I encountered an exception that prevents the video from playing correctly. The exception is an ArrayIndexOutOfBoundsException thrown while trying to retrieve the buffered position.

##Version
Media3 1.3.0

Error Log

Here is the complete stack trace of the error:

Playback error
androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:636)
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=2; index=2
at androidx.media3.exoplayer.source.ProgressiveMediaPeriod.getBufferedPositionUs(ProgressiveMediaPeriod.java:395)
at androidx.media3.exoplayer.source.MaskingMediaPeriod.getBufferedPositionUs(MaskingMediaPeriod.java:203)
at androidx.media3.exoplayer.MediaPeriodHolder.isFullyBuffered(MediaPeriodHolder.java:153)
at androidx.media3.exoplayer.ExoPlayerImplInternal.shouldTransitionToReadyState(ExoPlayerImplInternal.java:1806)
at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1053)
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:510)
at android.os.Handler.dispatchMessage(Handler.java:102at android.os.Looper.loop(Looper.java:223at android.os.HandlerThread.run(HandlerThread.java:67)

My code looks like this

player=new ExoPlayer.Builder(context).setLooper(mHandlerThread.getLooper()).setLoadControl(loadControl).build();
DataSource.Factory dataSourceFactory = new DefaultDataSource.Factory(context);
MediaItem mediaItem = MediaItem.fromUri(mVideoUri);
mediaSource = new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItem);
player.setMediaSource(mediaSource );
player.prepare();

The video file cannot be uploaded due to copyright reasons.

How do I fix it ? Thank you for your assistance.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions