I am beginner in android development and try to play video from link. But it\'s giving error \"sorry,we can\'t play this video\"
. I tried so many links but for
It has something to do with your link and content. Try the following two links:
String path="http://www.ted.com/talks/download/video/8584/talk/761";
String path1="http://commonsware.com/misc/test2.3gp";
Uri uri=Uri.parse(path1);
VideoView video=(VideoView)findViewById(R.id.VideoView01);
video.setVideoURI(uri);
video.start();
Start with "path1", it is a small light weight video stream and then try the "path", it is a higher resolution than "path1", a perfect high resolution for the mobile phone.
please check this link : http://developer.android.com/guide/appendix/media-formats.html
videoview can't support some codec .
i suggested you to use mediaplayer , when get "sorry , can't play video"
You can do it using FullscreenVideoView
class. Its a small library project. It's video progress dialog is build in. it's gradle is :
compile 'com.github.rtoshiro.fullscreenvideoview:fullscreenvideoview:1.1.0'
your VideoView xml is like this
<com.github.rtoshiro.view.video.FullscreenVideoLayout
android:id="@+id/videoview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
In your activity , initialize it using this way:
FullscreenVideoLayout videoLayout;
videoLayout = (FullscreenVideoLayout) findViewById(R.id.videoview);
videoLayout.setActivity(this);
Uri videoUri = Uri.parse("YOUR_VIDEO_URL");
try {
videoLayout.setVideoURI(videoUri);
} catch (IOException e) {
e.printStackTrace();
}
That's it. Happy coding :)
If want to know more then visit here
Edit: gradle path has been updated. compile it now
compile 'com.github.rtoshiro.fullscreenvideoview:fullscreenvideoview:1.1.2'