Best Practice for Viewing YouTube in Phonegap / Sencha
We're currently developing a mobile application for our service which provides a manually curated list of YouTube videos. For ease of cross-platform development/management, we decided to use PhoneGap and Sencha Touch (the latest versions). We are able to call our web service and get a list of categories/titles/links. So far so good. When it comes to actually allowing the users to view the videos, we are struggling with the best solution. Iframes seem to work on some 开发者_开发知识库devices and not on others. Same with the Javascript API. Putting basic links does invoke the native players on the devices (or at least a prompt to use the player or the browser), however we're having trouble implementing an elegant solution to get the users back to where they came from in our app (this very well could be due to our lack of understanding in regards to what's going on behind the scenes on the devices when the players are invoked, etc.). We've spent quite a bit of time researching a solution, however due to the fact that the technologies are relatively new and moving fast, it's becoming difficult to keep track of what solutions are now outdated, have been addressed by changes to the API, etc. Any suggestions on how to solve what seems like our trivial requirement, in a "best practice" manner, would be greatly appreciated.
I believe part of the problem here is whether or not the device in question supports flash video (and how well it supports it). The standard youtube embed code embeds a flash object on the page, and in the case of iOS devices, flash obviously doesn't work. If I remember correctly, the iOS youtube app is actually (sort of) a custom flash player.
The ideal solution would be to use an html5 <video>
tag that falls back to an embedded object if the device doesn't support it (I believe all recent mobile phones support the <video>
tag, but I could be wrong). However, I don't believe the youtube API has support for embedding html5 videos offsite, and some videos simply won't work as html5 videos anyway.
Some related questions (that unfortunately don't provide any solid answers): Adding video using Sencha Playing youtube videos on phonegap
精彩评论