aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2014-06-12 18:20:15 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2014-06-12 18:20:15 +0200
commita7a32f941cb8c09c85865e5a287be82bc2e14adb (patch)
tree2b4ab99d1f70d11e3ed8423479d1811a51e9aca6 /js
parentaf61d9d10baee982fe82132acc4cd2dd604a6c61 (diff)
downloadfreenode-live-2017-presentation-a7a32f941cb8c09c85865e5a287be82bc2e14adb.tar
freenode-live-2017-presentation-a7a32f941cb8c09c85865e5a287be82bc2e14adb.tar.gz
vimeo support for autoplay/pause
Diffstat (limited to 'js')
-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"}', '*' );
+ }
+ });
}
}