From b3782713cc87f4fafe0242c136a549500c226f52 Mon Sep 17 00:00:00 2001 From: Alexey Danilov Date: Wed, 1 Apr 2015 15:15:48 +0300 Subject: [PATCH] add readme --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..9aed84f --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +Video cache support for Android +============== + +Why AndroidVideoCache? +---- +Because android MediaPlayer doesn't cache video while streaming. + +How to use? +---- +Just add link to repository and dependency: +``` +repositories { + maven { url 'https://github.com/danikula/AndroidVideoCache/raw/mvn-repo' } +} +... +compile 'com.danikula:videocache:1.0' +``` + +and use proxy for caching video: + +``` +@Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + ... + try { + Cache cache = new FileCache(new File(getExternalCacheDir(), VIDEO_CACHE_NAME)); + HttpUrlSource source = new HttpUrlSource(VIDEO_URL); + proxyCache = new HttpProxyCache(source, cache); + videoView.setVideoPath(proxyCache.getUrl()); + videoView.start(); + } catch (ProxyCacheException e) { + Log.e(LOG_TAG, "Error playing video", e); + } + } + + @Override + public void onDestroy() { + super.onDestroy(); + + if (proxyCache != null) { + proxyCache.shutdown(); + } + } + +``` +See `sample` app for details.