Last active
February 23, 2019 12:24
-
-
Save cvan/553c76a28007717349c480da6968d7f6 to your computer and use it in GitHub Desktop.
Revisions
-
cvan revised this gist
May 12, 2017 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,6 @@ function playVideoOnClick (selector) { if (el.muted) { delete el.muted; } if (el.paused) { el.play(); } -
cvan revised this gist
May 12, 2017 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,16 +8,16 @@ function playVideoOnClick (selector) { } function addListener () { if (el.paused) { window.addEventListener('click', handleFirstClick); } function handleFirstClick () { try { if (el.muted) { delete el.muted; } if (el.paused) { el.play(); } -
cvan created this gist
May 12, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ function playVideoOnClick (selector) { el = document.querySelector(selector); if (el) { addListener(); } else { window.addEventListener('load', addListener); } function addListener () { if (el.muted) { delete el.muted; } if (el.paused) { window.addEventListener('click', handleFirstClick); } function handleFirstClick () { try { if (el.paused) { el.play(); } } catch (e) { } removeHandleFirstClick(); } function removeHandleFirstClick () { window.removeEventListener('click', handleFirstClick); } } } playVideoOnClick('video');