I wonder to know how can I play youtube video which url I obtained from YoutubeAPI data v3:
https://www.youtube.com/watch?v=dpVUIwrNLoo&feature=youtube_gdata_player
I have the following code that perform this:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video);
VideoView videoView =(VideoView)findViewById(R.id.videoView);
MediaController mediaController= new MediaController(this);
mediaController.setAnchorView(videoView);
String uri = getIntent().getStringExtra("url");
//Uri url = Uri.parse(uri);
videoView.setMediaController(mediaController);
videoView.setVideoPath(uri);
videoView.requestFocus();
videoView.start();
}
and the layout xml is like that:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView android:id="@+id/videoView"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
</LinearLayout>
Please I wonder for any help as soon as possible.