Exo播放器实时音频URL无法正常工作并显示错误

时间:2018-11-23 11:23:57

标签: android audio media-player exoplayer

下面的代码无法正常工作,并显示错误。

  ExoPlayer player = ExoPlayerFactory.newSimpleInstance(
               new DefaultRenderersFactory(this),
              new DefaultTrackSelector(), new DefaultLoadControl());


        Uri uri = Uri.parse(live uri path);
        MediaSource mediaSource = buildMediaSource(uri);
        player.prepare(mediaSource, true, false);
        player.setPlayWhenReady(true);

 private MediaSource buildMediaSource(Uri uri) {
        DataSource.Factory manifestDataSourceFactory =
                new DefaultHttpDataSourceFactory("ua");
        DashChunkSource.Factory dashChunkSourceFactory =
                new DefaultDashChunkSource.Factory(
                        new DefaultHttpDataSourceFactory("ua", BANDWIDTH_METER));
        return new DashMediaSource.Factory(dashChunkSourceFactory,
                manifestDataSourceFactory).createMediaSource(uri);
    }

上面的代码显示::: p的错误

ExoPlayerImplInternal: Source error.
com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 301

0 个答案:

没有答案