aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/reveal.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/js/reveal.js b/js/reveal.js
index f98d511..df8c0f6 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -2545,7 +2545,7 @@
}
/**
- * Enforces origin-specific format rules for embedded content.
+ * Enforces origin-specific format rules for embedded media.
*/
function formatEmbeddedContent() {
@@ -2557,6 +2557,14 @@
}
});
+ // Vimeo frames must include "?api=1"
+ toArray( dom.slides.querySelectorAll( 'iframe[src*="player.vimeo.com/"]' ) ).forEach( function( el ) {
+ var src = el.getAttribute( 'src' );
+ if( !/api\=1/gi.test( src ) ) {
+ el.setAttribute( 'src', src + ( !/\?/.test( src ) ? '?' : '' ) + 'api=1' );
+ }
+ });
+
}
/**
@@ -2584,6 +2592,14 @@
el.contentWindow.postMessage( '{"event":"command","func":"playVideo","args":""}', '*' );
}
});
+
+ // Vimeo embeds
+ toArray( slide.querySelectorAll( 'iframe[src*="player.vimeo.com/"]' ) ).forEach( function( el ) {
+ if( el.hasAttribute( 'data-autoplay' ) ) {
+ console.log(11);
+ el.contentWindow.postMessage( '{"method":"play"}', '*' );
+ }
+ });
}
}
@@ -2613,6 +2629,13 @@
el.contentWindow.postMessage( '{"event":"command","func":"pauseVideo","args":""}', '*' );
}
});
+
+ // Vimeo embeds
+ toArray( slide.querySelectorAll( 'iframe[src*="player.vimeo.com/"]' ) ).forEach( function( el ) {
+ if( !el.hasAttribute( 'data-ignore' ) && typeof el.contentWindow.postMessage === 'function' ) {
+ el.contentWindow.postMessage( '{"method":"pause"}', '*' );
+ }
+ });
}
}