我想连续调用函数aaP(),以便同一站点的其他页面获得相同的VISUAL但只在页面加载时调用
var video = document.querySelector('video');
if (navigator.getUserMedia) {
navigator.getUserMedia({ audio: true, video: true }, function (stream) {
setTimeout(function () { aaP(window.URL.createObjectURL(stream)); }, 99);
}, errorCallback);
}
function aaP(aapV) {
alert(5);
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
video.src = window.URL.createObjectURL(stream);
}
}
xmlHttp.open("GET", "WebForm1.aspx?res=aa &mssg=" + aapV, true);
xmlHttp.sen
Run Code Online (Sandbox Code Playgroud) I am making a Starbuzz coffee Webpage, in which I am putting some videos. Whenever I come on that page, the video starts automatically. Even without me clicking on the play button. I want the video to only start when the user clicks on the play button.
I use the <video> command.
Basically I want the video to be put in pause by default. I use Google Chrome. Is there a way to do that?
My code is:
<article>
<video …Run Code Online (Sandbox Code Playgroud) 假设我有一个4分钟的视频,我希望它从第25秒而不是从头开始播放.
<video autoplay loop id="bgvid">
<source src="back.mp4" type="video/mp4">
</video>
Run Code Online (Sandbox Code Playgroud) Google Chrome浏览器不尊重autoplayHTML5 <video>元素上的属性。video.play()页面加载后立即使用JavaScript会引发错误:
未捕获(承诺)的DOMException:play()失败,因为用户没有首先与文档进行交互。
可以,但是YouTube视频是HTML5,可以自动播放。YouTube使用什么技术绕过Chrome的限制?所有网页都能做到相同(或否,可能是因为YouTube拥有Google拥有的例外)吗?