EncryptedExoPlayerDemo
                                
                                 EncryptedExoPlayerDemo copied to clipboard
                                
                                    EncryptedExoPlayerDemo copied to clipboard
                            
                            
                            
                        com.google.android.exoplayer2.source.UnrecognizedInputFormatException
When I tried to play an encrypted file using the same codes of your facing this issue.
ExoPlayerImplInternal: Source error. com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor, AmrExtractor) could read the stream. at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractorHolder.selectExtractor(ExtractorMediaPeriod.java:973) at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:891) at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:381) 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)
That's usually because it's being encrypted or decrypted wrong, but could also mean your source file is not supported (not mp4 or similar)
On Wed, Jan 15, 2020 at 1:31 AM anuragappsbee [email protected] wrote:
When I tried to play an encrypted file using the same codes of your facing this issue.
ExoPlayerImplInternal: Source error. com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor, AmrExtractor) could read the stream. at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractorHolder.selectExtractor(ExtractorMediaPeriod.java:973) at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:891) at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:381) 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)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/moagrius/EncryptedExoPlayerDemo/issues/15?email_source=notifications&email_token=AAFLHIH4ZHVWIYF6BNCZ2W3Q523U3A5CNFSM4KG66WLKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IGIRS5Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFLHIECXIDBNOTF3ZIMVC3Q523U3ANCNFSM4KG66WLA .
i facing same issue, first time it plays right but after that it does not play at all.
First time it plays because the key and iv are generated by SecureRandom which is stored in memory are used for both encryption and decryption.
However when you restart the app, new key and iv is generated by SecureRandom so it will not match the old ones used to encrypt the file.
A fix to this issue will be to change and explicitly define your keys. And use the same keys to encrypt and decrypt the file.
 byte[] key = { 65, 66, 67,65, 66, 67,65, 66, 67,65, 66, 67,65, 66, 67,16};
 byte[] iv = { 65, 66, 67,65, 66, 67,65, 66, 67,65, 66, 67,65, 66, 67,16};