I am coding a web application (a mobile website) which will be accessed by various smartphones, like Androids, iPhones and BlackBerry.
One of my page is going to have a link to a youtube video. I am not sure how to put a link to it in such a way that the device browser opens the device's youtube application and plays the video.
Can you guys provide any help specific to And开发者_如何学JAVAroid, iPhone and BlackBerry!?
Thanks in advance! :)
I researched a lot and found that there's such a solution for Android phones.
If I write the youtube URL as vnd.youtube:<video_id>
inside my html, then Android will parse this link's click as YouTube related action and will invoke youtube application. the best part is, after the video ends or the user cancels the playback, the control returns to the webpage, which is awesome.
I was trying to find something similar for iPhone too, but later realised that iPhone doesn't have multi-tasking ability, and if I could even find something similar, iPhone will always first close the webpage, and will then open the youtube app to play the video. This way, the youtube application takes over and control is never returned to my webpage, which is according to me a bad UX, but iPhone users see it as a normal thing.
I can't embed a video inside my webpage since there are no requirements like this, else I would have done what @Zaky has suggested, still, I am looking into the links provided by him to find something useful.
I still have to see how BlackBerry devices and the new iOS4 responds to youtube events and links.
Will post updates.
UPDATE : To do the same for iPhone (iOS), use the URL: youtube:<video_id>
and it will parse it as the youtube application URL
Specifically to iPhone i used this one recently, check the second one about the UIWebView, should work similarly from the browser: http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-apps.html
And this one seems to be more general: http://www.labnol.org/internet/embed-youtube-videos-in-html5-flash/14092/
精彩评论