Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix data-background-video autoplay on iOS Safari #1851

Merged
merged 1 commit into from
Apr 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,7 @@
* target element.
*
* remaining height = [ configured parent height ] - [ current parent height ]
*
*
* @param {HTMLElement} element
* @param {number} [height]
*/
Expand Down Expand Up @@ -3058,6 +3058,8 @@
// Videos
else if ( backgroundVideo && !isSpeakerNotes() ) {
var video = document.createElement( 'video' );
video.setAttribute( 'autoplay', '' );
video.setAttribute( 'playsinline', '' );

if( backgroundVideoLoop ) {
video.setAttribute( 'loop', '' );
Expand Down Expand Up @@ -3900,7 +3902,7 @@
// 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.
// is divided up into fragments.
// playbackRate is accounted for in the duration.
if( currentSlide.querySelectorAll( '.fragment' ).length === 0 ) {
toArray( currentSlide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) {
Expand Down