-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
player.seekto() exception when playing encrypted video: Invalid NAL length #1643
Comments
Add the SDK version: |
Since you came here from google/ExoPlayer#11229, i just want to check: are you using a custom If not, please can you describe in more detail how you are configuring the decryption within your player? |
The test has passed using DataSourceContractTest, please see the screenshot: Below is all my code:
}` AESDecryptionDataSource.java:
}` AESDecryptionDataSourceFactory.java: public AESDecryptionDataSourceFactory(Cipher cipher) { @OverRide hopefully this information can help resolve the issue |
Something isn't right in your screenshot. I would expect to see all the tests defined in In your screenshot it seems that none of these inherited tests are being run. I would also expect to most of these tests failing with a I would take a look at |
You may also want to take a look at #856. From your original comment you mention:
Since you are using CBC then you likely need similar code to that in #856 (comment) which adjusts the read position of the upstream encrypted datasource to ensure it always starts from the beginning of a block. Otherwise you will often start decrypting from the middle of a block, which I think will produce garbage decrypted data, and likely explains the exception you're seeing when seeking (when we open the data source at a byte offset based on the seek position). |
+1, same error here |
I'm going to close this because I think the original questions have been answered, and additional high-touch support on the details of implementing a |
I use encrypt with “AES/CBC/PKCS5Padding”
I am playing a local encrypted video. after setting the video resource, sliding the progress bar to set the playback progress(player.seekTo) will cause an exception:
ExoPlayerImplInternal: Playback error
androidx.media3.exoplayer.ExoPlaybackException: Source error
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:736)
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:706)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:219)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: androidx.media3.common.ParserException: Invalid NAL length{contentIsMalformed=true, dataType=1}
at androidx.media3.extractor.mp4.Mp4Extractor.readSample(Mp4Extractor.java:725)
at androidx.media3.extractor.mp4.Mp4Extractor.read(Mp4Extractor.java:332)
at androidx.media3.exoplayer.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:147)
at androidx.media3.exoplayer.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1082)
at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:421)
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:929)
when the encrypted video is played to the last frame, the output error:
E/ExoPlayerImplInternal: Playback error
androidx.media3.exoplayer.ExoPlaybackException: Source error
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:736)
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:712)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:219)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.io.EOFException
at androidx.media3.exoplayer.source.SampleDataQueue.sampleData(SampleDataQueue.java:186)
at androidx.media3.exoplayer.source.SampleQueue.sampleData(SampleQueue.java:602)
at androidx.media3.extractor.TrackOutput.sampleData(TrackOutput.java:161)
at androidx.media3.extractor.mp4.Mp4Extractor.readSample(Mp4Extractor.java:755)
at androidx.media3.extractor.mp4.Mp4Extractor.read(Mp4Extractor.java:332)
at androidx.media3.exoplayer.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:147)
at androidx.media3.exoplayer.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1082)
at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:421)
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:929)
but after the video is decrypted and output as an mp4 file, it is normal to play it again, so my encrypted video file seems to be fine?
after several days of trying, I have not found a solution yet. please help me!
The text was updated successfully, but these errors were encountered: