Open marzieNoor opened 3 weeks ago
Hi there,
Please provide me with your implementation snippet, the encription method as well as the padding range. Also please let me know if you're decrypting your file remotly or locally. Sharing the error log without any further explanation is not going to work.
Bests,
Mohsen
On Mon, 10 Jun 2024, 15:15 marzieNoor, @.***> wrote:
i get tis error when i tried to playback my encryoted video. how we should encerypt our video to work with your code? it is important to me get your answer, I look forward to your reply :)))))
Playback error androidx.media3.exoplayer.ExoPlaybackException: Source error at androidx.media3.exoplayer.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:717) at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:687) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: androidx.media3.exoplayer.source.UnrecognizedInputFormatException: None of the available extractors (FragmentedMp4Extractor, Mp4Extractor, FlvExtractor, FlacExtractor, WavExtractor, AmrExtractor, PsExtractor, OggExtractor, TsExtractor, MatroskaExtractor, AdtsExtractor, Ac3Extractor, Ac4Extractor, Mp3Extractor, AviExtractor, JpegExtractor, PngExtractor, WebpExtractor, BmpExtractor, HeifExtractor) could read the stream.{contentIsMalformed=false, dataType=1} at androidx.media3.exoplayer.source.BundledExtractorsAdapter.init(BundledExtractorsAdapter.java:94) at androidx.media3.exoplayer.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1044) at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:421) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012)
— Reply to this email directly, view it on GitHub https://github.com/smmousavi8872/MMPlayer/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ2JVGYY7KYSGTVFNJCDSGTZGWGXHAVCNFSM6AAAAABJCEHEM6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGM2DGNRZGQ2DQNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
you're right! I'll decide to use both of two, but for now I'm trying decrypt remotetly . I decrypted my video by openssl:
openssl enc -aes-128-cbc -in input_file.txt -out encrypted_file.txt -k my_encryption_key -iter 10000 -pbkdf2
and then I use yore code this way:
val mediaItem = MediaItem.Builder() .setUri(enc_URL) .setMimeType(MimeTypes.BASE_TYPE_VIDEO) .build() val dataSourceFactory = HttpEncryptedDataSourceFactory(KEY.toByteArray()/*, iv*/) val mediaSource = ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItem) player.setMediaSource(mediaSource) player.prepare() player.playWhenReady = true
when I run the code I get error that I mentioned.
I am new to the topics of cryptography and decryption, and I would be happy if you could guide me. I eagerly await your response.
Hi again,
Regarding your implementation, I guess the problem refers to player.PlayWhenRead = true
which might result in providing the encrypted
file for the ExoPlayer before the cipher decrypts it.
Please remove it and try to start the player manually where you can make sure the decryption process is completed, as I did in my source code. Also please check the following steps are taken flawlessly:
val mediaItem = MediaItem.Builder()
.setUri(enc_URL)
.setMimeType(MimeTypes.BASE_TYPE_VIDEO)
.build()
val iv = // your IV here, in byte array form if you're using IV while the
encryption process
val key = KEY.toByteArray()
val dataSourceFactory = HttpEncryptedDataSourceFactory(key, iv)
val mediaSource =
ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItem)
player.setMediaSource(mediaSource)
player.prepare()
class HttpEncryptedDataSourceFactory(
private val key: ByteArray,
private val iv: ByteArray?
) : DataSource.Factory {
override fun createDataSource(): DataSource {
val httpDataSource =
DefaultHttpDataSource.Factory().createDataSource()
return EncryptedDataSource(httpDataSource, key, iv)
}
}
class EncryptedDataSource(
private val dataSource: DataSource,
private val key: ByteArray,
private val iv: ByteArray?
) : DataSource {
// Implement necessary methods and handle decryption
}
Bests,
Mohsen
On Sat, Jun 15, 2024 at 1:18 PM marzieNoor @.***> wrote:
you're right! I'll decide to use both of two, but for now I'm trying decrypt remotetly . I decrypted my video by openssl:
openssl enc -aes-128-cbc -in input_file.txt -out encrypted_file.txt -k my_encryption_key -iter 10000 -pbkdf2 and then I use yore code this way:
val mediaItem = MediaItem.Builder() .setUri(enc_URL) .setMimeType(MimeTypes.BASE_TYPE_VIDEO) .build() val dataSourceFactory = HttpEncryptedDataSourceFactory(KEY.toByteArray()/, iv/) val mediaSource = ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItem) player.setMediaSource(mediaSource) player.prepare() player.playWhenReady = true
when I run the code I get error that I mentioned.
I am new to the topics of cryptography and decryption, and I would be happy if you could guide me. I eagerly await your response.
— Reply to this email directly, view it on GitHub https://github.com/smmousavi8872/MMPlayer/issues/3#issuecomment-2169251259, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ2JVG3NMWWSI6SESSBGXR3ZHQEXXAVCNFSM6AAAAABJCEHEM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRZGI2TCMRVHE . You are receiving this because you commented.Message ID: @.***>
i get tis error when i tried to playback my encryoted video. how we should encerypt our video to work with your code? it is important to me get your answer, I look forward to your reply :)))))
Playback error androidx.media3.exoplayer.ExoPlaybackException: Source error at androidx.media3.exoplayer.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:717) at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:687) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: androidx.media3.exoplayer.source.UnrecognizedInputFormatException: None of the available extractors (FragmentedMp4Extractor, Mp4Extractor, FlvExtractor, FlacExtractor, WavExtractor, AmrExtractor, PsExtractor, OggExtractor, TsExtractor, MatroskaExtractor, AdtsExtractor, Ac3Extractor, Ac4Extractor, Mp3Extractor, AviExtractor, JpegExtractor, PngExtractor, WebpExtractor, BmpExtractor, HeifExtractor) could read the stream.{contentIsMalformed=false, dataType=1} at androidx.media3.exoplayer.source.BundledExtractorsAdapter.init(BundledExtractorsAdapter.java:94) at androidx.media3.exoplayer.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1044) at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:421) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012)