From b1e5db0ec9647532c4a2e9f05101329c3129eb97 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Tue, 26 May 2020 10:56:02 +0200 Subject: [PATCH] data-autoslide attribute takes precedence over video duration --- dist/reveal.esm.js | 2 +- dist/reveal.js | 2 +- examples/media.html | 9 ++++++--- js/reveal.js | 26 +++++++++++++------------- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/dist/reveal.esm.js b/dist/reveal.esm.js index 4b86292..9c9b63a 100644 --- a/dist/reveal.esm.js +++ b/dist/reveal.esm.js @@ -5,5 +5,5 @@ * * Copyright (C) 2020 Hakim El Hattab, https://hakim.se */ -var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var n,i=function(e){return e&&e.Math==Math&&e},r=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof e&&e)||Function("return this")(),a={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},o=function(e){try{return!!e()}catch(e){return!0}},s={}.toString,l=function(e){return s.call(e).slice(8,-1)},c="".split,u=o((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==l(e)?c.call(e,""):Object(e)}:Object,d=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},h=function(e){return u(d(e))},f=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),v=function(e){return"object"==typeof e?null!==e:"function"==typeof e},g=r.document,p=v(g)&&v(g.createElement),m=function(e){return p?g.createElement(e):{}},y=!f&&!o((function(){return 7!=Object.defineProperty(m("div"),"a",{get:function(){return 7}}).a})),b=function(e){if(!v(e))throw TypeError(String(e)+" is not an object");return e},w=function(e,t){if(!v(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!v(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!v(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!v(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")},S=Object.defineProperty,E={f:f?S:function(e,t,n){if(b(e),t=w(t,!0),b(n),y)try{return S(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},A=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},R=f?function(e,t,n){return E.f(e,t,A(1,n))}:function(e,t,n){return e[t]=n,e},k=function(e,t){try{R(r,e,t)}catch(n){r[e]=t}return t},x=r["__core-js_shared__"]||k("__core-js_shared__",{}),L=t((function(e){(e.exports=function(e,t){return x[e]||(x[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),C={}.hasOwnProperty,P=function(e,t){return C.call(e,t)},N=0,M=Math.random(),I=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++N+M).toString(36)},T=!!Object.getOwnPropertySymbols&&!o((function(){return!String(Symbol())})),O=T&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,D=L("wks"),j=r.Symbol,H=O?j:j&&j.withoutSetter||I,B=function(e){return P(D,e)||(T&&P(j,e)?D[e]=j[e]:D[e]=H("Symbol."+e)),D[e]},U=Math.ceil,F=Math.floor,z=function(e){return isNaN(e=+e)?0:(e>0?F:U)(e)},q=Math.min,_=function(e){return e>0?q(z(e),9007199254740991):0},V=Math.max,W=Math.min,K=function(e,t){var n=z(e);return n<0?V(n+t,0):W(n,t)},X=function(e){return function(t,n,i){var r,a=h(t),o=_(a.length),s=K(i,o);if(e&&n!=n){for(;o>s;)if((r=a[s++])!=r)return!0}else for(;o>s;s++)if((e||s in a)&&a[s]===n)return e||s||0;return!e&&-1}},$={includes:X(!0),indexOf:X(!1)},Y={},G=$.indexOf,J=function(e,t){var n,i=h(e),r=0,a=[];for(n in i)!P(Y,n)&&P(i,n)&&a.push(n);for(;t.length>r;)P(i,n=t[r++])&&(~G(a,n)||a.push(n));return a},Q=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Z=Object.keys||function(e){return J(e,Q)},ee=f?Object.defineProperties:function(e,t){b(e);for(var n,i=Z(t),r=i.length,a=0;r>a;)E.f(e,n=i[a++],t[n]);return e},te=r,ne=function(e){return"function"==typeof e?e:void 0},ie=function(e,t){return arguments.length<2?ne(te[e])||ne(r[e]):te[e]&&te[e][t]||r[e]&&r[e][t]},re=ie("document","documentElement"),ae=L("keys"),oe=function(e){return ae[e]||(ae[e]=I(e))},se=oe("IE_PROTO"),le=function(){},ce=function(e){return" diff --git a/js/reveal.js b/js/reveal.js index 4807369..231efcb 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2067,21 +2067,21 @@ export default function( revealElement, options ) { } else { autoSlide = config.autoSlide; - } - // If there are media elements with data-autoplay, - // automatically set the autoSlide duration to the - // length of that media. Not applicable if the slide - // is divided up into fragments. - // playbackRate is accounted for in the duration. - if( currentSlide.querySelectorAll( '.fragment' ).length === 0 ) { - Util.queryAll( currentSlide, 'video, audio' ).forEach( el => { - if( el.hasAttribute( 'data-autoplay' ) ) { - if( autoSlide && (el.duration * 1000 / el.playbackRate ) > autoSlide ) { - autoSlide = ( el.duration * 1000 / el.playbackRate ) + 1000; + // If there are media elements with data-autoplay, + // automatically set the autoSlide duration to the + // length of that media. Not applicable if the slide + // is divided up into fragments. + // playbackRate is accounted for in the duration. + if( currentSlide.querySelectorAll( '.fragment' ).length === 0 ) { + Util.queryAll( currentSlide, 'video, audio' ).forEach( el => { + if( el.hasAttribute( 'data-autoplay' ) ) { + if( autoSlide && (el.duration * 1000 / el.playbackRate ) > autoSlide ) { + autoSlide = ( el.duration * 1000 / el.playbackRate ) + 1000; + } } - } - } ); + } ); + } } // Cue the next auto-slide if: