views:

305

answers:

2

While playing around with the emulator, I noticed that when trying to view a YouTube video the browser gives an error saying it can not load the page at vnd.youtube:ngc978y6rCU?some=parameters. I don't have an Android device, but by this I can suppose that launching a VIEW intent with the data URI set to vnd.youtube:VIDEO_ID would launch the default YouTube application and watch that video.

Now, my application has to be able to display YouTube videos. Right now I have a custom-made YouTube activity which does just that, but I'm thinking of:

  • Removing my custom activity and just launching a VIEW intent with a vnd.youtube:VIDEO_ID Uri, or
  • Testing whether that Intent is available and using it, or, if it's not available, using my custom activity.

Is this a good idea? Does this work at all (as I said I have no Android device, I'll just be borrowing one from a friend to test my final application)? Which way should I go?

A: 

It's up to you. You could use the Youtube Intent but since those details have never been released it could be changed and break your code.

BrennaSoft
That is more or less obvious. But, if I go for option 2, it shouldn't break my code, right?
Felix
A: 

Test if an VIEW intent with data set to http://www.youtube.com/watch?v=xxx will work. It is possible for Android applications to hook like this. This would provide a better experience if the phone is somehow missing the Youtube app (and you don't want to rely in your custom player).

alexanderblom
That would launch the Browser first and then the YouTube app, if there is a YouTube app. Going back from the YouTube app to my app would be a pain for the user.
Felix
No. But try it to be sure that it works.
alexanderblom