kenwen
kenwen

Reputation: 834

Mass confusion as to where to store video clips

Progressing well with my first attempts at an Android app but getting REALLY stuck on how and where to store video clips for the app.

Firstly I tested out storing in the resources folder and playing through a custom video activity by passing it the resource URI. That doesn't appear to work as I get a "cannot play video" report. The URI passed is derived by using

android.resource://package.name/ + R.raw.videoclipname and appears to be correctly formed.

Secondly I tried using the asset folder, again passing a URI formed using asset path. That reports the same error

Finally, I stored the video clips to the SD card which did work! However, how do I package the app with the videos so that the clips install to sdcard!? And how do I keep videos private as they keep appearing in the gallery which is disconcerting.

Any help appreciated :)

Thx, Ken

Upvotes: 1

Views: 789

Answers (2)

kenwen
kenwen

Reputation: 834

Okay

After much research and head banging it seems that the recognised method of storing data files should be on the sdcard.

the way that I've done this is package the videos in the assets folder, then using an Assetmanager object transfer them to the sdcard under a directory structured as package name/files

Seems like a crazy method as the assets folder appears to be designed for exactly that - storing files in packages :)

Upvotes: 0

Bosah Chude
Bosah Chude

Reputation: 3810

You can disable media scanning on a directory by adding an empty file titled .nomedia in it.

This would tell the android system not to scan that directory for media files to add to the gallery.

Source

Upvotes: 2

Related Questions