Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

play live mp4 video exception #11125

Open
s894792409 opened this issue Apr 18, 2023 · 6 comments
Open

play live mp4 video exception #11125

s894792409 opened this issue Apr 18, 2023 · 6 comments
Assignees
Labels

Comments

@s894792409
Copy link

Bug

An exception occurred while playing MP4, which only appeared on some videos, and this is a video that can be played normally using other methods.
exception:
E/LoadTask: Unexpected exception loading stream
java.lang.ArrayIndexOutOfBoundsException: length=157; index=157
at com.google.android.exoplayer2.util.ParsableByteArray.readUnsignedByte(ParsableByteArray.java:233)
at com.google.android.exoplayer2.extractor.mp4.AtomParsers.parseVideoSampleEntry(AtomParsers.java:1203)
at com.google.android.exoplayer2.extractor.mp4.AtomParsers.parseStsd(AtomParsers.java:949)
at com.google.android.exoplayer2.extractor.mp4.AtomParsers.parseTrak(AtomParsers.java:308)
at com.google.android.exoplayer2.extractor.mp4.AtomParsers.parseTraks(AtomParsers.java:130)
at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.processMoovAtom(Mp4Extractor.java:483)
at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.processAtomEnded(Mp4Extractor.java:442)
at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.readAtomPayload(Mp4Extractor.java:424)
at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.read(Mp4Extractor.java:242)
at com.google.android.exoplayer2.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:127)
at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1047)
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)

E/ExoPlayerImplInternal: Playback error
com.google.android.exoplayer2.ExoPlaybackException: Source error
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:624)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:600)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:207)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: com.google.android.exoplayer2.upstream.Loader$UnexpectedLoaderException: Unexpected ArrayIndexOutOfBoundsException: length=157; index=157
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:430)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=157; index=157
at com.google.android.exoplayer2.util.ParsableByteArray.readUnsignedByte(ParsableByteArray.java:233)
at com.google.android.exoplayer2.extractor.mp4.AtomParsers.parseVideoSampleEntry(AtomParsers.java:1203)
at com.google.android.exoplayer2.extractor.mp4.AtomParsers.parseStsd(AtomParsers.java:949)
at com.google.android.exoplayer2.extractor.mp4.AtomParsers.parseTrak(AtomParsers.java:308)
at com.google.android.exoplayer2.extractor.mp4.AtomParsers.parseTraks(AtomParsers.java:130)
at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.processMoovAtom(Mp4Extractor.java:483)
at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.processAtomEnded(Mp4Extractor.java:442)
at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.readAtomPayload(Mp4Extractor.java:424)
at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.read(Mp4Extractor.java:242)
at com.google.android.exoplayer2.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:127)
at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1047)
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:764) 

@s894792409
Copy link
Author

20230418142911598_2785.mp4

this is exception mp4 video

@christosts
Copy link
Contributor

@rohitjoins can you take a look?

@rohitjoins
Copy link
Contributor

@s894792409,

Could you inform me about the version of the Exoplayer library that you're using so that I can understand the stack trace better?

@s894792409
Copy link
Author

My used version is 'com.google.android.exoplayer:exoplayer:2.15.1'. My project only supports up to SDK30, so this is the latest version I can use

@s894792409
Copy link
Author

My used View is 'com.google.android.exoplayer2.ui.PlayerView'
code:
`
Player player = playerView.getPlayer();
if (player == null) {
player = new SimpleExoPlayer.Builder(context)
.build();
playerView.setPlayer(player);
}
playerView.setControllerAutoShow(true);
// playerView.hideController();

                String url = bean.getUrl();
                MediaItem mediaItem = MediaItem.fromUri(url);

                player.setMediaItem(mediaItem);
                player.prepare();

`

@icbaker
Copy link
Collaborator

icbaker commented May 5, 2023

My used version is 'com.google.android.exoplayer:exoplayer:2.15.1'. My project only supports up to SDK30, so this is the latest version I can use

I don't think there's any reason you can't increase your compileSdkVersion to the latest value (33). This is distinct from targetSdkVersion and minSdkVersion, and using the latest compileSdkVersion is "strongly recommended": https://medium.com/androiddevelopers/picking-your-compilesdkversion-minsdkversion-targetsdkversion-a098a0341ebd

I suggest you try reproducing your problem in the demo app at 2.15.1. If you're able to reproduce the problem then try again in the demo app at 2.18.6 (the latest version) - this will tell you if you're encountering a problem that's been fixed since 2.15.1 and you can then upgrade your app to use 2.18.6. If you find you're able to reproduce at 2.18.6 and a change is required in the library, then this change will only be available in a later version, so at that point you will need to upgrade your app anyway to pick up the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants