• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in MediaController

 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.

I want to play video on my android sdk.
I am able to play the video using MediaController and VideoView stuff. To set path in videoview I uses mVideoView.setVideoPath(path);

But what to do when I am providing video files in package itself.I mean in raw folder of res like drawables and all that.
How to provide its path to videoview.

Please help.
 
Jarrek Smith
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
VideoView video = (VideoView) findViewById(R.id.video);
Uri uri = Uri.parse("android.resource://org.yourpackage/"+R.raw.videonamewithoutextension);
MediaController mc = new MediaController(this);
video .setMediaController(mc);
video .setVideoURI(uri);
video .start();
 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yea,, even I have come to the same solution.But one more problem is occurring. Video does not play properly.It keep showing a screen from video and keep playing the sound in background. I have set OnCompletionListener also.It works fine.
But A message is pop up that a video can not be played.


Any Solution ???

Ask again if my query is not clear.
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic