Fullscreen: bring video control buttons along

This commit is contained in:
Noah 2024-10-01 21:32:54 -07:00
parent 3a7204178c
commit a70d6d54b3

View File

@ -28,6 +28,9 @@ export default {
}; };
}, },
computed: { computed: {
containerID() {
return this.videoID + '-container';
},
videoID() { videoID() {
return this.localVideo ? 'localVideo' : `videofeed-${this.username}`; return this.localVideo ? 'localVideo' : `videofeed-${this.username}`;
}, },
@ -60,10 +63,21 @@ export default {
this.$emit('popout', this.username); this.$emit('popout', this.username);
}, },
fullscreen() { fullscreen(force=false) {
let $elem = document.getElementById(this.videoID); // If we are popped-out, pop back in before full screen.
if (this.poppedOut && !force) {
this.popoutVideo();
window.requestAnimationFrame(() => {
this.fullscreen(true);
});
return;
}
let $elem = document.getElementById(this.containerID);
if ($elem) { if ($elem) {
if ($elem.requestFullscreen) { if (document.fullscreenElement) {
document.exitFullscreen();
} else if ($elem.requestFullscreen) {
$elem.requestFullscreen(); $elem.requestFullscreen();
} else { } else {
window.alert("Fullscreen not supported by your browser."); window.alert("Fullscreen not supported by your browser.");
@ -84,7 +98,7 @@ export default {
</script> </script>
<template> <template>
<div class="feed" :class="{ <div class="feed" :id="containerID" :class="{
'popped-out': poppedOut, 'popped-out': poppedOut,
'popped-in': !poppedOut, 'popped-in': !poppedOut,
}" @mouseover="mouseOver = true" @mouseleave="mouseOver = false"> }" @mouseover="mouseOver = true" @mouseleave="mouseOver = false">
@ -136,7 +150,7 @@ export default {
<i class="fa fa-up-right-from-square"></i> <i class="fa fa-up-right-from-square"></i>
</button> </button>
<!-- Full screen --> <!-- Full screen. -->
<button type="button" class="button is-small is-light is-outlined p-2 ml-2" title="Go full screen" <button type="button" class="button is-small is-light is-outlined p-2 ml-2" title="Go full screen"
:class="{'seethru': !mouseOver}" :class="{'seethru': !mouseOver}"
@click="fullscreen()"> @click="fullscreen()">