Closed rahul-hawge closed 3 years ago
Hi Kim, mind taking a look at what seems to be an MP4 issue? If it's not, please feel free to reassign to me.
@rahul-hawge, please check the link, which currently points to an empty project: https://github.com/rahul-hawge/exoplayer-issue-sample.git.
@AquilesCanta
Just need to switch to master, Here is the path.
https://github.com/rahul-hawge/exoplayer-issue-sample/tree/master
The problem is that the Mp4Extractor
is unable to split the last video sample into NAL units (as defined in ISO/IEC FDIS 14496-15). When parsing the last sample, it first finds a NAL unit of length 1 byte (which is already suspicious) and then finds a second NAL unit of negative length, causing the exception to be thrown.
The reason is probably that
@kim-vde Thanks for your response. There are multiple videos in my actual project where this issue occurs. I am not sure to call it a bad media when it plays fine with the other basic media player's like VideoView . Is there any way that we can fix this?
It is a bad media in the sense that it doesn't comply to the specifications.
The best way to fix this error is of course to fix the media. If it is not possible, you can use a custom Mp4Extractor
where you could for example replace the line throwing the error by return RESULT_END_OF_INPUT;
. Custom extractors can be added by passing a custom DefaultExtractorsFactory
to the SimpleExoPlayer
builder. Note that this solution would only work in the case where the invalid sample is the last one.
[REQUIRED] Issue description
Observed Behavior : I am trying to play a MP4 file from raw folder. But when I use seekbar to move back and forth, it throws Invalid length the exception. There is no issue with the video file as I was able to play same video in VideoView(attached github link to sample project) Expected Behavior : The video should play even we use the seek bar to reach particular point in the video.
[REQUIRED] Reproduction steps
I have created a sample app showing how it behaves in SamplePlayer and VideoView. You just need to play around with the seekbar to reproduce the issue.
Steps:
Note : Click on Video view button and observe the video plays fine in VideoView.
[REQUIRED] Link to test content
Below is the github link which has the code and .MP4 file that I am using in the application. https://github.com/rahul-hawge/exoplayer-issue-sample.git
[REQUIRED] A full bug report captured from the device
[REQUIRED] Version of ExoPlayer being used
implementation 'com.google.android.exoplayer:exoplayer:2.11.4'
[REQUIRED] Device(s) and version(s) of Android being used
Issue is reproducible in both emulator and in android devices, not specific to particular OS.