Trying to play video from raw folder (VideoView)

前端 未结 4 1732
悲&欢浪女
悲&欢浪女 2020-12-05 10:45

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

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


        
4条回答
  •  醉酒成梦
    2020-12-05 11:20

    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

提交回复
热议问题