Browse Source

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

embed
Hakim El Hattab 12 years ago
parent
commit
06d0579610
  1. 4
      js/reveal.js
  2. 4
      js/reveal.min.js

4
js/reveal.js

@ -1432,14 +1432,14 @@ var Reveal = (function(){
if( slide ) {
// HTML5 media elements
toArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) {
if( !el.hasAttribute( 'data-ignore' ) ) {
if( el.hasAttribute( 'data-autoplay' ) ) {
el.play();
}
} );
// YouTube embeds
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":""}', '*');
}
});

4
js/reveal.min.js

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save