1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-08-30 16:30:04 +02:00

Odd workaround

This commit is contained in:
Antonio Laguna
2017-03-20 09:16:53 +01:00
parent c9ad5306ea
commit 70feb2c7c4

View File

@@ -1,5 +1,4 @@
/* global YT */
import DOM from '../utils/dom';
import Slide from '../modules/slide';
@@ -24,6 +23,9 @@ class Player {
events: {
onReady: () => {
this.ready = true;
if (this.timeout && this.player.getPlayerState() !== 1) {
this.play();
}
if (this.onReadyC) {
this.onReadyC();
@@ -32,7 +34,9 @@ class Player {
}
}
});
this.el = this.player.getIframe();
this.timeout = null;
}
/**
@@ -40,6 +44,9 @@ class Player {
*/
play() {
if (this.ready) {
this.timeout = setTimeout(() => {
this.timeout = null;
}, 1000);
this.player.playVideo();
} else {
this.onReadyC = this.play;
@@ -134,7 +141,6 @@ export default class YouTube {
* @param {Slide} slide
*/
static onSectionEnabled(slide) {
console.log('enabling', slide); // eslint-disable-line no-console
slide.player.play();
}
@@ -143,7 +149,6 @@ export default class YouTube {
* @param {Slide} slide
*/
static onSectionDisabled(slide) {
console.log('disabling', slide); // eslint-disable-line no-console
slide.player.pause();
}
}