Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found myself a way to do this through a content provider. I got a hint about the Content Provider from question <a href="https://stackoverflow.com/questions/13813185/android-play-movie-inside-expansion-file">android play movie inside expansion file</a>, although in that question the URL was not used to start an external application.</p> <p>We need a ContentProvider class that extends Google's APEZProvider:</p> <pre><code>public class ZipFileContentProvider extends APEZProvider { @Override public String getAuthority() { return "com.example.expansionexperiment.provider"; } } </code></pre> <p>And it needs to be added to Manifest and exported:</p> <pre><code>&lt;provider android:exported="true" android:name="com.example.expansionexperiment.ZipFileContentProvider" android:authorities="com.example.expansionexperiment.provider" /&gt; </code></pre> <p>The authority in the manifest and in getAuthority() must be the same.</p> <p>Now we can create a Uri to the file inside Expansion File:</p> <pre><code>// 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); </code></pre> <p>The content provider provides now access to the zip file and the files within just with the URL.</p> <p>However, PhoneGap's Media plugin does not support content providers, because if the URL does not start with http, it inserts "/sdcard/" in front of the URL. (!!!) Therefore, to play audio files through the zip content provider, you will need to write your own audio plugin.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload