E / ExoPlayerImplInternal:源错误com.google.android.exoplayer2.upstream.HttpDataSource $ InvalidResponseCodeException:响应代码:404

时间:2017-08-21 10:59:59

标签: java android json retrofit exoplayer

我正在尝试播放exo播放器的视频,但它给了我这个错误: -

  

E / ExoPlayerImplInternal:来源错误。
                                                                                 InvalidResponseCodeException:响应代码:404

这是我的活动类: -

Array
(
    [0] => word1
    [1] => word2
    [2] => word3
    [3] => <b>word3</b>
)

有谁知道这里有什么问题?

1 个答案:

答案 0 :(得分:0)

您必须对链接使用“最终”修饰符。

`protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_player);

    final String VIDEO_URL = getIntent().getExtras().getString("URL");

    playerView = findViewById(R.id.exo_player);
    simpleExoPlayer = ExoPlayerFactory.newSimpleInstance(this);
    playerView.setPlayer(simpleExoPlayer);
    DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this,
            Util.getUserAgent(this, "appname"));
    MediaSource videoSource  = new ExtractorMediaSource.Factory(dataSourceFactory).createMediaSource(Uri.parse(VIDEO_URL));
    simpleExoPlayer.prepare(videoSource);
    simpleExoPlayer.setPlayWhenReady(true);
}`