1 Star 0 Fork 0

AfterFinal / AFCache

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

AFCache

介绍

AFCache

软件架构

以本地代理的模式实现视频、文件缓存

安装教程

dependencies {
    implementation 'com.gitee.afterfinal:afcache:1.0.1'
}

使用说明

AFCache.setCacheDir(new File(getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS), "afcahes"));//设置缓存文件夹
AFCache.setCacheFilter();//决定哪些文件类型需要缓存
AFCache.setKeyUriDecryptor();//对于加密m3u8,自定义uri的处理
AFCache cache = new AFCache();
cache.getUrl(originUrl, new AFCache.Callback() {
	@Override
	public void onUrlGet(String url) {
		if (videoView.isPlaying()) {
			videoView.stopPlayback();
		}
		Map<String, String> headers = new HashMap<>();
		if (null != tag) {
			headers.put("Clear-Cache", tag);//tag=1,清除当前url对应的缓存
		}
		videoView.setVideoURI(Uri.parse(url), headers);
		videoView.setMediaController(new MediaController(MainActivity.this));
		videoView.start();
	}

	@Override
	public void onError(Throwable e) {
		Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
	}
});
cache.stop();

参与贡献

特技

Comments ( 0 )

Sign in for post a comment

About

视频缓存,m3u8缓存,m3u8加密缓存,理论上支持所有文件缓存 spread retract
Cancel

Releases (2)

All

Contributors

All

Activities

load more
can not load any more
1
https://gitee.com/afterfinal/afcache.git
git@gitee.com:afterfinal/afcache.git
afterfinal
afcache
AFCache
master

Search