Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// Make the menu collapse button
let menuButton = this.element.appendChild(document.createElement('button'));
menuButton.className = styles['guify-bar-button'];
menuButton.innerHTML = 'Controls';
css(menuButton, {
left: opts.align == 'left' ? '0' : 'unset',
right: opts.align == 'left' ? 'unset' : '0',
})
menuButton.onclick = () => {
this.emit('ontogglepanel');
}
// Make the fullscreen button
if (screenfull.isEnabled) {
let fullscreenButton = this.element.appendChild(document.createElement('button'));
fullscreenButton.className = styles['guify-bar-button'];
fullscreenButton.innerHTML = '「 」';
fullscreenButton.setAttribute('aria-label', 'Toggle Fullscreen');
css(fullscreenButton, {
left: opts.align == 'left' ? 'unset' : '0', // Place on opposite side from menuButton
right: opts.align == 'left' ? '0' : 'unset',
})
fullscreenButton.onclick = () => {
this.emit('onfullscreenrequested');
}
}
}
return () => {
if (screenfull.isEnabled) {
screenfull.exit();
}
const node = getNode();
if (node) {
node.removeEventListener("scroll", handleScroll);
}
};
}, []);
requestFullScreen() {
const videoElem = this.props.videoContainerRef.current;
if (this.state.isScreentFull) {
screenfull.exit();
} else {
if (screenfull.isEnabled) {
setTimeout(() => {
this.props.controllerContainerRef.current.style.width =
"calc(100vw - 2px)";
this.props.controllerContainerRef.current.style.height =
"calc(100vh - 2px)";
this.props.progressAndControlsWrapRef.current.style.width = "100vw";
}, 100);
screenfull.request(videoElem);
} else {
alert("Sorry, present video can't fullscreen.");
}
}
}
openFullscreen() {
let root = this.shadowRoot.querySelector('.root'); //for now remove fullscreen option for firefox mobile
return this.fullscreen && screenfull && screenfull.isEnabled && !(isMobile() && isFirefox()) ? screenfull.request(root) : Promise.resolve(false);
}
const handleFullscreen = () => {
if (screenfull.isEnabled) {
const el = document.getElementById('player-fs-container')
screenfull.request(el)
}
}
fullToggle = () => {
if (screenfull.isEnabled) {
screenfull.request(document.getElementById('bar'))
}
}
render() {
toggleFullscreen() {
if (screenfull.isEnabled) {
screenfull.toggle();
this.isFullscreen = !this.isFullscreen;
}
}
}
mounted() {
if (screenfull.isEnabled) {
screenfull.on('change', this.changeFullShow)
}
},
methods: {
handleFullscreenClick = () => {
if (screenfull.isEnabled) {
screenfull.toggle()
}
}
handleHangoutClick = () => {
get() {
return screenfull.isEnabled;
},
});