在下面的代码中,设置了 autoplay="false"preload="none"但视频仍然自动播放。
问题出在哪里?
我缺少什么?
new_video = document.createElement('video');
new_video.setAttribute('controls','true');
//new_video.setAttribute('autoBuffering','true');
new_video.setAttribute('preload','none');//autoPlay: false, 'preload':'auto'
new_video.setAttribute('autoPlay','false');
//new_video.setAttribute('type','video/mp4;codecs="vp8, vorbis"');
video = document.getElementById('RIZfC358yRk').appendChild(new_video);
source = document.createElement('source');
source.setAttribute('src','https://dl.dropboxusercontent.com/u/87532981/Ella%20May%20and%20the%20Wishing%20Stone%20By%20Cary%20Fagan.mp4');
video.appendChild(source);
video.load();
video.play();
最佳答案
尝试使用“autostart”属性而不是“autoPlay”:
new_video.setAttribute('autostart','false');
并删除最后一行,
video.play();
关于javascript - 即使在自动播放 ="false"预加载 ="none"之后,视频也无需单击播放按钮即可开始,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18921025/