Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

播放缓存MP4文件报错 #22

Closed
lijijordan opened this issue Dec 6, 2017 · 6 comments
Closed

播放缓存MP4文件报错 #22

lijijordan opened this issue Dec 6, 2017 · 6 comments

Comments

@lijijordan
Copy link

lijijordan commented Dec 6, 2017

image
视频地址:https://s3.cn-north-1.amazonaws.com.cn/mxjwebsite/smartoffice-public/mscreen/screen_test.mp4

@yale8848
Copy link
Owner

yale8848 commented Dec 6, 2017

你使用最新版本测试的吗?ren.yale.android:cachewebviewlib:1.2.7
mp4文件不会缓存的,目前CacheWebView不支持多媒体缓存的

@lijijordan
Copy link
Author

我改了一下,想用来缓存mp4文件,但是缓存成功了一部分,感觉没有把完整的流都保存下来。
if (extension.toLowerCase().equals("js") || extension.toLowerCase().equals("css") || extension.toLowerCase().equals("mp4")) { return true; }

这个encode是用来干啥呢?
if (mStaticRes.isCanGetEncoding(extension)&&TextUtils.isEmpty(encoding)){ InputStreamUtils inputStreamUtils = new InputStreamUtils(resourseInputStream.getInnerInputStream()); inputStreamUtils.setEncodeBufferSize(CacheConfig.getInstance().getEncodeBufferSize()); long start = System.currentTimeMillis(); InputStream copyInputStream = inputStreamUtils.copy(mEncodingDetect); if (copyInputStream == null){ return null; } resourseInputStream.setInnerInputStream(copyInputStream); encode = inputStreamUtils.getEncoding(); CacheWebViewLog.d(encode+" "+"get encoding timecost: "+(System.currentTimeMillis()-start)+ "ms "+url); }

@yale8848
Copy link
Owner

yale8848 commented Dec 6, 2017

encode是判断html,js,css文件编码的,我当初设计的时候就没有给多媒体文件设计缓存,如果你给视频添加缓存的话是会失败的

@lijijordan
Copy link
Author

如果加载流媒体文件应该怎么设计缓存呢?能提示下么?

@yale8848
Copy link
Owner

yale8848 commented Dec 6, 2017

流媒体的一般通过设置代理实现缓存,你可以 参考参考这个库 https://github.com/danikula/AndroidVideoCache

@lijijordan
Copy link
Author

OK 谢啦!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants