JQuery Mobile Open Video link inside page

江枫思渺然 提交于 2019-12-03 22:48:46

I'd suggest using the IFRAME embed method from YouTube:

It can be as easy as setting up an <iframe> like this:

<iframe id="player" type="text/html" width="640" height="390"
  src="http://www.youtube.com/embed/u1zgFlCw8Aw?enablejsapi=1&origin=http://example.com"
  frameborder="0"></iframe>

But you can utilize the YouTube API as well, see these docs for more info: https://developers.google.com/youtube/iframe_api_reference

The IFrame player API lets you embed a YouTube video player on your website and control the player using JavaScript. Unlike the Flash and JavaScript player APIs, which both involve embedding a Flash object on your web page, the IFrame API posts content to an tag on your page. This approach provides more flexibility than the previously available APIs since it allows YouTube to serve an HTML5 player rather than a Flash player for mobile devices that do not support Flash.

Src: The above link

You can have an embedded video player in an HTML page using the new <video> HTML5 tag.

@Jasper is correct that using the iframe embed is the best way to play a video from a mobile site. What was not discussed is what else is involved. Here's a great demo of the new popup functionality in jquery mobile 1.2.0 (as of Oct. 2012):

http://jquerymobile.com/demos/1.2.0/docs/pages/popup/popup-iframes.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!