Created
November 30, 2018 06:18
-
-
Save cameronjonesweb/0bffe4f2bad4c962956784d273c25338 to your computer and use it in GitHub Desktop.
Fixes Vide.js videos not autoplaying on Safari
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @link https://github.com/vodkabears/Vide/issues/206 | |
*/ | |
function cameronjoneswebAutoPlayVideo( video ) { | |
if ( video.readyState === 4 ) { | |
video.play(); | |
} else { | |
setTimeout( cameronjoneswebAutoPlayVideo, 100, video ); | |
} | |
} | |
jQuery( document ).ready( function () { | |
video = jQuery( '#my-video-selector' ).data( 'vide' ).getVideoObject(); | |
cameronjoneswebAutoPlayVideo( video ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment