我正在使用以下代码,但获得30s的缓冲区窗口。它会产生延迟,我希望媒体能够在没有30s窗口的情况下完全直播。 这是代码:
renderersFactory = new DefaultRenderersFactory(getApplicationContext());
bandwidthMeter = new DefaultBandwidthMeter();
trackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
trackSelector = new DefaultTrackSelector(trackSelectionFactory);
DefaultAllocator allocator=new DefaultAllocator(true,DEFAULT_BUFFER_SEGMENT_SIZE);
loadControl = new DefaultLoadControl();
player = ExoPlayerFactory.newSimpleInstance(renderersFactory, trackSelector, loadControl);
player.addListener(this);
dataSourceFactory = new DefaultDataSourceFactory(getApplicationContext(), "ExoplayerDemo");
if(live){
Uri urilive=Uri.parse("http://35.200.250.45:1935/live/-LOWyXJ-OHQVa5U6OwVb/playlist.m3u8");
HlsMediaSource mediaSourcelive= new HlsMediaSource.Factory(dataSourceFactory).setAllowChunklessPreparation(true).createMediaSource(urilive);
player.prepare(mediaSourcelive);