0

我想使用 HTML5<video>标签和 fancybox 播放视频,链接指向 youtube 视频?

到目前为止,这是我的代码

<video width="480" height="270" controls="controls" poster="../images/youtube-logo.png">
  <source src="http://o-o---preferred---sn-5hn7snl7---v12---lscache8.c.youtube.com/videoplayback?upn=paJG2CcEhGw&amp;sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&amp;fexp=906356%2C910014%2C914093%2C922401%2C920704%2C912806%2C927201%2C922403%2C925003%2C913546%2C913556%2C916805%2C920201%2C901451&amp;ms=au&amp;expire=1352949266&amp;itag=46&amp;ipbits=8&amp;gcr=nl&amp;sver=3&amp;ratebypass=yes&amp;mt=1352923510&amp;ip=83.83.121.109&amp;mv=m&amp;source=youtube&amp;key=yt1&amp;cp=U0hUR1lPV19LUENONF9RSUFDOjBkVU41a1M4UEVp&amp;id=d72f1d6250563a1e&amp;signature=6C5130076CA770F67B4C797191BC0997EA040B74.10D3AEAA60E7AE1CF1D49DACF7178F3FCBBD56AE" type="video/mp4">
  <source src="http://o-o---preferred---sn-5hn7snl7---v12---lscache8.c.youtube.com/videoplayback?upn=paJG2CcEhGw&amp;sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&amp;fexp=906356%2C910014%2C914093%2C922401%2C920704%2C912806%2C927201%2C922403%2C925003%2C913546%2C913556%2C916805%2C920201%2C901451&amp;ms=au&amp;expire=1352949266&amp;itag=46&amp;ipbits=8&amp;gcr=nl&amp;sver=3&amp;ratebypass=yes&amp;mt=1352923510&amp;ip=83.83.121.109&amp;mv=m&amp;source=youtube&amp;key=yt1&amp;cp=U0hUR1lPV19LUENONF9RSUFDOjBkVU41a1M4UEVp&amp;id=d72f1d6250563a1e&amp;signature=6C5130076CA770F67B4C797191BC0997EA040B74.10D3AEAA60E7AE1CF1D49DACF7178F3FCBBD56AE" type="video/ogg">
  <source src="http://o-o---preferred---sn-5hn7snl7---v12---lscache8.c.youtube.com/videoplayback?upn=paJG2CcEhGw&amp;sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&amp;fexp=906356%2C910014%2C914093%2C922401%2C920704%2C912806%2C927201%2C922403%2C925003%2C913546%2C913556%2C916805%2C920201%2C901451&amp;ms=au&amp;expire=1352949266&amp;itag=46&amp;ipbits=8&amp;gcr=nl&amp;sver=3&amp;ratebypass=yes&amp;mt=1352923510&amp;ip=83.83.121.109&amp;mv=m&amp;source=youtube&amp;key=yt1&amp;cp=U0hUR1lPV19LUENONF9RSUFDOjBkVU41a1M4UEVp&amp;id=d72f1d6250563a1e&amp;signature=6C5130076CA770F67B4C797191BC0997EA040B74.10D3AEAA60E7AE1CF1D49DACF7178F3FCBBD56AE" type="video/webm">
Your browser does not support the video tag.
<iframe width="480" height="270" type="application/x-shockwave-flash"
src="http://www.youtube.com/embed/1y8dYlBWOh4?wmode=opaque">
</iframe>
</video>

如您所见,我还添加了一个iframe标签来支持旧版浏览器。

但是经过一些调整后,我无法在视频标签中的任何视频中打开所有内容?

提前致谢!

4

1 回答 1

0

直接的 YouTube 链接被“刷新”,虽然它们在第二天工作了片刻,但它们不再工作,因为链接被“损坏”。

在 html5 中播放 youtube 视频的最佳方式是这样的

<iframe width="480" height="270"
src="http://www.youtube.com/embed/1y8dYlBWOh4?html5=1">
</iframe>

html5=1告诉 Youtube 使用 html5 来播放视频,而不是 flash !

于 2013-01-02T10:57:16.637 回答