diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2018-03-05 14:59:32 +0100 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2018-03-05 14:59:32 +0100 |
commit | 0282413b69223d4487a05b9123b8da3295beebd1 (patch) | |
tree | 4f035b4543de7b04d1162fd76eff41fdff2149b5 /js | |
parent | 5848a432d9c59dfc5ba51d64181183768d8fb24f (diff) | |
download | perl-software-in-gnu-guix-0282413b69223d4487a05b9123b8da3295beebd1.tar perl-software-in-gnu-guix-0282413b69223d4487a05b9123b8da3295beebd1.tar.gz |
fix autoplay of inline videos in ios
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/js/reveal.js b/js/reveal.js index d4778cb..b8026c1 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -3498,9 +3498,16 @@ if( autoplay && typeof el.play === 'function' ) { + // If the media is ready, start playback if( el.readyState > 1 ) { startEmbeddedMedia( { target: el } ); } + // Mobile devices never fire a loaded event so instead + // of waiting, we initiate playback + else if( isMobileDevice ) { + el.play(); + } + // If the media isn't loaded, wait before playing else { el.removeEventListener( 'loadeddata', startEmbeddedMedia ); // remove first to avoid dupes el.addEventListener( 'loadeddata', startEmbeddedMedia ); |