Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pause: () => {
},
stop: () => {
},
load: () => {
},
}, hooks),
}, overlayOptions);
this.options.needPlayButton = this.options.control && !this.options.picMode;
this.player = null;
// Setup canvas and play button
this.els = {
wrapper: isString(wrapper)
? document.querySelector(wrapper)
: wrapper,
canvas: null,
playButton: document.createElement('div'),
unmuteButton: null,
poster: null,
};
if (window.getComputedStyle(this.els.wrapper).getPropertyValue('position') === 'static') {
this.els.wrapper.style.position = 'relative';
}
this.els.wrapper.clientRect = this.els.wrapper.getBoundingClientRect();
this.initCanvas();
this.initPlayButton();
initCanvas() {
if (this.options.canvas) {
this.els.canvas = isString(this.options.canvas)
? document.querySelector(this.options.canvas)
: this.options.canvas;
} else {
this.els.canvas = document.createElement('canvas');
this.els.canvas.classList.add(_style.canvas);
this.els.wrapper.appendChild(this.els.canvas);
}
};
constructor(selectorOrEls, context = document) {
let elements = null;
if (isString(selectorOrEls)) {
elements = context.querySelectorAll(selectorOrEls);
} else {
elements = selectorOrEls;
}
this.nodeList = nodeListToArray(elements);
};
constructor(source, {
context = 'body',
control = false,
autoPlay = false,
autoClose = true,
preload = true,
orientation = 'portrait',
aspectRatio = 0,
disableRotation = false,
picMode = false,
fixAndroidWechatContinue = false,
hooks = {},
}) {
this.context = isString(context)
? document.querySelector(context)
: context;
this.options = {
source,
control,
autoPlay,
autoClose,
preload,
orientation,
aspectRatio: aspectRatio || (() => orientation === 'landscape'
? 16 / 9
: 9 / 16)(),
disableRotation,
picMode,
fixAndroidWechatContinue,
};
constructor(template, selectorOrEl, data) {
if (isString(selectorOrEl)) {
this.element = document.querySelector(selectorOrEl);
} else {
this.element = selectorOrEl;
}
this.template = template;
this.jsonData = data;
}