only auto-play media when data-autoplay is set (#388)
This commit is contained in:
parent
ed4a8b51c5
commit
06d0579610
|
@ -1432,14 +1432,14 @@ var Reveal = (function(){
|
||||||
if( slide ) {
|
if( slide ) {
|
||||||
// HTML5 media elements
|
// HTML5 media elements
|
||||||
toArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) {
|
toArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) {
|
||||||
if( !el.hasAttribute( 'data-ignore' ) ) {
|
if( el.hasAttribute( 'data-autoplay' ) ) {
|
||||||
el.play();
|
el.play();
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// YouTube embeds
|
// YouTube embeds
|
||||||
toArray( slide.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) {
|
toArray( slide.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) {
|
||||||
if( !el.hasAttribute( 'data-ignore' ) ) {
|
if( el.hasAttribute( 'data-autoplay' ) ) {
|
||||||
el.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
|
el.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue