vky
vky

Reputation: 105

Unable to play video from raw folder

I'm facing a strange problem in my application . Media player is unable to play video from raw folder but it plays the same video from sdcard.

But if I take another video, it's easily played from the raw folder.

Thanks, Vikas

Code

mVideoView.setVideoURI(Uri.parse("android.resource://<package name>/raw/video1"));
mVideoView.setOnPreparedListener(this);
mVideoView.setOnCompletionListener(this); 
mVideoView.setMediaController(mediaController);
mediaController.setEnabled(true);
mVideoView.requestFocus();
mVideoView.start();

Upvotes: 1

Views: 3137

Answers (1)

njzk2
njzk2

Reputation: 39386

See this question :

Playing .MP4 video from raw resource folder

As it appears, the Uri should contain the id (R.raw._your_video_) rather than the file name

Uri uri = Uri.parse("android.resource://[package]/"+R.raw.[video_resid]);

Upvotes: 3

Related Questions