views:

11436

answers:

4

I have created a app where you can download YouTube videos for android. Now, I want it so that if you play a video in the YouTube native app you can download it too. To do this, I need to know the Intent that the YouTube native app puts out in order to play the YouTube app.
I could do this easially if I had the YouTube program on my emulator, so my 1st question is:
1. Can I download the YouTube app for my emulator, or...
2. What is the intent used when the user selects a video for playback.

+1  A: 

The Youtube (and Market application) are only supposed to be used with special ROMs, which Google released for the G1 and the G2. So you can't run them in an OpenSource-ROM, like the one used in the Emulator, unfortunately. Well, maybe you can, but not in an officially supported way.

Lemmy
Do you know the unsupported way?
Isaac Waller
Sorry, no. Just didn't want to rule out the possibility.
Lemmy
+2  A: 

Found it:

03-18 12:40:02.842: INFO/ActivityManager(68): Starting activity: Intent { action=android.intent.action.VIEW data=(URL TO A FLV FILE OF THE VIDEO) type=video/* comp={com.google.android.youtube/com.google.android.youtube.YouTubePlayer} (has extras) }
Isaac Waller
+8  A: 

This will work on a device but not the emulator per Lemmy's comment above.

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=cxLG2wtE7TM")));

Mike
This was the winner for me, if you have the youtube app installed it asks if you want to use that instead.
TreeUK
use this code i get the intent chooser for youtube and browser. how to hide it? i just need to directly link up to youtube player.
Praveen Chandrasekaran
@Praveen Chandrasekaran the youtube app may not be available - it's best to use the Intent, and let the system work out which installed apps support the request.
cofiem
A: 

dude, you can run the youtube app. I have it running on my freerunner. just gotta know where to look.

michael