Created
June 3, 2021 12:53
-
-
Save kvasdopil/742cf4dbf000bff255f018cd5b88fcaa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<video id="a" src="red.mp4" style="width:300px" autoplay></video> | |
<video id="b" src="gron.mp4" style="width:300px"></video> | |
</div> | |
<button id="btn">play</button> | |
<script> | |
const v1 = document.querySelector('#a'); | |
const v2 = document.querySelector('#b'); | |
document.querySelector('#btn').onclick = () => v1.play(); | |
v1.onended = () => { | |
v2.play(); | |
v1.currentTime = 0; | |
} | |
v2.onended = () => { | |
v1.play(); | |
v2.currentTime = 0; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment