ExoPlayer力质量破折号

时间:2018-07-16 11:55:35

标签: android exoplayer mpeg-dash exoplayer2.x

我正试图找到一个视频播放器,以便在其中选择视频质量。像Youtube一样:默认情况下会选择“自动”,但通过开关您可以选择:360p,720p等。

“自动”部分现在可以使用以下代码工作: ```

        TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(BANDWIDTH_METER);
        trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
        player = ExoPlayerFactory.newSimpleInstance(getContext(), trackSelector, new DefaultLoadControl());

稍后我创建一个新的DashMediaSource。

 return new DashMediaSource(uri, buildDataSourceFactory(true),
          new DefaultDashChunkSource.Factory(mediaDataSourceFactory), mainHandler, null);

因此,视频现在正在播放,但是现在如何提高质量?例如,当我选择360p时,我希望播放器选择该表示形式。

<AdaptationSet segmentAlignment="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1"> <Representation bandwidth="954483" codecs="avc1.4d401f" frameRate="525007/17491" height="360" id="VIDEO-1" mimeType="video/mp4" startWithSAP="1" width="640"> <BaseURL>video360.fmp4</BaseURL> <SegmentBase indexRange="914-1425" indexRangeExact="true"> <Initialization range="0-913"/> </SegmentBase> </Representation> <Representation bandwidth="2351904" codecs="avc1.4d401f" frameRate="525007/17491" height="720" id="VIDEO-2" mimeType="video/mp4" startWithSAP="1" width="1280"> <BaseURL>video720.fmp4</BaseURL> <SegmentBase indexRange="914-1425" indexRangeExact="true"> <Initialization range="0-913"/> </SegmentBase> </Representation> </AdaptationSet>

我找到了FixedTrackSelectionAdaptationSet,但是我没有找到解决方法

有人知道我该怎么做到吗?

0 个答案:

没有答案