typon
typon

Reputation: 103

Embedding youtube videos in your android app

I want to embed youtube videos in my android app and want to use the youtube api. Is there any way I can do this ?

Upvotes: 0

Views: 2499

Answers (1)

Aurora
Aurora

Reputation: 4414

To use the video player, you need to call an intent. If you are launching the intent from an existing activity, you would call it like this:

this.startActivity(new Intent(Intent.ACTION_VIEW, "www.youtubelink/whatever"));

where www.youtubelink/whatever is the link to the youtube video you want to play.

EDIT: Actually I should be more precise - that intent just uses the video player, it doesn't directly launch the YouTube app. If the user has the YouTube app installed it will ask them it they want to view the video in the YouTube app. But if your main goal is to play the video, then that will work for you.

Upvotes: 2

Related Questions