//google音视频播放框架
compile 'com.google.android.exoplayer:exoplayer:r2.5.4'
利用exoplayer自定义了DataSource来解密AES加密的流。
核心代码:
// 1.创建一个默认TrackSelector,测量播放过程中的带宽。 如果不需要,可以为null。
DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
//从MediaSource中选出media提供给可用的Render S来渲染,在创建播放器时被注入
TrackSelection.Factory videoTrackSelectionFactory =
new AdaptiveTrackSelection.Factory(bandwidthMeter);
//自适应轨道
TrackSelector trackSelector =
new DefaultTrackSelector(videoTrackSelectionFactory);
//控制MediaSource缓存media
DefaultLoadControl loadControl = new DefaultLoadControl();
WeimsDataSourceFactory 复制 DefaultDataSourceFactory
核心方法:
public DataSource createDataSource() {
return new WeimsDataSource(context, listener, baseDataSourceFactory.createDataSource());
}