taraloca taraloca - 1 year ago 101
Android Question

Trying to play video from raw folder (VideoView)

I can play a video from the Internet by inserting the URL like below:

mPath = Uri.parse("http://commonsware.com/misc/test2.3gp");

But now I have a video in my raw folder so the path is res/raw/testing.3gp. The code below doesn't work, and I've tried some other ways too to no avail.

mPath = Uri.parse("../../res/raw/testing.3gp");

Any suggestions?

Answer Source

I had the same problem. This worked for me:

Uri video = Uri.parse("android.resource://com.pac.myapp/raw/master");

So as you see you have 3 parts of the uri: 1) "android.resource://" 2) "com.pac.myapp" 3) "/raw/master"

"master" is the name of your video

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download