3

Here is my code. In this if I launch the intent with video url it play's while it doesn't play's in videoview is there any way to get it working in VideoView

VideoView mVideoView = new VideoView(this);
String videoURL = "video_url";
mVideoView.setMediaController(new MediaController(this));
mVideoView.setVideoURI(Uri.parse(videoURL));

setContentView(mVideoView);

while this native player plays video

Intent theIntent = new Intent();
theIntent.setDataAndType(Uri.parse(videoURL), "video/*");

I tested this on device also

overbet13
  • 1,654
  • 1
  • 20
  • 36
Vishal Pawar
  • 4,324
  • 4
  • 28
  • 54

2 Answers2

2

Try below way

            VideoView videoView = (VideoView) findViewById(R.id.VideoView);
            MediaController mediaController = new MediaController(this);
            mediaController.setAnchorView(videoView);
            // Set video link (mp4 format )
            Uri video = Uri.parse("mp4 video link");
            videoView.setMediaController(mediaController);
            videoView.setVideoURI(video);
            videoView.start();

Refer this link

https://stackoverflow.com/a/6410421/1441666

And also check supported formats Android Supported Media Formats

https://stackoverflow.com/a/8714189/1441666

Community
  • 1
  • 1
Nirali
  • 13,571
  • 6
  • 40
  • 53
0

i think this might be helpfull.

VideoView view = (VideoView) findViewById(R.id.xxxx);

MediaController mc = new MediaController(this);
mc.setMediaPlayer(view);
view.setMediaController(mc);
try{
    view.setVideoURI(Uri.parse(file_path));
} catch(){
}
view.requestFocus();
try{
    view.start();   
}catch(){
}
johny kumar
  • 1,270
  • 2
  • 14
  • 24
Bibin Jose
  • 93
  • 1
  • 8