How to play mp4 files in VideoView in android - android

Can I play Mp4 video in android with android:minSdkVersion="8". I have looked arround but facing "This video cannot be played"
My code is,
VideoView videoView = (VideoView) findViewById(R.id.videoView);
videoView.setVideoPath(path);
videoView.setMediaController(new MediaController(this));
videoView.requestFocus();
videoView.start();

Related

android Videoview not playing .sdp files what should i do?

I am making live tv channel streaming app.
But when i try to play the .sdp files in the android videoview it gives the error that "Sorry can't play this video".But it is playing .mp4 and .3gp videos successfully.
What should i do.I googled alot but in vain.
String VideoURL = "rtsp://pull.newclear.tv/live/livestream2_160p";
//"rtsp://pull.newclear.tv/live/livestream2_160p";
//.sdp links are also giving same error
//links of above type are not working
This is my code for videoview
MediaController mediacontroller = new MediaController(
VideoViewActivity.this);
mediacontroller.setAnchorView(videoview);
// Get the URL from String VideoURL
Uri video = Uri.parse(VideoURL);
videoview.setMediaController(mediacontroller);
videoview.setVideoURI(video);

RTSP video link is not playing smoothly in android

I am trying to build an android app that will stream video from RTSP web link. I have used vitamio library and video is streaming but the problem is, it is not streaming smoothly. Playback speed changes while streaming.
How to get rid from this?
Code is given below,
videoView = (VideoView) findViewById(R.id.VideoView);
videoView.setVideoURI(Uri.parse(liveUrl));
videoView.setOnBufferingUpdateListener(this);
videoView.setOnCompletionListener(this);
videoView.setOnCompletionListener(this);
videoView.setOnPreparedListener(this);
MediaController mediaController = new MediaController(this);
videoView.setMediaController(mediaController);
videoView.start();
videoView.setVideoQuality(-16);
videoView.setBufferSize(2048);
videoView.requestFocus();

How to play multiple Youtube videos in VideoView?

I am getting multiple Youtube URL from Json through this link!
First Thing is that when i play one url VideoView . I am getting ## Sorry ! this video cannot played##. I have searched for this where RTSP url support VideoView.
Now How I'll get RTSP Url. & How to Play Multiple Videos?
My VideoView Code Is:-
VideoView videoView = (VideoView) findViewById(R.id.VideoView);
Button youtube=(Button)findViewById(R.id.button1);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
Uri video = Uri.parse("http://m.youtube.com/details?v=LKLHoNy5xpE");
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();

Play video from an Url without webview

I have to play Dailymotion videos in an Android APP, but I must not do it in a WebView . VideoView class just accepts files streamed, and Dailymotion API has'nt got any resource for Android.
Does anyone know how to implement it?
Thanks!
String LINK = "Your_Link_Goes_Here";
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();
Try out this code..
VideoView is the best and in video view you can play streaming url also you can play the local files which you have on device sdcard or embeeded with in your app..
Refer this LINK this a sample
LINK

Android Video Streaming

I need HTTP/RTSP Video Streaming with Android. Any Ideas ?
Is that possible to go with JMF with Android ? Any Working examples ?
Already tried with
http://davanum.wordpress.com/2007/12/29/android-videomusic-player-sample-from-local-disk-as-well-as-remote-urls/
Its not working with my case. Are there any specific types of videos that Android can stream ?
Thanks.
You don't necessarily need JMF. Android has built in support for HTTP/RTSP video streaming.
Try this:
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();

Categories

Resources