We can play youtube videos inside our android application using VideoView.
- Play youtube videos in VideoView Android. Ask Question Asked 5 years, 1 month ago. Active 5 years, 1 month ago. Viewed 2k times -1. I searched a lot to get stream urls for Youtube videos, but none of them works. Has Youtube removed the support for streaming videos in android videoview?
- We can play youtube videos inside our android application using VideoView. VideoView displays a video file. The VideoView class can load images from various sources, takes care of computing its measurement from the video so that it can be used in any layout manager, and provides various display options such as scaling and tinting.
VideoView displays a video file. The VideoView class can load images from various sources , takes care of computing its measurement from the video so that it can be used in any layout manager, and provides various display options such as scaling and tinting.
Android Videoview Fullscreen
Using Video View:
Android Viewview is by default available in Android framework. We can use this to fetch video and play it on Android without any additional libraries in our application. Additionally we can also stream video from youtube or using video url on video player to it on Android.
1.Code in the layout xml:
2.Code in java class:
We set the VideoUri by specifying the 3gp link of Youtube video for mobile platforms. To add media controls such as Play, Pause, Rewind, Fast Forward and a progress slider ,we add MediaController to the VideoView.
![Listview videoview Listview videoview](/uploads/1/1/9/8/119876100/279990060.jpg)
How to get 3gp link of a Youtube video
- Right click the video to copy Video URL.
- Open “m.youtube.com” to get the mobile version videos.
- Right click on the video to Copy Link Address.
- The 3gp link of the video looks like this :
Android Videoview Center
The 3gp link of the video looks like this :
rtsp://v4.cache3.c.youtube.com/CjYLENy73wIaLQlW_ji2apr6AxMYDSANFEIJbXYtZ29v
Z2xlSARSBXdhdGNoYOr_86Xm06e5UAw=/0/0/0/video.3gp
Playing youtube videos in android application was that simple !
Download the complete Demo project here for your reference . videoTEST