Andrew Poulos
1/21/2015 8:55:00 PM
iOS, for one, will not allow video to autoplay. The client would like
the elearning I'm developing to autoplay video. If a device cannot
autoplay then they want an instruction to appear that says something
like "Select Play to watch the video". So I need to be able to detect is
autoplay is possible.
I found this that looked worth trying
var AUTOPLAY = false;
(function() {
var mp3 = 'data:audio/mpeg;base64,/[ a data URI here ];
try {
var audio = new Audio();
audio.autoplay = true;
$(audio).on('play', function() {
AUTOPLAY = true;
});
audio.src = mp3;
} catch(e) {
// error
}
})();
Alas I don't understand "$(audio).on('play', function() {"
What is it doing?
Andrew Poulos