2022-03-30 12:32:08 +00:00
|
|
|
<template>
|
2022-05-28 01:36:26 +00:00
|
|
|
<div
|
|
|
|
ref="vidcontainer"
|
|
|
|
v-touch="{
|
|
|
|
down: () => ($refs.player.styles.width = '50% !important'),
|
|
|
|
up: () => ($refs.player.styles['object-fit'] = 'contain !important'),
|
|
|
|
}"
|
|
|
|
class="d-flex flex-column"
|
|
|
|
style="position: relative"
|
|
|
|
:style="{
|
|
|
|
borderRadius: $store.state.tweaks.roundWatch
|
|
|
|
? `${$store.state.tweaks.roundTweak / 3}rem`
|
|
|
|
: '0',
|
|
|
|
}"
|
|
|
|
@click="controls = !controls"
|
|
|
|
>
|
2022-04-29 01:44:37 +00:00
|
|
|
<video
|
|
|
|
ref="player"
|
|
|
|
autoplay
|
|
|
|
width="100%"
|
2022-05-28 01:36:26 +00:00
|
|
|
:src="vidSrc"
|
|
|
|
style="transition: filter 0.15s ease-in-out; max-height: 100vh"
|
|
|
|
:style="
|
|
|
|
controls
|
|
|
|
? 'filter: brightness(50%); object-fit: contain'
|
|
|
|
: 'filter: none; object-fit: cover'
|
|
|
|
"
|
2022-04-29 01:44:37 +00:00
|
|
|
/>
|
2022-05-28 01:36:26 +00:00
|
|
|
<!-- @webkitfullscreenchange="handleFullscreenChange" -->
|
|
|
|
|
|
|
|
<v-btn
|
|
|
|
text
|
|
|
|
tile
|
|
|
|
style="
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 50%;
|
|
|
|
height: 100%;
|
|
|
|
opacity: 0;
|
|
|
|
"
|
2022-05-28 05:16:27 +00:00
|
|
|
@dbclick.stop="$refs.player.currentTime -= $refs.player.duration / 10"
|
2022-05-28 01:36:26 +00:00
|
|
|
>
|
|
|
|
<v-icon>mdi-rewind</v-icon>
|
|
|
|
</v-btn>
|
|
|
|
|
|
|
|
<v-btn
|
|
|
|
text
|
|
|
|
tile
|
|
|
|
style="
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 50%;
|
|
|
|
width: 50%;
|
|
|
|
height: 100%;
|
|
|
|
opacity: 0;
|
|
|
|
"
|
2022-05-28 05:16:27 +00:00
|
|
|
@dbclick.stop="$refs.player.currentTime += $refs.player.duration / 10"
|
2022-05-28 01:36:26 +00:00
|
|
|
>
|
|
|
|
<v-icon>mdi-fast-forward</v-icon>
|
|
|
|
</v-btn>
|
|
|
|
|
|
|
|
<div
|
|
|
|
style="transition: opacity 0.15s ease-in-out"
|
|
|
|
:style="controls ? 'opacity: 1;' : 'opacity: 0; pointer-events: none'"
|
|
|
|
>
|
|
|
|
<v-btn fab text style="position: absolute; top: 0; left: 0">
|
|
|
|
<v-icon>mdi-chevron-down</v-icon>
|
|
|
|
</v-btn>
|
2022-05-28 05:16:27 +00:00
|
|
|
<loop />
|
|
|
|
<captions />
|
2022-05-28 01:36:26 +00:00
|
|
|
<v-btn fab text style="position: absolute; top: 0; right: 0">
|
|
|
|
<v-icon>mdi-close</v-icon>
|
|
|
|
</v-btn>
|
2022-05-01 16:42:26 +00:00
|
|
|
|
2022-05-28 05:16:27 +00:00
|
|
|
<playpause
|
2022-05-28 01:36:26 +00:00
|
|
|
v-if="$refs.player"
|
2022-05-28 05:16:27 +00:00
|
|
|
:video="$refs.player"
|
|
|
|
@close="controls = false"
|
2022-05-28 01:36:26 +00:00
|
|
|
/>
|
2022-05-28 05:16:27 +00:00
|
|
|
|
|
|
|
<watchtime v-if="$refs.player" :video="$refs.player" />
|
|
|
|
<quality />
|
|
|
|
<speed />
|
|
|
|
<fullscreen
|
|
|
|
:fullscreen="isFullscreen"
|
|
|
|
@fullscreen="(controls = $refs.player.paused), handleFullscreenChange()"
|
2022-05-28 01:36:26 +00:00
|
|
|
/>
|
|
|
|
</div>
|
2022-05-28 05:16:27 +00:00
|
|
|
<seekbar v-if="$refs.player" :sources="sources" :video="$refs.player" />
|
2022-03-30 12:32:08 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-05-28 05:16:27 +00:00
|
|
|
import loop from "~/components/Player/loop.vue";
|
|
|
|
import speed from "~/components/Player/speed.vue";
|
2022-05-21 02:01:39 +00:00
|
|
|
import seekbar from "~/components/Player/seekbar.vue";
|
2022-05-28 05:16:27 +00:00
|
|
|
import quality from "~/components/Player/quality.vue";
|
|
|
|
import captions from "~/components/Player/captions.vue";
|
|
|
|
import playpause from "~/components/Player/playpause.vue";
|
|
|
|
import watchtime from "~/components/Player/watchtime.vue";
|
|
|
|
import fullscreen from "~/components/Player/fullscreen.vue";
|
2022-03-30 12:32:08 +00:00
|
|
|
export default {
|
2022-04-29 11:49:32 +00:00
|
|
|
components: {
|
2022-05-28 05:16:27 +00:00
|
|
|
fullscreen,
|
|
|
|
watchtime,
|
|
|
|
playpause,
|
|
|
|
captions,
|
|
|
|
quality,
|
2022-05-01 16:42:26 +00:00
|
|
|
seekbar,
|
2022-05-28 05:16:27 +00:00
|
|
|
speed,
|
|
|
|
loop,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
sources: {
|
|
|
|
type: Array,
|
|
|
|
required: true,
|
|
|
|
},
|
2022-04-29 11:49:32 +00:00
|
|
|
},
|
2022-03-30 12:32:08 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2022-05-28 01:36:26 +00:00
|
|
|
isFullscreen: false,
|
|
|
|
controls: false,
|
2022-04-29 01:44:37 +00:00
|
|
|
vidSrc: "",
|
2022-03-30 12:32:08 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2022-05-28 01:36:26 +00:00
|
|
|
console.log("sources", this.sources);
|
2022-05-21 02:01:39 +00:00
|
|
|
this.vidSrc = this.sources[this.sources.length - 1].url;
|
2022-03-30 12:32:08 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2022-05-28 01:36:26 +00:00
|
|
|
handleFullscreenChange() {
|
|
|
|
console.log(this.$refs.player);
|
|
|
|
console.log(document.fullscreenElement);
|
|
|
|
if (document?.fullscreenElement === this.$refs.vidcontainer) {
|
|
|
|
// const cancellFullScreen =
|
|
|
|
// document.exitFullscreen ||
|
|
|
|
// document.mozCancelFullScreen ||
|
|
|
|
// document.webkitExitFullscreen ||
|
|
|
|
// document.msExitFullscreen;
|
|
|
|
// cancellFullScreen.call(document);
|
|
|
|
if (document.exitFullscreen) {
|
|
|
|
document.exitFullscreen();
|
|
|
|
} else if (document.mozCancelFullScreen) {
|
|
|
|
document.mozCancelFullScreen();
|
|
|
|
} else if (document.webkitExitFullscreen) {
|
|
|
|
document.webkitExitFullscreen();
|
|
|
|
}
|
|
|
|
this.isFullscreen = false;
|
2022-03-30 12:32:08 +00:00
|
|
|
this.$vuetube.statusBar.show();
|
|
|
|
this.$vuetube.navigationBar.show();
|
2022-05-28 01:36:26 +00:00
|
|
|
} else {
|
|
|
|
// const element = document;
|
|
|
|
// const requestFullScreen =
|
|
|
|
// element.requestFullscreen ||
|
|
|
|
// element.webkitRequestFullScreen ||
|
|
|
|
// element.mozRequestFullScreen ||
|
|
|
|
// element.msRequestFullScreen;
|
|
|
|
// requestFullScreen.call(element);
|
|
|
|
this.$refs.vidcontainer.requestFullscreen({
|
|
|
|
requireOrientation: "landscape",
|
|
|
|
});
|
|
|
|
this.isFullscreen = true;
|
|
|
|
this.$vuetube.statusBar.hide();
|
|
|
|
this.$vuetube.navigationBar.hide();
|
2022-03-30 12:32:08 +00:00
|
|
|
}
|
2022-05-28 01:36:26 +00:00
|
|
|
// screen.orientation
|
|
|
|
// .lock("landscape")
|
|
|
|
// .then(function () {
|
|
|
|
// console.log("Locked");
|
|
|
|
// })
|
|
|
|
// .catch(function (error) {
|
|
|
|
// console.log(error);
|
|
|
|
// });
|
2022-03-30 12:32:08 +00:00
|
|
|
},
|
2022-04-29 01:44:37 +00:00
|
|
|
getPlayer() {
|
|
|
|
return this.$refs.player;
|
2022-03-30 12:32:08 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|