Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the SampleZipfileProvider class?

At the bottom of the section in Google's dev guide on expansion files (http://developer.android.com/guide/market/expansion-files.html#ZipLib) there is the following text.

APEZProvider - Most applications don't need to use this class. This class defines a ContentProvider that marshals the data from the ZIP files through a content provider Uri in order to provide file access for certain Android APIs that expect Uri access to media files. The sample application available in the Apk Expansion package demonstrates a scenario in which this class is useful to specify a video with VideoView.setVideoURI(). See the sample app's class SampleZipfileProvider for an example of how to extend this class to use in your application.

The sample application in question doesn't contain this class. But it does contain a reference to a .SampleVideoPlayerActivity file in the AndroidManifest.xml, which is not present in the project either.

Has anyone tried to implement a concrete class based on the APEZProvider and used it with VideoView.setVideoURI()?

I have implemented the class:

public class ZipFileContentProvider extends APEZProvider {

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

But I don't know how to use it with the VideoView.setVideoURI() call. Can anyone help?

like image 869
elprl Avatar asked Mar 08 '12 19:03

elprl


1 Answers

It turned out that my ZipFileContentProvider was sufficient. For those coming across this problem. Here is what I did to use the content provider for the VideoView.setVideoURI() method.

Add provider to Manifest.

<provider android:authorities="com.myCompany.myAppName.provider.ZipFileContentProvider" android:name=".ZipFileContentProvider"></provider>

In video player class:

final String AUTHORITY = "com.myCompany.myAppName.provider.ZipFileContentProvider";
final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
video = (VideoView) findViewById(R.id.video);
video.setVideoURI(Uri.parse(CONTENT_URI + "/" + videoFileName + ".mp4"));
like image 173
elprl Avatar answered Oct 12 '22 13:10

elprl