gpt4 book ai didi

javascript - 就浏览器兼容性而言,iram 或

转载 作者:行者123 更新时间:2023-11-28 00:09:30 25 4
gpt4 key购买 nike

我都尝试过

  1. iframe - 没有解决方案来停止自动播放或控制非 YouTube 视频的视频
  2. 视频 - 不支持 YouTube 视频

使用 iframe

 <iframe id="vt" width="420" autoplay="false" height="345" src="http://cache4.asset-cache.net/xd/468140002.mp4?v=1&c=IWSAsset&k=2&d=72990B68305E4FDFEE95B69A879131BCD6D7111452E48A17C03F8342D660D5A451EBC1DEC2A827C9&b=RTdG" frameborder="0" allowfullscreen></iframe>

jQuery(document).ready(function () {

// var url = $('#vt').attr('src');
// $('#vt').attr('src', '');
// $('#vt').attr('src', url);
var vid = document.getElementById("vt");
vid.pause()
//vid.onpause = function() {
//alert("The video has been paused");
};
});

带有视频标签

<video width="320"  height="240" src="https://www.youtube.com/watch?v=dwH34mR6ZG8" controls="controls"> </video>

最佳答案

首先,iframe 从来就不是用来显示嵌入媒体的。这就是 object 标签旨在处理的事情。来自 MDN docs :

The HTML Inline Frame Element (<iframe>) represents a nested browsing context, effectively embedding another HTML page into the current page.

The HTML Embedded Object Element (<object>) represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin.

两者均早于 video元素,您应该始终使用该元素在网页中嵌入视频内容。

其次,YouTube 视频并不应该直接从 <video> 链接。元素...他们为您提供的嵌入代码是一个 iframe,无论如何都可以打开 HTML5 视频播放器(或者古董设备的 Flash 后备)。

结论:如果您尝试显示的视频不是或无法托管在 YouTube 上,请使用 video在网页上标记以嵌入它,确保将视频转换为尽可能多的支持格式。网上有很多关于 HTML5 视频的文章,因此我不会在这里详细介绍该过程。

关于javascript - 就浏览器兼容性而言,iram 或 <video> 哪个更好地播放视频(包括 YouTube 和非 YouTube)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31026911/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com