0

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.

ncr07
  • 57
  • 1
  • 7
  • try those options : http://stackoverflow.com/questions/574195/android-youtube-app-play-video-intent – Itzik Samara Aug 06 '14 at 15:53
  • look at this may help you http://stackoverflow.com/questions/25130801/android-vimeo-video-not-playing-inside-webview/25130834?noredirect=1#comment39116183_25130834 – KOTIOS Aug 06 '14 at 16:55

0 Answers0