Tropical Software Observations

17 January 2012

Posted by Unknown

at 9:20 AM


The Many Ways to Play Youtube Video for Android

Embedding YouTube videos in a mobile application -- iOS or Android -- is not always straightforward.

We have the GData API for Youtube which is good for getting data on Video or Playlist but not to embed video the way you want. YouTube really wants you to just open the native YouTube app and play it there.

The simplest way is by starting with the intent to load the YouTube video in the native app. It's as easy as the example below -- notice the "" protocol type.

    Intent intent = new Intent(Intent.ACTION_VIEW, 
                             + "SomeYTIdHere" ));

Now, if for whatever reason the Android device doesn't come with the native YouTube app, you can just open the YouTube mobile page, like this:


But if opening the mobile page is not good enough, then another tricky way is to embed the YouTube video "..." stuff in a webview. That usually will work by playing the video with Flash and is tested to work on Android tablets.

If you have a Kindle Fire and you do not want to play the video in the YouTube mobile page, then you can use OpenYouTubeActivity from the android-youtube-player project.

I hope these approaches help you in figuring out the best way to play YouTube content in your Android apps.


Unknown said...

Thanks for this useful post.
Wow what an awesome website ,so useful !There is another way to play videos using video view .Here a demo project for refrence

Anonymous said...

i tried this url

but invalid request, touch to retry displays on the screen.

Anna Schafer said...

This is exactly the information I'm looking for, I couldn't have asked for a simpler read with great tips like this... Thanks!
Android App Development

James Feder said...

I really appreciate your post and you explain each and every point very well. Thanks for sharing this information. keep it continued so that we can get benefits. Learn More

Richard C. Lambert said...

Thankyou for this wondrous post, I am happy I watched this site on yippee. convert psd to wordpress theme

Sophie Grace said...

I love visiting sites in my free time. I have visited many sites but did not find any site more efficient than yours. Thanks for the nudge! If you want to find idol's account on instagram, please coming site picbear