Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to play YouTube video via Intent?

In my app I want to click on a particular button and jump to the youtube app and show a youtube user .Eg http://www.youtube.com/user/punjabiradiousa . How is this possible please suggest some technique?

like image 581
Navdroid Avatar asked Dec 05 '25 11:12

Navdroid


2 Answers

Do it like this:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/user/punjabiradiousa")));

Taken from here: Android YouTube app Play Video Intent

like image 121
Philipp Jahoda Avatar answered Dec 06 '25 23:12

Philipp Jahoda


This code i have used to play youtube video

Matcher matcher = Pattern.compile("http://www.youtube.com/embed/").matcher(mVideoId);
matcher.find()
Intent lVideoIntent = new Intent(
                                null,
                                Uri.parse("ytv://" + mVideoId),
                                MainScreen.mContext,
                                com.kids.youtube.OpenYouTubePlayerActivity.class);
                                startActivity(lVideoIntent);
like image 34
FarhaSameer786 Avatar answered Dec 07 '25 01:12

FarhaSameer786



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!