Javascript 如何使用动态dom阵列从多个视频中自动播放视频?
如何使用动态dom阵列从多个视频中自动播放视频 目前,我仍然在手动使用html视频元素,而不是javascript数组Javascript 如何使用动态dom阵列从多个视频中自动播放视频?,javascript,css,arrays,css-selectors,html5-video,Javascript,Css,Arrays,Css Selectors,Html5 Video,如何使用动态dom阵列从多个视频中自动播放视频 目前,我仍然在手动使用html视频元素,而不是javascript数组 var video1=document.getElementById('video1'); var video2=document.getElementById('video2'); var video3=document.getElementById('video3'); var imagen1=document.getElementById('imagen1'); 函数i
var video1=document.getElementById('video1');
var video2=document.getElementById('video2');
var video3=document.getElementById('video3');
var imagen1=document.getElementById('imagen1');
函数imgTransition(){
imagen1.style.opacity=0;
视频1.播放();
video1.style.opacity=1;
}
video1.onended=函数(){
视频2.播放();
video1.style.opacity=0;
video2.style.opacity=1;
}
video2.oneded=函数(){
视频3.播放();
video2.style.opacity=0;
video3.style.opacity=1;
}
video3.oneded=函数(){
video3.style.opacity=0;
imagen1.style.opacity=1;
设置超时(imgTransition,5000);
}
*{padding:0;margin:0}video{width:100%;height:100%;position:absolution;object fit:cover;transition:all 1.2s linear;z-index:-10}.video1{opacity:1}.video2{opacity:0}.video3{opacacity:0}.images
不清楚您想做什么。。。您想在屏幕上显示一个视频并从动态数组中更改源,还是…?@offbeatmal,是的,我想在屏幕上显示一个视频并使用transition cssI从动态数组中更改源刚才尝试的var source=http://thenewcode.com/assets/videos/ocean-small,https://hunzaboy.github.io/Ckin-Video-Player/ckin,https://www.cssscript.com/demo/vanilla-js-custom-html5-video-player-pureplayer/360';var arr=source.split(',');var total=平均长度;对于(var i=0;i如何动态函数:video.oneded=function(){..}
?