Need help with MediaSDK?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

210 Stars 40 Forks Apache License 2.0 126 Commits 19 Opened issues


The library is working for downloading video while playing the video, the video contains M3U8/MP4

Services available


Need anything else?

Contributors list

No Data


The library is working for downloading video while playing the video, the video contains M3U8/MP4

Developer documentation is here, Click it

You can refer to the technical documentation:

Use the library:
``` allprojects { repositories { ... maven { url '' } } }

dependencies { implementation 'com.github.JeffMony:MediaSDK:2.0.0' } ```

The Core functions of the project

  • Cache management, LRU
  • Video downloading management
  • Local proxy management
  • Display downloading speed
  • Display the video cache's size
  • Support the video's downloading while playing the video, M3U8/MP4 video

The project's architecture is as follows:

Developer documentation


File file = LocalProxyUtils.getVideoCacheDir(this);
if (!file.exists()) {
LocalProxyConfig config = new VideoDownloadManager.Build(this)
    .setTimeOut(DownloadConstants.READ_TIMEOUT, DownloadConstants.CONN_TIMEOUT, DownloadConstants.SOCKET_TIMEOUT)

1.setCacheRoot The cache path; 2.setUrlRedirect Support request's redirect; 3.setCacheSize Set cache size; 4.setTimeOut Set request's timeout; 5.setPort Set the local proxy server's port; 6.setIgnoreAllCertErrors Support the certificate;

2.The local proxy server's switch

PlayerAttributes attributes = new PlayerAttributes();

3.Set the listener

mPlayer.startLocalProxy(mUrl, null);

private IPlayer.OnLocalProxyCacheListener mOnLocalProxyCacheListener = new IPlayer.OnLocalProxyCacheListener() { @Override public void onCacheReady(IPlayer mp, String proxyUrl) { LogUtils.w("onCacheReady proxyUrl = " + proxyUrl); Uri uri = Uri.parse(proxyUrl); try { mPlayer.setDataSource(PlayerActivity.this, uri); } catch (IOException e) { e.printStackTrace(); return; } mPlayer.setSurface(mSurface); mPlayer.setOnPreparedListener(mPreparedListener); mPlayer.setOnVideoSizeChangedListener(mVideoSizeChangeListener); mPlayer.prepareAsync(); }

public void onCacheProgressChanged(IPlayer mp, int percent, long cachedSize) {
    LogUtils.w("onCacheProgressChanged percent = " + percent);
    mPercent = percent;

public void onCacheSpeedChanged(String url, float cacheSpeed) {
    if (mPlayer != null && mPlayer.get() != null) {

public void onCacheFinished(String url) {
    LogUtils.i("onCacheFinished url="+url + ", player="+this);
    mIsCompleteCached = true;

public void onCacheForbidden(String url) {
    LogUtils.w("onCacheForbidden url="+url+", player="+this);
    mUseLocalProxy = false;
    if (mPlayer != null && mPlayer.get() != null) {

public void onCacheFailed(String url, Exception e) {
    LogUtils.w("onCacheFailed , player="+this);



We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.