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
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
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(){
}
Related
File f = new File("/sdcard/Sample.3gp");
byte[] videoUp=new byte[576600];
videoUp = IOUtils.toByteArray( new FileInputStream(f));
// I want to play video after i convert it into bytes
nothning makes it to play when i convert and put to videoview.
try this:
VideoView videoView = (VideoView) findViewById(R.id.VideoView01);
MediaController mediaController = new MediaController(this);
mediaController.setMediaPlayer(videoView);
videoView.setVideoPath(path);
videoView.setMediaController(mediaController);
videoView.requestFocus();
videoView.start();
mediaController.show();
Instead you can directly play video from sdcard as,
VideoView videoView = (VideoView) findViewById(R.id.videoView);
videoView.setVideoPath("/sdcard/Sample.3gp");
videoView.setMediaController(mediaController);
videoView.requestFocus();
videoView.start();
You can use MediaController if you want to control any player options.
How can I play .avi video in android? The video in coming from a url.
Hey you can try the following code to play videos using URL
String link="http://s1133.photobucket.com/albums/m590/Anniebabycupcakez/?action=view& current=1376992942447_242.avi";
VideoView videoView = (VideoView) findViewById(R.id.VideoView);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
Uri video = Uri.parse(link);
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
Using a VideoView just set the uri:
videoView.setVideoURI(Uri.parse(videoUrl));
How can I play videos from URL in android?. without new Intent?. is available?
Thanks
try this
String url="your video url";
VideoView videoView = new VideoView(this);
videoView.setVideoURI(Uri.parse(url));
setContentView(videoView);
videoView.setMediaController(new MediaController(this));
hope help
Try this code...It should work fine.
VideoView videoView = (VideoView) findViewById(R.id.video_view);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
String link = "http://www.youtube.com/watch?v=lEbxLDuecHU&playnext=1&list=PL040F3034C69B1674";
Uri videoLink = Uri.parse(link);
videoView.setMediaController(mediaController);
videoView.setVideoURI(videoLink);
videoView.start();
I want to play mp4 video from server in android.
Video URL
I tried with using video view but there is blank screen appear.
I also tried with Intent.Action view but it show message "Cant play video".
Is there any other way to do this ?
Thanks in advance.
Use Like this:
Uri uri = Uri.parse(URL); //Declare your url here.
VideoView mVideoView = (VideoView)findViewById(R.id.videoview)
mVideoView.setMediaController(new MediaController(this));
mVideoView.setVideoURI(uri);
mVideoView.requestFocus();
mVideoView.start();
Another Method:
String LINK = "type_here_the_link";
VideoView mVideoView = (VideoView) findViewById(R.id.videoview);
MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
Uri video = Uri.parse(LINK);
mVideoView.setMediaController(mc);
mVideoView.setVideoURI(video);
mVideoView.start();
I am using following code to play mp4 videos which is stored in sever.... And i am get error like this->
This Video can not be played????
Uri video = Uri.parse("http://129.0.0.....");
MediaController mediaController = null;
mVideoView.setMediaController(mediaController);
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://129.0.0....")));
mVideoView.setVideoURI(video);
mVideoView.setVideoPath("http://129.0.0......");
mVideoView.requestFocus();
mVideoView.start();
This might be helpful to you i have used this in android 2.3.3.
public void videoPlayer(String path, String fileName, boolean autoplay){
//get current window information, and set format, set it up differently, if you need some special effects
getWindow().setFormat(PixelFormat.TRANSLUCENT);
//the VideoView will hold the video
VideoView videoHolder = new VideoView(this);
//MediaController is the ui control howering above the video (just like in the default youtube player).
videoHolder.setMediaController(new MediaController(this));
//assing a video file to the video holder
videoHolder.setVideoURI(Uri.parse(YOUR_SERVER_VIDEOFILE_URL));
//get focus, before playing the video.
videoHolder.requestFocus();
if(autoplay){
videoHolder.start();
}
}
Always pass the mp4,3gp etc video format link in URI.Try this code:
VideoView videoView = (VideoView)this.findViewById(R.id.videoView);
MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
videoView.setMediaController(mc);
videoView.setVideoURI(Uri.parse("http://hermes.sprc.samsung.pl/widget/tmp/testh.3gp"));
videoView.requestFocus();
videoView.start();