Complete Tutorial how to play Youtube videos in Android Studio 1.5 with VideoView. Create New Project with Application name: Play Youtube; Minimum SDK: API9 – Android 2.3 (Gingerbread). In app->res->layout->activity_main.xml add the VideoView with code:
    android:layout_centerHorizontal="true" />
In app->java->MainActivity complete the code (in onCreate):
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

public class MainActivity extends AppCompatActivity {

    protected void onCreate(Bundle savedInstanceState) {

        VideoView videoView =(VideoView)findViewById(;
        MediaController mediaController= new MediaController(this);
        Uri uri=Uri.parse("rtsp://");
In manifest->AndroidManifest.xml add the permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
Run your app in Emulator or better in Mobile device and see the Youtube video. Tutorial how to play Youtube videos in Android with VideoView How to get 3gp link of Youtube video: For example we have the link 1) open new tab in your browser and write: 2) now change VIDEO_ID from above with your video id code (Xprog0HC3aQ) and the result should be: and press enter. 3) right click on your video and Copy Link Location. 4) the result: rtsp://r7— This is what you use on Uri.parse. Watch the video tutorial how to play Youtube videos in Android with VideoView with Android Studio version 1.5: Download free slideshow app from here and install it on your device to see an youtube video. For further questions leave a message.


You can follow any responses to this entry through the RSS 2.0 feed.

Does not work in this method in Android Studio 1.4
Please tell me how it works in Android Studio 1.4?

    Tell me what error you have.

This method appears to work on a real device, but on an emulator (Android Studio 1.5.1) it gives a “Can’t play this video” error dialog. Would you happen to know why?

    Its may be due to the permissions that blocked by your anti virus

    me too, ???

    bro i”m using it on real device but same message shows up

On an emulator doesn’t work because of low computer resources.

the video is small n low quality how do i adjust that

how can i play a vimeo video using videoview since i have no idea of working with 3gp vimeo video.

is it legal??

Error:(13, 9) error: cannot find symbol class VideoView

Does not work
E/MediaPlayer: error (1, -2147483648)
E/MediaPlayer: Error (1,-2147483648)
E/ViewRootImpl: sendUserActionEvent() mView == null

When we get 3gp link of Youtube video and play it on android phone it looks very dull. How can i make it clear. I am using 3gp link of video in android studio to play it on android phone.
Please help me.

Thanks for the detailed explanation, but how does it work for live videos ? I get an error on step3 of getting the 3gp link. Error : Live event playback is not supported on this client.

Congratulations for your tutorial. I used the tips that you passed and ran but the video put on YouTube when running int the application, it was not very good. It failed a few times. You could please help me how to solve this issue? Do I need to change something in the code so that the video has a better resolution? Grateful.

In my case youtube link is not convert into .3gp link please help
i am converting this link
and convert this type link
i cannot copy link location and this link is not work in my case

Does it work as of now??

How to get Link adress programmatically if you have video id?

Tell me how to place a original youtubelink instead of 3gb link

how to make video full screen

I got Error

E/MediaPlayer: Error (1,-2147483648)
D/VideoView: Error: 1,-2147483648
Any Solution

Leave a Reply

Your email address will not be published. Required fields are marked *

Blue Captcha Image Refresh