Repository URL to install this package:
|
Version:
2.1.16 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const tslib_1 = require("tslib");
const mobx_1 = require("xmobx/mobx");
class VideoState {
constructor(props) {
// meta
this.isPlaying = false;
this.hasBeenPlayedAtLeastOnce = false; // props
this.shouldAutoPlay = false;
this.hasNativeControls = false;
this.hasPlayButton = false;
this.shouldShowVideoInformation = false;
this.defaultProps = {};
this.setProps(props);
}
setIsPlaying(isPlaying) {
this.isPlaying = isPlaying;
if (this.defaultProps.hasNativeControls === true) {
if (this.defaultProps.hasPlayButton === false && !isPlaying) {
this.hasNativeControls = true;
} else {
this.hasNativeControls = isPlaying;
}
}
if (this.defaultProps.hasPlayButton === true) {
this.hasPlayButton = !isPlaying;
}
if (this.defaultProps.shouldShowVideoInformation === true) {
this.shouldShowVideoInformation = !isPlaying;
}
}
toggleIsPlaying() {
this.setIsPlaying(!this.isPlaying);
} // @action
setProps(props) {
// storing user props
this.defaultProps = props;
}
}
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, "shouldAutoPlay", void 0);
tslib_1.__decorate([mobx_1.observable], VideoState.prototype, "hasNativeControls", void 0);
tslib_1.__decorate([mobx_1.observable], VideoState.prototype, "hasPlayButton", void 0);
tslib_1.__decorate([mobx_1.observable], VideoState.prototype, "shouldShowVideoInformation", void 0);
tslib_1.__decorate([mobx_1.action], VideoState.prototype, "setIsPlaying", null);
tslib_1.__decorate([mobx_1.action.bound], VideoState.prototype, "toggleIsPlaying", null);
exports.VideoState = VideoState;
exports.default = VideoState;