only auto-play media when data-autoplay is set (#388)

edit
Hakim El Hattab 2013-04-27 18:36:29 -04:00
parent ed4a8b51c5
commit 06d0579610
2 changed files with 4 additions and 4 deletions

View File

@ -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":""}', '*');
} }
}); });

4
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long