Video in Expansion Pack

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Video in Expansion Pack

johnHolmes
Hi to all,

In my app I need to play a video file (.mp4) The source file is stored inside an Android Expansion Packs files (.obb). How can I read it ?

An example done in Android
http://stackoverflow.com/questions/11300137/playing-sound-files-from-expansion-file

What I'm missing is how to get the FileDescriptor instance from the expansion file.



_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|

Re: Video in Expansion Pack

johnHolmes
I've found a solution to this. I'll post here just in case anyone is interested

Using the APK Expansion Pack library porting for Xamarin.Android you get the relative ZipEntry of a file into the .obb package. Then you create an AssetFileDescriptor using a ParcelFileDescriptor.
In this way you can stream the video inside the .zip file without extracting it somewhere (temp file). Remember to create your zip file with no compression for the .mp4 files

            var expansion = ApkExpansionSupport.GetApkExpansionZipFile(this, 1, 1);
            var entry = expansion.GetEntry("videos/myvideo.mp4");

            var pfd = ParcelFileDescriptor.Open(new Java.IO.File(sourcePath), ParcelFileMode.ReadOnly);
            var fd = new AssetFileDescriptor(pfd, entry.FileOffset, entry.FileSize);
  


On Sat, May 11, 2013 at 4:18 PM, Francesco Colombo <[hidden email]> wrote:
Hi to all,

In my app I need to play a video file (.mp4) The source file is stored inside an Android Expansion Packs files (.obb). How can I read it ?

An example done in Android
http://stackoverflow.com/questions/11300137/playing-sound-files-from-expansion-file

What I'm missing is how to get the FileDescriptor instance from the expansion file.




_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|

Re: Video in Expansion Pack

ChaseFlorell
I'm having a similar issue, but I'm wondering, where did you get sourcePath from?
johnHolmes wrote
I've found a solution to this. I'll post here just in case anyone is
interested

             var expansion = ApkExpansionSupport.GetApkExpansionZipFile(this
, 1, 1);
            var entry = expansion.GetEntry("videos/myvideo.mp4");

            var pfd = ParcelFileDescriptor.Open(new Java.IO.File(sourcePath)
, ParcelFileMode.ReadOnly);
            var fd = new AssetFileDescriptor(pfd, entry.FileOffset, entry.
FileSize);


On Sat, May 11, 2013 at 4:18 PM, Francesco Colombo <
[hidden email]> wrote:

> Hi to all,
>
> In my app I need to play a video file (.mp4) The source file is stored
> inside an Android Expansion Packs files (.obb). How can I read it ?
>
> An example done in Android
>
> http://stackoverflow.com/questions/11300137/playing-sound-files-from-expansion-file
>
> What I'm missing is how to get the FileDescriptor instance from the
> expansion file.
>
>
>

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid