Created
October 13, 2019 19:19
-
-
Save guibranco/4aa847a25a21e84c9cb296b6be48a885 to your computer and use it in GitHub Desktop.
Sincronizar vídeos (play um, pause outros)
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
<video width="426" height="240" id="v1"> | |
<source src="video1.mp4" type="video/mp4"> | |
<source src="video1.webm" type="video/webm"> | |
</video> | |
<video width="426" height="240" id="v2"> | |
<source src="video2.mp4" type="video/mp4"> | |
<source src="video2.webm" type="video/webm"> | |
</video> | |
<video width="426" height="240" id="v3"> | |
<source src="video3.mp4" type="video/mp4"> | |
<source src="video3.webm" type="video/webm"> | |
</video> | |
<script> | |
var v1 = document.getElementById("v1"); | |
var v2 = document.getElementById("v2"); | |
var v3 = document.getElementById("v3"); | |
v1.onplay = function () { v2.pause(); v3.pause(); }; | |
v2.onplay = function () { v1.pause(); v3.pause(); }; | |
v3.onplay = function () { v1.pause(); v2.pause(); }; | |
<script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment