想在Android应用程序中使用exoplayer播放DASH文件

时间:2017-04-26 08:45:53

标签: android exoplayer

我已成功使用exoplayer播放hls文件,但需要播放DASH文件的示例。请给我样品或概述。所以能够发挥它。提前谢谢

1 个答案:

答案 0 :(得分:0)

DataSource videoDataSource =
                new DefaultUriDataSource(context, bandwidthMeter, userAgent);
        ChunkSource videoChunkSource = new DashChunkSource(manifestFetcher,
                DefaultDashTrackSelector.newVideoInstance(context, true, filterHdContent),
                videoDataSource, new FormatEvaluator.AdaptiveEvaluator(bandwidthMeter), LIVE_EDGE_LATENCY_MS,
                elapsedRealtimeOffset, mainHandler, (DashChunkSource.EventListener) player, VideoPlayer.TYPE_VIDEO);
        ChunkSampleSource videoSampleSource =
                new ChunkSampleSource(videoChunkSource, loadControl,
                        MAIN_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, mainHandler, player,
                        VideoPlayer.TYPE_VIDEO);
        TrackRenderer videoRenderer =
                new MediaCodecVideoTrackRenderer(context, videoSampleSource,
                        MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT,
                        5000,
                        drmSessionManager, true, mainHandler, player, 50);