Cas
Cas

Reputation: 356

How to display Youtube videos in android?

I know that I can just start an intent with the URL, but I want a thumbnail that starts the video.
Just like here:
Thumbnails

How can I do this?

Upvotes: 1

Views: 270

Answers (1)

ArtKorchagin
ArtKorchagin

Reputation: 4863

You need to use YouTube Android Player API. See instructions there: https://developers.google.com/youtube/android/player/

If you want open youtube channel by Intent you can use folowing snippet:

public static void watchYoutubeVideo(Context context, String channelId) {
    Intent intent = new Intent(Intent.ACTION_VIEW,
            Uri.parse("http://www.youtube.com/channel/" + channelId));
    context.startActivity(intent);
}

Upvotes: 2

Related Questions