0

我有以下使用 ExoPlayer 2.4.0API 的代码,它只是播放 MPEG-DASH 视频。据我了解,根据估计的带宽,它会选择正确的轨道。但是每当我运行它时,它总是选择600k比特率轨道。当我试图用 打印估计的带宽时getBitrateEstimate(),它总是打印-1

有什么问题吗?

Uri uri = Uri.parse("https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd");

// bandwidthmeter is used for getting default bandwidth
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();

// track selector is used to navigate between video using a default seekbar.
TrackSelector trackSelector = new DefaultTrackSelector(new AdaptiveTrackSelection.Factory(bandwidthMeter));
// we are adding our track selector to exoplayer.
exoPlayer = ExoPlayerFactory.newSimpleInstance(this, trackSelector);

// we are creating a variable for datasource factory and setting its user agent as 'exoplayer_view'
DefaultHttpDataSourceFactory dataSourceFactory = new DefaultHttpDataSourceFactory("exoplayer_video");

DashMediaSource dashMediaSource = new DashMediaSource(uri, dataSourceFactory,
        new DefaultDashChunkSource.Factory(dataSourceFactory), null, null);

// inside our exoplayer view we are setting our player
exoPlayerView.setPlayer(exoPlayer);

// we are preparing our exoplayer with media source.
exoPlayer.prepare(dashMediaSource);
Log.i("BW", "BW: " + bandwidthMeter.getBitrateEstimate());
// we are setting our exoplayer when it is ready.
exoPlayer.setPlayWhenReady(true);
4

0 回答 0