Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding a youtube video into android app using eclipse?

I'm trying to figure out how to embed youtube videos into android using eclipse. I would prefer to use the chromeless player, but at this point it's not necessary.

Any help on how to do this would be greatly appreciated.

like image 220
Derek S Avatar asked Apr 27 '11 02:04

Derek S


People also ask

Can you embed YouTube videos in Android app?

A great alternative free to use, open-source API that allows you to embed YouTube videos to be played within an Android app is android-youtube-player created by Pierfrancesco Soffritti. android-youtube-player uses a WebView with an IFrame to display and expose the controls to the YouTube player.


1 Answers

The easiest way to embed a Youtube video is to use an intent to fire the Youtube application, like this:

String video_path = "http://www.youtube.com/watch?v=opZ69P-0Jbc";
Uri uri = Uri.parse(video_path);

// With this line the Youtube application, if installed, will launch immediately.
// Without it you will be prompted with a list of the application to choose.
uri = Uri.parse("vnd.youtube:"  + uri.getQueryParameter("v"));

Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
like image 108
Trasplazio Garzuglio Avatar answered Sep 28 '22 05:09

Trasplazio Garzuglio