用嵌入的视频替换图像
您好,我正在尝试修改网页以使其加载速度更快。 由于我嵌入了一些视频(blip.tv,但如果有帮助的话可以将其更改为 youtube),我想知道您是否可以在视频所在的位置加载图像,然后单击将图像替换为视频并开始播放(无需重新加载整页)。 我想我以前见过这个,但现在找不到了! 现在我使用的嵌入代码是:
<object data="http://blip.tv/play/gYMo_vAmAA" type="application/x-shockwave-flash" height="500" width="600"><param name="src" value="http://blip.tv/play/gYMo_vAmAA"><param name="allowfullscreen" value="true"></object>
谢谢
Hi I'm trying to modify a web page so that it loads faster.
Since I have some videos embeded (blip.tv but can change it to youtube if it helps) I was wondering if you could load an image where the video should be and on click replace the image with the video and start playing (without reloading the whole page).
I think I've seen this before, but can't find it anywhere anymore!
right now the code to embed I use is:
<object data="http://blip.tv/play/gYMo_vAmAA" type="application/x-shockwave-flash" height="500" width="600"><param name="src" value="http://blip.tv/play/gYMo_vAmAA"><param name="allowfullscreen" value="true"></object>
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
快速而肮脏:您可以将嵌入代码设置为全局变量:
然后将图像放入容器 div 中并替换容器的 insideHTML onclick:
Quick and dirty: you could just set the embed code as a global variable somewhere:
Then put the image in a container div and replace the container's innerHTML onclick:
有一个名为 SWFObject 的 Google 代码项目,它非常适合您的需求。 它是一个用于加载 Flash 的跨浏览器 JavaScript 库 - 例如,当有人单击图像时,您可以使用它用 Flash 视频替换您的图像。
There's a Google code project called SWFObject, which is perfect for what you need. It's a cross-browser javascript library for loading flash - and you could use it to replace your image with the flash video when someone clicks on the image, for example.