//html += 'onended="this.play()" ';
html += 'loop ';
}
- if (autoplay == '1') {
- html += 'autoplay ';
- }
+
if (sound == '0') {
html += 'muted ';
}
setTimeout(function () {
$this.fluidbook.contentlock.addAction(linkid, 'complete');
}, (player.duration() - 5) * 1000);
-
- // var playPromise = player.play();
- // if (settings.paused) {
- // if (playPromise && (typeof Promise !== 'undefined') && (playPromise instanceof Promise)) {
- // playPromise.then((result) => {
- // setTimeout(player.pause, 100);
- // });
- // } else {
- // player.pause();
- // }
- // }
+ }else{
+ if(autoplay=='1') {
+ var promise = player.play();
+
+ if (promise !== undefined) {
+ promise.then(function () {
+ // Autoplay started!
+ }).catch(function (error) {
+ // Autoplay was prevented.
+ });
+ }
+ }
}
-
});
player.on('play', function () {
if (loop == '1') {
html += 'onended="this.play()" ';
}
- if (autoplay == '1') {
- html += 'autoplay="autoplay" ';
- }
+ html += 'data-autoplay="' + autoplay + '" ';
if (sound == '0') {
html += 'muted="muted" ';
}