简体   繁体   English

如何在 IOS 中播放和链接 html5 视频?

[英]How to play and chain html5 videos in IOS?

I try to chain 2 videos : when the first has ended, the second start to play automatically.我尝试链接 2 个视频:当第一个视频结束时,第二个视频开始自动播放。

It works in Chrome or Firefox in W10 and Ubuntu but I can't find the way to make it works in IOS : Safari or Chrome or Firefox.它适用于 W10 和 Ubuntu 中的 Chrome 或 Firefox,但我找不到让它在 IOS 中运行的方法:Safari 或 Chrome 或 Firefox。 It's like "Video_2.play();"就像“Video_2.play();” doesn't fire inside "Video_1.addEventListener(...)" in IOS.不会在 IOS 中的“Video_1.addEventListener(...)”内触发。

What did I miss ?我错过了什么 ?

 var Video_1 = document.getElementById("ID_Video_1"); var Video_2 = document.getElementById("ID_Video_2"); Video_1.addEventListener('loadedmetadata',function() { alert("Can start playing video Video_1"); Video_1.play(); }); Video_2.addEventListener('loadedmetadata',function() { alert("Can start playing video Video_2"); }); Video_1.addEventListener('ended', function(e) { alert("Video_1 ENDED"); Video_2.style.visibility = "visible"; Video_1.style.visibility = "hidden"; Video_2.play(); alert("Video_2.play();"); });
 #DIV_video { position: relative; display: flex; align-items: center; justify-content: center; width: 430px; height: 270px; } .CLASS_Video { position: absolute; top: 0; left: 0; } #ID_Video_1 { visibility: visible; z-index: 1; } #ID_Video_2 { visibility: hidden; z-index: 2; }
 <div id="DIV_video"> <video id="ID_Video_2" playsinline class="CLASS_Video" width="150" src="http://www.w3schools.com/html/mov_bbb.mp4"></video> <video id="ID_Video_1" playsinline class="CLASS_Video" width="150" src="http://www.w3schools.com/html/movie.mp4"></video> </div>

I think I found the answer :我想我找到了答案:

https://webkit.org/blog/6784/new-video-policies-for-ios/ https://webkit.org/blog/6784/new-video-policies-for-ios/

And now I think there is no solution for me in IOS even if it's Chrome or Firefox...现在我认为即使是 Chrome 或 Firefox,在 IOS 中也没有适合我的解决方案......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM