0

I am trying to load a video in VideoView in my app but when I open it, it says that it can't play this video. This is my code:

video=findViewById(R.id.mainVideoView);                     

    Uri uri = Uri.parse("https://www.google.com/url?sa=t&source=web&rct=j&url=https://m.youtube.com/watch%3Fv%3DlLVrP_nzvB8&ved=2ahUKEwjjxtCQ_abgAhVUuXEKHTdUAggQwqsBMAR6BAgHEAU&usg=AOvVaw29VZ4OKcAgFXwyBjLjgTcN");
    video.setVideoURI(uri);
    MediaController mc = new MediaController(MainActivity.this);
    video.setMediaController(mc);
    video.requestFocus();
    video.start();
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
user11019720
  • 43
  • 1
  • 4
  • if you want to show YouTube video means, first integrate YouTube on your app, then pass URL like (" lLVrP_nzvB8 " this is your above given YouTube link ) . – Poovarasan Selvaraj Feb 06 '19 at 11:46

1 Answers1

0

you can't play youtube videos by using videoView as you mention in your question. kindly use this library, that allows you to play youtube videos in your android app. youtube_android_player_api