我正在尝试缓存HLS和DASH流视频,我已经尝试了许多解决方案,但在Exoplayer v2.2中无法正常工作。许多问题都指向以下链接,但没有得到任何适当的解决方案:https://github.com/google/ExoPlayer/issues/420和Using cache in ExoPlayer。
在一个解决方案中,“ExtractorSampleSource”类在Google Exoplayer 2.2中找不到。
在其他解决方案中也出现了同样的错误“在v2.2中找不到'DefaultUriDataSource'类”。
在一个解决方案中,“ExtractorSampleSource”类在Google Exoplayer 2.2中找不到。
OkHttpClient okHttpClient = new OkHttpClient.Builder().cache(new okhttp3.Cache(context.getCacheDir(), 1024000)).build();
OkHttpDataSource okHttpDataSource = new OkHttpDataSource(okHttpClient, "android", null);
OkHttpDataSource ok2 = new OkHttpDataSource(okHttpClient, "android", null);
HttpDataSource dataSource = new CacheDataSource(context, okHttpDataSource, ok2);
ExtractorSampleSource sampleSource = new ExtractorSampleSource(
uri,
dataSource,
allocator,
buffer_segment_count * buffer_segment_size,
new Mp4Extractor(), new Mp3Extractor());
在其他解决方案中也出现了同样的错误“在v2.2中找不到'DefaultUriDataSource'类”。
DataSource dataSource = new DefaultUriDataSource(context, null, new OkHttpDataSource(getClient(context), userAgent, null, null/*, CacheControl.FORCE_CACHE*/));
所有的解决方案都是1到2年前的,而且不支持最新版本的Google Exoplayer v2.2。
有没有人有任何想法、样本或任何解决方法来缓存HLS和DASH流?