views:

97

answers:

2

I am developing an Android App and would like to have a video file (mp4) bundled inside the .apk so that when the app is launched I can play a short intro video.

Unfortunately I'm having trouble figuring out where in my project folder I should place this video file, and also how to access it (the path to the file).

I am using videoView.setVideoPath();

Any help would be greatly appreciated. Thanks

+1  A: 

You should put it in /res/raw and access it with

getResources().openRawResource(id)

Find more info here.

Key
Thanks. I tried this, but I believe that setVideoPath() is looking for the path to a file (String), not a resource ID. It wouldn't play when I used this technique.
justinl
+1  A: 

Put it in res\raw folder. Then in code use this uri: "android.resource://com.mypackagename/raw/myvideosample"

Orsol
It worked! Thanks. As an additional note for future readers, you should omit the file extension. Mine would only work when I omitted the file extension from the path.
justinl