Search code examples
androidandroid-intentyoutubeandroid-youtube-api

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?


Solution

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