所以我想尝试在SimpleExoplayerView中播放DASH视频。我正在关注https://codelabs.developers.google.com/codelabs/exoplayer-intro/#0中最基本的教程。
麻烦的是,我能够听到音频,但屏幕始终是白色的。
我已经尝试过的事情 -
这是初始化方法 -
private void initialisePlayer() {
TrackSelection.Factory adaptiveTrackSelectionFactory = new AdaptiveTrackSelection.Factory
(defaultBandwidthMeter);
if (exoPlayer == null) {
exoPlayer = ExoPlayerFactory.newSimpleInstance(new DefaultRenderersFactory(context), new
DefaultTrackSelector(adaptiveTrackSelectionFactory), new DefaultLoadControl());
simpleExoPlayerView.setPlayer(exoPlayer);
exoPlayer.setPlayWhenReady(true);
DashMediaSource mediaSource = buildMediaResource();
exoPlayer.prepare(mediaSource);
}
}
这是buildMediaSource方法 -
private DashMediaSource buildMediaResource() {
String userAgent = Util.getUserAgent(context, getString(R.string.app_name));
DataSource.Factory manifestDataSourceFactory = new DefaultHttpDataSourceFactory(userAgent);
DashChunkSource.Factory dashChunkSourceFactory = new DefaultDashChunkSource.Factory(new
DefaultHttpDataSourceFactory(userAgent, defaultBandwidthMeter));
return new DashMediaSource.Factory(dashChunkSourceFactory, manifestDataSourceFactory).createMediaSource(Uri
.parse(url));
}
我错过了什么吗?