Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Play YouTube videos through your app

hello everyone!

I'm am developing a phone app for my church and one of the features I want it to have is the ability for user's to watch past seminars. They are already posted on there YouTube channel.

What do i need to do to have the two communicate, so that when user clicks on "watch video" it will access and load it from YouTube?

1 Answer

Ben Deitch
STAFF
Ben Deitch
Treehouse Teacher

Does it have to be embedded into the app? A YouTube link should suffice to open it in the YouTube app (or at least open the chooser dialog).

If you'd rather it be embedded, it looks like you'll need to get familiar with the YouTube Android Player API. I've never used it before, but it doesn't look too complicated. If I we're trying to get this working I'd probably start with this tutorial, and then depending on how well that works I'd check out the API documentation and go from there.

ok, awesome. Thanks for the responds. I guess that would work out for just a button that says "watch message" and then it would send them to the youtube using its own app. How would I do that?

Ben Deitch
Ben Deitch
Treehouse Teacher

Just having a YouTube link should suffice. It should show the "Complete action using" dialog and the user should be able to pick how to open it.