我正在尝试播放exo播放器的视频,但它给了我这个错误: -
E / ExoPlayerImplInternal:来源错误。
InvalidResponseCodeException:响应代码:404
这是我的活动类: -
Array
(
[0] => word1
[1] => word2
[2] => word3
[3] => <b>word3</b>
)
有谁知道这里有什么问题?
答案 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);
}`