api有一个令牌头,我需要设置,但视频没有加密。
我有两个问题:
如何使用Exoplayer从磁盘播放.mpg、.mpeg、.3gp、.mov和其他文件?
如何使用exoplayer设置头文件并从url传输mp4视频?

最佳答案

找到了答案:

DefaultHttpDataSource source = new DefaultHttpDataSource(userAgent, null);
    source.setRequestProperty("Authorization", "your auth code");
    source.setRequestProperty("Accept", "...");

    ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, source, extractor, 2,
            BUFFER_SIZE);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource,
            null, true, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING, 5000, null, player.getMainHandler(),
            player, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
            null, true, player.getMainHandler(), player);

09-28 02:03