Fix video background autoplay on iOS

edit
ADAM STONE 2017-03-17 22:47:25 -04:00
parent a349ff43c5
commit d9dd9a92fb
1 changed files with 4 additions and 2 deletions

View File

@ -1426,7 +1426,7 @@
* target element. * target element.
* *
* remaining height = [ configured parent height ] - [ current parent height ] * remaining height = [ configured parent height ] - [ current parent height ]
* *
* @param {HTMLElement} element * @param {HTMLElement} element
* @param {number} [height] * @param {number} [height]
*/ */
@ -3058,6 +3058,8 @@
// Videos // Videos
else if ( backgroundVideo && !isSpeakerNotes() ) { else if ( backgroundVideo && !isSpeakerNotes() ) {
var video = document.createElement( 'video' ); var video = document.createElement( 'video' );
video.setAttribute( 'autoplay', '' );
video.setAttribute( 'playsinline', '' );
if( backgroundVideoLoop ) { if( backgroundVideoLoop ) {
video.setAttribute( 'loop', '' ); video.setAttribute( 'loop', '' );
@ -3900,7 +3902,7 @@
// If there are media elements with data-autoplay, // If there are media elements with data-autoplay,
// automatically set the autoSlide duration to the // automatically set the autoSlide duration to the
// length of that media. Not applicable if the slide // length of that media. Not applicable if the slide
// is divided up into fragments. // is divided up into fragments.
// playbackRate is accounted for in the duration. // playbackRate is accounted for in the duration.
if( currentSlide.querySelectorAll( '.fragment' ).length === 0 ) { if( currentSlide.querySelectorAll( '.fragment' ).length === 0 ) {
toArray( currentSlide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) { toArray( currentSlide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) {