Dear All; I am new in android app; I try to play video from my resource , but no idea how to do it... any help?? regards..
Asked
Active
Viewed 2,116 times
0
-
1The videoview demo is a good place to start: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/media/VideoViewDemo.html , and this will help you converting resources to path: http://androidbook.blogspot.com/2009/08/referring-to-android-resources-using.html – MByD Apr 16 '11 at 09:19
-
Possible duplicate of [How to play videos in android from assets folder or raw folder?](http://stackoverflow.com/questions/3028717/how-to-play-videos-in-android-from-assets-folder-or-raw-folder) – Ciro Santilli OurBigBook.com Feb 03 '16 at 20:39
1 Answers
3
I think the following can help (that's the way I implement it):
VideoView vd;
vd = (VideoView) findViewById(R.id.VideoView);
Uri uri = Uri.parse("android.resource://org.android.Test.Test/raw/vid"); vd.setVideoURI(uri);
vd.start();
where Test.Test is the name of my package.
Remark: You didn't ask it, but some video files do not work on emulator (you hear only the music, but see no picture). In this case debug it on your phone.

amigal
- 517
- 3
- 8
- 21
-
**IMPORTANT:** To use the `R.raw` path, you must put your video in the "res/raw" folder and not under "assets". Also, to be clear in the above code, the package name of the app in the above example would be `org.android.Test.Test`, not just `Test.Test`. – Kent Apr 15 '13 at 05:02