I am doing this sort of code to play a Video in android...
I send the video link from previous activity by put extra.
And try to get the link in this page
video = (VideoView) findViewById(R.id.VideoView);
String path = getIntent().getStringExtra("url");
video.setVideoURI(uri);
video.start();
Do i misss something??
Try This....
video = (VideoView) findViewById(R.id.VideoView);
String path = getIntent().getStringExtra("url");
Uri uri = Uri.parse(path);
video.setVideoURI(uri);
video.start();
use like that
video = (VideoView) findViewById(R.id.VideoView);
String path = getIntent().getStringExtra("url");
video .setVideoURI(Uri.parse(path));
video .setMediaController(new MediaController(this));
video .requestFocus();
video .start();
Related
I want to play video through URL of YouTube Using VideoView in Android. Please help me.
try this :
videoView = (VideoView) findViewById(R.id.video_view);
waitSign = (ProgressBar) findViewById(R.id.progress_bar);
waitSign.setVisibility(View.VISIBLE);
MediaController contorls = new MediaController(this);
contorls.setAnchorView(videoView);
videoView.setMediaController(contorls);
String url = "http://www.somedomain.com/samplevideo.mp4";
videoView.setVideoURI(Uri.parse(url));
videoView.start();
remember to put the extension on the file name
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(){
}
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 have managed to stream video from internet using Video View
Uri uri=Uri.parse(videoFileList[0]);
VideoView vv=(VideoView) this.findViewById(R.id.vv);
vv.setVisibility(1);
vv.bringToFront();
vv.setVideoURI(uri);
vv.setMediaController(new MediaController(this));
vv.requestFocus();
But the video page displays as blank at first. Only if I click on the blank space the video view appeares.
Can any body give a solution to display it automatically?
Try this. It worked for me.
void playvideo(String url)
{
String link=url;
Log.e("url",link);
view1 = (VideoView) findViewById(R.id.myVideoView);
getWindow().setFormat(PixelFormat.TRANSLUCENT);
MediaController mc = new MediaController(this);
mc.setMediaPlayer(view1);
view1.setMediaController(mc);
view1.setVideoURI(Uri.parse(link));
view1.requestFocus();
view1.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();