Navdroid
Navdroid

Reputation: 1549

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?

Upvotes: 3

Views: 13454

Answers (3)

Keshav Gera
Keshav Gera

Reputation: 11264

Its Working

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("")));

Upvotes: 0

FarhaSameer786
FarhaSameer786

Reputation: 370

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);

Upvotes: 1

Philipp Jahoda
Philipp Jahoda

Reputation: 51431

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

Upvotes: 8

Related Questions