Repository URL to install this package:
|
Version:
2.3.6 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const tslib_1 = require("tslib");
const mobx_1 = require("xmobx/mobx"); // I don't think we need it since we have native controls
// @observable isFocused = false
class VideoState {
constructor(props) {
// meta
this.isPlaying = false;
this.hasBeenPlayedAtLeastOnce = false; // props
this.autoPlay = false;
this.controls = false;
this.setProps(props);
}
setIsPlaying(isPlaying) {
this.isPlaying = isPlaying;
console.debug('[Video] setIsPlaying: ' + isPlaying); // we have this to make sure
if (isPlaying === true) {
if (this.hasBeenPlayedAtLeastOnce === false) {
this.hasBeenPlayedAtLeastOnce = true;
}
this.autoPlay = true;
this.controls = true;
}
}
toggleIsPlaying() {
this.setIsPlaying(!this.isPlaying);
}
setProps(props) {
this.autoPlay = props.autoPlay;
this.controls = props.controls;
}
}
tslib_1.__decorate([mobx_1.observable], VideoState.prototype, "isPlaying", void 0);
tslib_1.__decorate([mobx_1.observable], VideoState.prototype, "hasBeenPlayedAtLeastOnce", void 0);
tslib_1.__decorate([mobx_1.observable], VideoState.prototype, "autoPlay", void 0);
tslib_1.__decorate([mobx_1.observable], VideoState.prototype, "controls", void 0);
tslib_1.__decorate([mobx_1.action], VideoState.prototype, "setIsPlaying", null);
tslib_1.__decorate([mobx_1.action.bound], VideoState.prototype, "toggleIsPlaying", null);
tslib_1.__decorate([mobx_1.action], VideoState.prototype, "setProps", null);
exports.VideoState = VideoState;
exports.default = VideoState; //# sourceMappingURL=VideoState.js.map