Exoplayer,http音频流媒体。没有作品寻求

时间:2016-08-21 18:12:31

标签: android streaming exoplayer

我尝试使用exoplayer的简单实现。此变体不会缓冲后向流。 getDuration()随时返回-1。并且任何参数的seekTo()都没有移动流。如何正确缓冲结果,并使用seekTo()

    int RENDERER_COUNT = 1; //since you want to render simple audio
    int minBufferMs = 1000;
    int minRebufferMs = 5000;
    exoPlayer=ExoPlayer.Factory.newInstance(RENDERER_COUNT,minBufferMs,minRebufferMs);
    int BUFFER_SEGMENT_SIZE = 64 * 1024;
    int BUFFER_SEGMENT_COUNT = 256;


    Uri radioUri = Uri.parse(url2);
    String userAgent = Util.getUserAgent(this, "ExoPlayerDemo");

    DataSource dataSource = new DefaultHttpDataSource(userAgent, null, null);
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
    ExtractorSampleSource extractorSampleSource = new ExtractorSampleSource(radioUri, dataSource, allocator, BUFFER_SEGMENT_COUNT*BUFFER_SEGMENT_SIZE);
    MediaCodecAudioTrackRenderer audioTrackRenderer = new MediaCodecAudioTrackRenderer(extractorSampleSource,MediaCodecSelector.DEFAULT);
    exoPlayer.prepare(audioTrackRenderer);
    exoPlayer.setPlayWhenReady(true);
    playerControl=new PlayerControl(exoPlayer);

0 个答案:

没有答案