Is there any way to get url for a specific file in android extension file?

I am creating a PhoneGap application that contains large audio and video files. In Android, media files must be in the extension file so that the application size is limited to the Google Play limit of 50 MB.

I am currently considering two ways to play video files:

  • Unzip (possibly temporarily) the desired video file from the extension file on the SDCard, get its URL and launch the media player application. Unpacking takes some time, so the user will have to wait a few seconds depending on the size of the video.
  • Create your own video player as a PhoneGap plugin using the Android VideoView class. Thus, I can play directly from the extension file without first unzipping the file and getting a more flexible application.

However, I wonder if there is a way to get the URL of the video files inside the extension file ? This will allow my application to add the URL in the intent with which the user prefers the application to the media player, and I would prefer this approach.

+2
source share
1 answer

-. , - , URL- .

ContentProvider, Google APEZProvider:

public class ZipFileContentProvider extends APEZProvider {
    @Override
    public String getAuthority() {
        return "com.example.expansionexperiment.provider";
    }
}

:

<provider
    android:exported="true"
    android:name="com.example.expansionexperiment.ZipFileContentProvider"
    android:authorities="com.example.expansionexperiment.provider" />

getAuthority() .

Uri :

// Filename inside my expansion file
String filename = "video/video.mp4";
String uriString = "content://com.example.expansionexperiment.provider" +  File.separator + filename;
Uri uri = Uri.parse(uriString);

// Start video view intent
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "video/*");
startActivity(intent);

zip URL-.

PhoneGap Media -, , URL- http, "/sdcard/" URL-. (!!!) zip- -.

+2

All Articles