android play movie inside expansion file

*爱你&永不变心* 提交于 2019-12-05 21:13:27

问题


My app is trying to deliver lots of contents to users, so the app's size is much greater than 50mb. There is no way we could reduce or remove some of the content, so we decided to go with the expansion approach.

I am trying to follow this tutorial: Android APK Expansion Files, and have been successful up to putting the expansion file into my device for testing. I could get the input stream of any video file inside the expansion. But when I try to setVideoUri for the videoView, it starts crashing. Here are some code:

ZipFileContentProvider contentProvider = new ZipFileContentProvider();
String contentPath = "content://";
File root = Environment.getExternalStorageDirectory();
String EXP_PATH = File.separator + "Android" + File.separator + "obb" + File.separator;
String path = root.toString() + EXP_PATH + context.getPackageName() + File.separator + "main.1.com.c4e1.in2cricket.obb";
String zipFileName =  contentPath + path + "/" + fileName;
Uri uri = Uri.parse(zipFileName);
videoView.setVideoUri(uri);


public class ZipFileContentProvider extends APEZProvider {

    @Override
    public String getAuthority() {
        return "com.c4e1.in2cricket.provider.ZipFileContentProvider";
    }
}

回答1:


While working with zip and obb files it's always a good practice to log the zipEntries you are dealing with.

Check this log to ensure your assumptions are correct.

Use APEZProvider for mediaplayer to provide uri.

Check this in standard android document.

Hope this will help you.



来源:https://stackoverflow.com/questions/13813185/android-play-movie-inside-expansion-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!