merge autoplay conflict #1771

This commit is contained in:
Hakim El Hattab 2017-02-14 14:51:14 +01:00
commit 313a23ba2b
1 changed files with 6 additions and 1 deletions

View File

@ -3228,10 +3228,14 @@
} }
// Autoplay is always on for slide backgrounds // Autoplay is always on for slide backgrounds
var autoplay = el.hasAttribute( 'data-autoplay' ) || !!closestParent( el, '.slide-background' ); var autoplay = el.hasAttribute( 'data-autoplay' ) ||
el.hasAttribute( 'data-paused-by-reveal' ) ||
!!closestParent( el, '.slide-background' );
if( autoplay && typeof el.play === 'function' ) { if( autoplay && typeof el.play === 'function' ) {
el.removeAttribute( 'data-paused-by-reveal' );
if( el.readyState > 1 ) { if( el.readyState > 1 ) {
startEmbeddedMedia( { target: el } ); startEmbeddedMedia( { target: el } );
} }
@ -3344,6 +3348,7 @@
// HTML5 media elements // HTML5 media elements
toArray( element.querySelectorAll( 'video, audio' ) ).forEach( function( el ) { toArray( element.querySelectorAll( 'video, audio' ) ).forEach( function( el ) {
if( !el.hasAttribute( 'data-ignore' ) && typeof el.pause === 'function' ) { if( !el.hasAttribute( 'data-ignore' ) && typeof el.pause === 'function' ) {
el.setAttribute('data-paused-by-reveal', '');
el.pause(); el.pause();
} }
} ); } );