Rahul H
Rahul H

Reputation: 51

E/ExoPlayerImplInternal: Source error, when playing a .MP4 file from the local storage

I am downloading a MP4 file from an URL and storing it locally, then when I play the Video using exoplayer, it works fine. But when I use seekbar to move back and forth, it throws the exception(It does work for some videos though)

2020-08-19 08:49:20.464 19968-20115/com.pearson.ppe E/ExoPlayerImplInternal: Source error
      com.google.android.exoplayer2.ParserException: Invalid NAL length
        at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.readSample(Mp4Extractor.java:542)
        at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.read(Mp4Extractor.java:192)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:982)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:391)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)

It works for some videos and it does not for some other(Checked to play the downloaded video in PC, it works always).

Here is the code snippet

        val controls: PlayerControlView = findViewById(R.id.controls)
        controls.player = player
        // Produces DataSource instances through which media data is loaded.
        dataSourceFactory= DefaultDataSourceFactory(this, Util.getUserAgent(this, getString(R.string.app_name)))

        val path = intent.getStringExtra("path")
        // MediaSource representing the media to be played.
        val uri = Uri.parse(path)
        val videoSource: MediaSource = ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(uri)

        player.prepare(videoSource)
        player.playWhenReady = true 

Exo-Player Version:

implementation 'com.google.android.exoplayer:exoplayer:2.11.4'

Upvotes: 2

Views: 4899

Answers (1)

Vipin Chouhan
Vipin Chouhan

Reputation: 128

This issue already reported on exoplayer git repository you can also check it from

https://github.com/google/ExoPlayer/issues/6554

Upvotes: -1

Related Questions