Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android play movie inside expansion file

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";
    }
}
like image 946
vodkhang Avatar asked Dec 11 '12 03:12

vodkhang


1 Answers

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.

like image 190
Ajay Kumar Meher Avatar answered Oct 17 '22 19:10

Ajay Kumar Meher