aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md20
-rw-r--r--css/print/pdf.css7
-rw-r--r--js/reveal.js55
-rwxr-xr-xplugin/math/math.js2
-rw-r--r--test/examples/math.html2
5 files changed, 64 insertions, 22 deletions
diff --git a/README.md b/README.md
index 789a8fa..2991ed1 100644
--- a/README.md
+++ b/README.md
@@ -228,6 +228,12 @@ Reveal.initialize({
// Flags if speaker notes should be visible to all viewers
showNotes: false,
+ // Global override for autolaying embedded media (video/audio/iframe)
+ // - null: Media will only autoplay if data-autoplay is present
+ // - true: All media will autoplay, regardless of individual setting
+ // - false: No media will autoplay, regardless of individual setting
+ autoPlayMedia: null,
+
// Number of milliseconds between automatically proceeding to the
// next slide, disabled when set to 0, this value can be overwritten
// by using a data-autoslide attribute on your slides
@@ -789,20 +795,26 @@ Reveal.addEventListener( 'overviewhidden', function( event ) { /* ... */ } );
Reveal.toggleOverview();
```
+
### Fullscreen mode
Just press »F« on your keyboard to show your presentation in fullscreen mode. Press the »ESC« key to exit fullscreen mode.
### Embedded media
-Embedded HTML5 `<video>`/`<audio>` and YouTube iframes are automatically paused when you navigate away from a slide. This can be disabled by decorating your element with a `data-ignore` attribute.
-
Add `data-autoplay` to your media element if you want it to automatically start playing when the slide is shown:
```html
<video data-autoplay src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"></video>
```
-Additionally the framework automatically pushes two [post messages](https://developer.mozilla.org/en-US/docs/Web/API/Window.postMessage) to all iframes, ```slide:start``` when the slide containing the iframe is made visible and ```slide:stop``` when it is hidden.
+If you want to enable or disable autoplay globally, for all embedded media, you can use the `autoPlayMedia` configuration option. If you set this to `true` ALL media will autoplay regardless of individual `data-autoplay` attributes. If you initialize with `autoPlayMedia: false` NO media will autoplay.
+
+Note that embedded HTML5 `<video>`/`<audio>` and YouTube/Vimeo iframes are automatically paused when you navigate away from a slide. This can be disabled by decorating your element with a `data-ignore` attribute.
+
+
+### Embedded iframes
+
+reveal.js automatically pushes two [post messages](https://developer.mozilla.org/en-US/docs/Web/API/Window.postMessage) to embedded iframes. ```slide:start``` when the slide containing the iframe is made visible and ```slide:stop``` when it is hidden.
### Stretching elements
@@ -1125,7 +1137,7 @@ Reveal.initialize({
// other options ...
math: {
- mathjax: 'https://cdn.mathjax.org/mathjax/latest/MathJax.js',
+ mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js',
config: 'TeX-AMS_HTML-full' // See http://docs.mathjax.org/en/latest/config-files.html
},
diff --git a/css/print/pdf.css b/css/print/pdf.css
index 8c3234c..20c646a 100644
--- a/css/print/pdf.css
+++ b/css/print/pdf.css
@@ -87,14 +87,14 @@ ul, ol, div, p {
position: relative;
overflow: hidden;
z-index: 1;
+
+ page-break-after: always;
}
.reveal .slides section {
- page-break-after: always !important;
-
visibility: visible !important;
display: block !important;
- position: relative !important;
+ position: absolute !important;
margin: 0 !important;
padding: 0 !important;
@@ -115,6 +115,7 @@ ul, ol, div, p {
}
.reveal section.stack {
+ position: relative !important;
margin: 0 !important;
padding: 0 !important;
page-break-after: avoid !important;
diff --git a/js/reveal.js b/js/reveal.js
index 3267465..b3a634b 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -105,6 +105,12 @@
// Flags if speaker notes should be visible to all viewers
showNotes: false,
+ // Global override for autolaying embedded media (video/audio/iframe)
+ // - null: Media will only autoplay if data-autoplay is present
+ // - true: All media will autoplay, regardless of individual setting
+ // - false: No media will autoplay, regardless of individual setting
+ autoPlayMedia: null,
+
// Number of milliseconds between automatically proceeding to the
// next slide, disabled when set to 0, this value can be overwritten
// by using a data-autoslide attribute on your slides
@@ -160,6 +166,13 @@
// to PDF, unlimited by default
pdfMaxPagesPerSlide: Number.POSITIVE_INFINITY,
+ // Offset used to reduce the height of content within exported PDF pages.
+ // This exists to account for environment differences based on how you
+ // print to PDF. CLI printing options, like phantomjs and wkpdf, can end
+ // on precisely the total height of the document whereas in-browser
+ // printing has to end one pixel before.
+ pdfPageHeightOffset: -1,
+
// Number of slides away from the current that are visible
viewDistance: 3,
@@ -611,7 +624,7 @@
slideHeight = slideSize.height;
// Let the browser know what page size we want to print
- injectStyleSheet( '@page{size:'+ pageWidth +'px '+ pageHeight +'px; margin: 0 0 -1px 0;}' );
+ injectStyleSheet( '@page{size:'+ pageWidth +'px '+ pageHeight +'px; margin: 0px;}' );
// Limit the size of certain elements to the dimensions of the slide
injectStyleSheet( '.reveal section>img, .reveal section>video, .reveal section>iframe{max-width: '+ slideWidth +'px; max-height:'+ slideHeight +'px}' );
@@ -658,7 +671,7 @@
// so that no page ever flows onto another
var page = document.createElement( 'div' );
page.className = 'pdf-page';
- page.style.height = ( pageHeight * numberOfPages ) + 'px';
+ page.style.height = ( ( pageHeight + config.pdfPageHeightOffset ) * numberOfPages ) + 'px';
slide.parentNode.insertBefore( page, slide );
page.appendChild( slide );
@@ -2450,7 +2463,14 @@
updateNotes();
formatEmbeddedContent();
- startEmbeddedContent( currentSlide );
+
+ // Start or stop embedded content depending on global config
+ if( config.autoPlayMedia === false ) {
+ stopEmbeddedContent( currentSlide );
+ }
+ else {
+ startEmbeddedContent( currentSlide );
+ }
if( isOverview() ) {
layoutOverview();
@@ -3109,6 +3129,9 @@
// Iframes
else if( backgroundIframe ) {
var iframe = document.createElement( 'iframe' );
+ iframe.setAttribute( 'allowfullscreen', '' );
+ iframe.setAttribute( 'mozallowfullscreen', '' );
+ iframe.setAttribute( 'webkitallowfullscreen', '' );
// Only load autoplaying content when the slide is shown to
// avoid having it play in the background
@@ -3249,14 +3272,16 @@
return;
}
- // Autoplay is always on for slide backgrounds
- var autoplay = el.hasAttribute( 'data-autoplay' ) ||
- el.hasAttribute( 'data-paused-by-reveal' ) ||
- !!closestParent( el, '.slide-background' );
+ // Prefer an explicit global autoplay setting
+ var autoplay = config.autoPlayMedia;
- if( autoplay && typeof el.play === 'function' ) {
+ // If no global setting is available, fall back on the element's
+ // own autoplay setting
+ if( typeof autoplay !== 'boolean' ) {
+ autoplay = el.hasAttribute( 'data-autoplay' ) || !!closestParent( el, '.slide-background' );
+ }
- el.removeAttribute( 'data-paused-by-reveal' );
+ if( autoplay && typeof el.play === 'function' ) {
if( el.readyState > 1 ) {
startEmbeddedMedia( { target: el } );
@@ -3264,9 +3289,6 @@
else {
el.removeEventListener( 'loadeddata', startEmbeddedMedia ); // remove first to avoid dupes
el.addEventListener( 'loadeddata', startEmbeddedMedia );
-
- // `loadeddata` never fires unless we start playing on iPad
- if( /ipad/gi.test( UA ) ) el.play();
}
}
@@ -3335,7 +3357,14 @@
if( isAttachedToDOM && isVisible ) {
- var autoplay = iframe.hasAttribute( 'data-autoplay' ) || !!closestParent( iframe, '.slide-background' );
+ // Prefer an explicit global autoplay setting
+ var autoplay = config.autoPlayMedia;
+
+ // If no global setting is available, fall back on the element's
+ // own autoplay setting
+ if( typeof autoplay !== 'boolean' ) {
+ autoplay = iframe.hasAttribute( 'data-autoplay' ) || !!closestParent( iframe, '.slide-background' );
+ }
// YouTube postMessage API
if( /youtube\.com\/embed\//.test( iframe.getAttribute( 'src' ) ) && autoplay ) {
diff --git a/plugin/math/math.js b/plugin/math/math.js
index c0a691d..e3b4089 100755
--- a/plugin/math/math.js
+++ b/plugin/math/math.js
@@ -7,7 +7,7 @@
var RevealMath = window.RevealMath || (function(){
var options = Reveal.getConfig().math || {};
- options.mathjax = options.mathjax || 'https://cdn.mathjax.org/mathjax/latest/MathJax.js';
+ options.mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
options.config = options.config || 'TeX-AMS_HTML-full';
loadScript( options.mathjax + '?config=' + options.config, function() {
diff --git a/test/examples/math.html b/test/examples/math.html
index 1b80e03..d35e827 100644
--- a/test/examples/math.html
+++ b/test/examples/math.html
@@ -169,7 +169,7 @@
transition: 'linear',
math: {
- // mathjax: 'http://cdn.mathjax.org/mathjax/latest/MathJax.js',
+ // mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js',
config: 'TeX-AMS_HTML-full'
},