我有一个使用 exoplayer 2.8.2 播放 HLS 流的 android 应用程序。它使用自适应比特率,但即使在非常高速的网络上,它也总是从最低的流而不是更高的流开始。我试图将默认的最大初始带宽设置为 Integer.MAX_VALUE 但它不起作用。
final long defaultMaxInitialBitrate = Integer.MAX_VALUE;
DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter.Builder()
.setInitialBitrateEstimate(defaultMaxInitialBitrate)
.build();
TrackSelection.Factory videoTrackSelectionFactory =
new AdaptiveTrackSelection.Factory(bandwidthMeter);
trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
player = ExoPlayerFactory.newSimpleInstance(getContext(), trackSelector);
DataSource.Factory mediaDataSourceFactory = new DefaultDataSourceFactory(getContext(), Util.getUserAgent(getContext(), getString(R.string.app_name)));
if (currentGalleryModel.mediaUrl != null) {
mediaSource = new HlsMediaSource(Uri.parse(currentGalleryModel.mediaUrl),
mediaDataSourceFactory, null, null);
player.setPlayWhenReady(false);
player.prepare(mediaSource);
}
有人知道我如何默认选择更高带宽的流吗?