gpt4 book ai didi

android - E/ExoPlayerImplInternal:从本地存储播放.MP4文件时出现源错误

转载 作者:行者123 更新时间:2023-12-02 12:55:56 24 4
gpt4 key购买 nike

我正在从URL下载MP4文件并将其存储在本地,然后使用exoplayer播放视频时,它可以正常工作。但是当我使用seekbar来回移动时,它会抛出异常(尽管确实适用于某些视频)

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)
它适用于某些视频,不适用于其他视频( 已选中可在PC上播放下载的视频,它始终适用)。
这是代码片段
        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版本:
implementation 'com.google.android.exoplayer:exoplayer:2.11.4'

最佳答案

这个问题已经在exoplayer git仓库中报告过,您也可以从

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

关于android - E/ExoPlayerImplInternal:从本地存储播放.MP4文件时出现源错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63479654/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com