【问题标题】:how to fix E/ExoPlayerImplInternal: Source error如何修复 E/ExoPlayerImplInternal:源错误
【发布时间】:2020-01-22 15:58:44
【问题描述】:

当我尝试在 Android Lolipop 和 Marsmallow 上播放音频表单服务器 exoplayer 时出现错误 "Response Code:400",但在 Android 更高版本上播放歌曲的代码相同。

E/ExoPlayerImplInternal: Source error. com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 400 at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:211) at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:147) at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:848) at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:317) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)

【问题讨论】:

  • 你找到解决方案了吗?我有同样的错误

标签: android audio exoplayer


【解决方案1】:

您可能会因为 API ~30 中的 Web 客户端而收到此错误

使用下面的代码 sn-p 来允许 URL

new WebViewClient() {
    @SuppressWarnings("deprecation")
    @Override
    public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
        Toast.makeText(Classname.this, description, Toast.LENGTH_SHORT).show();
    }

    @TargetApi(android.os.Build.VERSION_CODES.M)
    @Override
    public void onReceivedError(WebView view, WebResourceRequest req, WebResourceError rerr) {
        // Redirect to deprecated method, so you can use it in all SDK versions
        onReceivedError(view, rerr.getErrorCode(), rerr.getDescription().toString(), req.getUrl().toString());
    }
};

【讨论】:

    【解决方案2】:

    从android studio的日志可以看出 E/ExoPlayerImplInternal:源错误。

    ExoPlayer 未获取源或视频 URL 时出现此错误。因此,请在使用日志加载播放器之前检查您的视频网址。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多