Play youtube video in video player - android

I want to play a video from youtube in my app. But i dont want to use Youtube application for that. I prefer native videoplayer. I have written the below code for that. But nothing is happening. Only a black screen is displaying.
String link= getIntent().getExtras().get("url").toString();
VideoView videoView = (VideoView) findViewById(R.id.videoPlayer);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
Uri video = Uri.parse(link);
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
Please help me. Thanks in advance.

just simply do it like that hope it's work:
String link= getIntent().getExtras().getString("url");
VideoView videoView = (VideoView) findViewById(R.id.videoPlayer);
Uri video = Uri.parse(link);
videoView.setVideoURI(video);
videoView.start();

Related

rtsp for sony-max in android 2.3.3

i have an android app that will live stream videos in android 2.3.3,i have found on that rtsp link in videoview works for that purpose from
String LINK = "type_here_the_link";
setContentView(R.layout.mediaplayer);
VideoView videoView = (VideoView) findViewById(R.id.video);
MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
Uri video = Uri.parse(LINK);
videoView.setMediaController(mc);
videoView.setVideoURI(video);
videoView.start();
.But i am not getting any rtsp working link for sony max or sony six.
i have tried
rtsp://208.77.20.52:1935/dmm1/setmax.
any 1 having any idea about what can be done??
Any help will be appreciated.

How To Play .avi videos using url in android by programing

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 to play video from website in android?

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();

how can I play this video in webview or videoview?

I mean I want to play this url:http://212.175.206.240:80/saat_kulesi?MSWMExt=.asf in webview or videoview . But I don't play this url.
I try this :
VideoView videoView = (VideoView)findViewById(R.id.videoView1);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
videoView.setMediaController(mediaController);
videoView.setVideoPath("http://212.175.206.240:80/saat_kulesi?MSWMExt=.asf");
videoView.start();
and I try this too :
WebView wv2 = (WebView)findViewById(R.id.webView1);
wv2.getSettings().setJavaScriptEnabled(true);
wv2.loadUrl("http://212.175.206.240:80/saat_kulesi?MSWMExt=.asf");
But two of my method but dont work. How can succeed it ?

How does live video streaming work in Android?

How does live video streaming work in Android?
Although I havent tried this but according to web it works
VideoView videoView = (VideoView) findViewById(R.id.surface_view);
MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
Uri video = Uri.parse(URL);
videoView.setMediaController(mc);
videoView.setVideoURI(video);
videoView.start();

Categories

Resources