Java Code Examples for com.danikula.videocache.HttpProxyCacheServer#registerCacheListener()
The following examples show how to use
com.danikula.videocache.HttpProxyCacheServer#registerCacheListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VideoFragment.java From AndriodVideoCache with Apache License 2.0 | 5 votes |
private void startVideo() { HttpProxyCacheServer proxy = App.getProxy(getActivity()); proxy.registerCacheListener(this, url); String proxyUrl = proxy.getProxyUrl(url); Log.d(LOG_TAG, "Use proxy url " + proxyUrl + " instead of original url " + url); videoView.setVideoPath(proxyUrl); videoView.start(); }
Example 2
Source File: ProxyCacheManager.java From GSYVideoPlayer with Apache License 2.0 | 5 votes |
@Override public void doCacheLogic(Context context, IMediaPlayer mediaPlayer, String originUrl, Map<String, String> header, File cachePath) { String url = originUrl; userAgentHeadersInjector.mMapHeadData.clear(); if (header != null) { userAgentHeadersInjector.mMapHeadData.putAll(header); } if (url.startsWith("http") && !url.contains("127.0.0.1") && !url.contains(".m3u8")) { HttpProxyCacheServer proxy = getProxy(context.getApplicationContext(), cachePath); if (proxy != null) { //此处转换了url,然后再赋值给mUrl。 url = proxy.getProxyUrl(url); mCacheFile = (!url.startsWith("http")); //注册上缓冲监听 if (!mCacheFile) { proxy.registerCacheListener(this, originUrl); } } } else if ((!url.startsWith("http") && !url.startsWith("rtmp") && !url.startsWith("rtsp") && !url.contains(".m3u8"))) { mCacheFile = true; } try { mediaPlayer.setDataSource(context, Uri.parse(url), header); } catch (IOException e) { e.printStackTrace(); } }
Example 3
Source File: VideoFragment.java From AndroidVideoCache with Apache License 2.0 | 5 votes |
private void startVideo() { HttpProxyCacheServer proxy = App.getProxy(getActivity()); proxy.registerCacheListener(this, url); String proxyUrl = proxy.getProxyUrl(url); Log.d(LOG_TAG, "Use proxy url " + proxyUrl + " instead of original url " + url); videoView.setVideoPath(proxyUrl); videoView.start(); }
Example 4
Source File: GalleryVideoFragment.java From AndriodVideoCache with Apache License 2.0 | 4 votes |
private void startProxy() { HttpProxyCacheServer proxy = App.getProxy(getActivity()); proxy.registerCacheListener(this, url); videoView.setVideoPath(proxy.getProxyUrl(url)); }
Example 5
Source File: GalleryVideoFragment.java From AndroidVideoCache with Apache License 2.0 | 4 votes |
private void startProxy() { HttpProxyCacheServer proxy = App.getProxy(getActivity()); proxy.registerCacheListener(this, url); videoView.setVideoPath(proxy.getProxyUrl(url)); }