2022-02-24 22:29:34 +00:00
|
|
|
<template>
|
2022-03-25 19:21:00 +00:00
|
|
|
<div class="background">
|
2022-03-26 03:25:28 +00:00
|
|
|
<!-- Stock Player -->
|
2022-04-01 00:15:13 +00:00
|
|
|
<videoPlayer
|
|
|
|
style="position: sticky; top: 0; z-index: 696969"
|
|
|
|
:vid-src="vidSrc"
|
2022-04-01 13:04:52 +00:00
|
|
|
ref="player"
|
2022-04-01 00:15:13 +00:00
|
|
|
/>
|
2022-03-26 03:25:28 +00:00
|
|
|
|
|
|
|
<!-- VueTube Player V1 -->
|
|
|
|
<!-- <VTPlayerV1 :sources="sources" v-if="sources.length > 0" />-->
|
|
|
|
|
2022-03-25 19:21:00 +00:00
|
|
|
<v-card v-if="loaded" class="ml-2 mr-2 background" flat>
|
2022-03-23 11:21:06 +00:00
|
|
|
<v-card-title
|
|
|
|
class="mt-2"
|
|
|
|
style="
|
|
|
|
padding-top: 0;
|
|
|
|
padding-bottom: 0;
|
|
|
|
font-size: 0.95rem;
|
|
|
|
line-height: 1rem;
|
|
|
|
"
|
2022-04-04 11:33:16 +00:00
|
|
|
v-text="video.title"
|
2022-03-21 00:30:59 +00:00
|
|
|
/>
|
2022-03-20 00:27:45 +00:00
|
|
|
<v-card-text>
|
2022-03-23 11:21:06 +00:00
|
|
|
<div style="margin-bottom: 1rem">
|
2022-04-04 11:33:16 +00:00
|
|
|
<template
|
|
|
|
v-for="text in video.metadata.contents.find(
|
|
|
|
(content) => content.slimVideoInformationRenderer
|
|
|
|
).slimVideoInformationRenderer.collapsedSubtitle.runs"
|
|
|
|
>{{ text.text }}</template
|
|
|
|
>
|
2022-03-23 11:21:06 +00:00
|
|
|
</div>
|
2022-03-20 07:24:38 +00:00
|
|
|
|
2022-03-20 00:27:45 +00:00
|
|
|
<!-- Scrolling Div For Interactions --->
|
2022-03-21 00:30:59 +00:00
|
|
|
<div style="display: flex; margin-bottom: 1em">
|
|
|
|
<v-list-item
|
|
|
|
v-for="(item, index) in interactions"
|
|
|
|
:key="index"
|
|
|
|
style="padding: 0; flex: 0 0 20%"
|
|
|
|
>
|
|
|
|
<v-btn
|
|
|
|
text
|
2022-03-20 07:24:38 +00:00
|
|
|
class="vertical-button"
|
|
|
|
style="padding: 0; margin: 0"
|
|
|
|
elevation="0"
|
|
|
|
:disabled="item.disabled"
|
2022-03-22 05:47:28 +00:00
|
|
|
@click="callMethodByName(item.actionName)"
|
2022-03-20 07:24:38 +00:00
|
|
|
>
|
2022-03-20 00:27:45 +00:00
|
|
|
<v-icon v-text="item.icon" />
|
2022-03-23 11:21:06 +00:00
|
|
|
<div
|
|
|
|
class="mt-2"
|
|
|
|
style="font-size: 0.66rem"
|
|
|
|
v-text="item.value || item.name"
|
|
|
|
/>
|
2022-03-20 16:13:58 +00:00
|
|
|
</v-btn>
|
2022-03-20 00:27:45 +00:00
|
|
|
</v-list-item>
|
2022-03-20 13:17:26 +00:00
|
|
|
|
2022-03-20 16:29:29 +00:00
|
|
|
<v-spacer />
|
2022-03-20 18:42:12 +00:00
|
|
|
<v-btn text @click="showMore = !showMore">
|
|
|
|
<v-icon v-if="showMore">mdi-chevron-up</v-icon>
|
|
|
|
<v-icon v-else>mdi-chevron-down</v-icon>
|
|
|
|
</v-btn>
|
2022-03-20 00:27:45 +00:00
|
|
|
</div>
|
|
|
|
<!-- End Scrolling Div For Interactions --->
|
2022-03-22 01:13:48 +00:00
|
|
|
<!-- <hr /> -->
|
2022-03-20 00:27:45 +00:00
|
|
|
</v-card-text>
|
2022-03-22 04:45:15 +00:00
|
|
|
<!-- <v-bottom-sheet
|
2022-03-21 13:21:18 +00:00
|
|
|
v-model="showMore"
|
2022-03-25 19:21:00 +00:00
|
|
|
color="background"
|
2022-03-21 13:21:18 +00:00
|
|
|
style="z-index: 9999999"
|
|
|
|
>
|
|
|
|
<v-sheet style="padding: 1em">
|
|
|
|
<v-btn block @click="showMore = !showMore"
|
|
|
|
><v-icon>mdi-chevron-down</v-icon></v-btn
|
|
|
|
><br />
|
2022-03-20 13:32:28 +00:00
|
|
|
|
|
|
|
<div class="scroll-y">
|
2022-04-04 11:33:16 +00:00
|
|
|
{{ response.renderedData.description }}
|
2022-03-20 13:32:28 +00:00
|
|
|
</div>
|
2022-03-20 18:42:12 +00:00
|
|
|
</v-sheet>
|
2022-03-22 04:45:15 +00:00
|
|
|
</v-bottom-sheet> -->
|
2022-03-25 19:21:00 +00:00
|
|
|
<!-- <v-bottom-sheet v-model="share" color="background" style="z-index: 9999999">
|
2022-03-21 00:30:59 +00:00
|
|
|
<v-sheet style="padding: 1em">
|
2022-03-20 18:42:12 +00:00
|
|
|
<div class="scroll-y">
|
2022-04-04 11:33:16 +00:00
|
|
|
{{ response.renderedData.description }}
|
2022-03-20 18:42:12 +00:00
|
|
|
</div>
|
2022-03-20 13:17:26 +00:00
|
|
|
</v-sheet>
|
2022-03-21 13:21:18 +00:00
|
|
|
</v-bottom-sheet> -->
|
2022-03-19 06:18:07 +00:00
|
|
|
</v-card>
|
2022-04-04 11:33:16 +00:00
|
|
|
<v-divider />
|
|
|
|
|
|
|
|
<!-- Channel Bar -->
|
|
|
|
<v-card
|
|
|
|
class="channel-section background"
|
|
|
|
v-if="loaded"
|
|
|
|
:to="video.channelUrl"
|
|
|
|
>
|
|
|
|
<div id="details">
|
|
|
|
<div class="avatar-link mr-3">
|
|
|
|
<v-img class="avatar-thumbnail" :src="video.channelImg" />
|
|
|
|
</div>
|
|
|
|
<div class="channel-byline">
|
|
|
|
<div class="channel-name" v-text="video.channelName" />
|
|
|
|
<div
|
|
|
|
class="caption background--text"
|
|
|
|
:class="$vuetify.theme.dark ? 'text--lighten-4' : 'text--darken-4'"
|
|
|
|
v-text="video.channelSubs"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
class="channel-buttons"
|
|
|
|
style="color: rgb(204, 0, 0); text-transform: uppercase"
|
|
|
|
>
|
|
|
|
subscribe
|
|
|
|
</div>
|
|
|
|
</v-card>
|
|
|
|
<v-divider />
|
|
|
|
|
|
|
|
<!-- Comments -->
|
|
|
|
<!-- <v-card flat class="background comment-button" v-if="loaded">
|
|
|
|
<v-text
|
|
|
|
>{{ video.commentData.title }} •
|
|
|
|
{{ video.commentData.commentsCount }}</v-text
|
|
|
|
>
|
|
|
|
</v-card>
|
|
|
|
<v-divider /> -->
|
|
|
|
|
|
|
|
<!-- Description -->
|
|
|
|
<div v-if="showMore" class="scroll-y ml-4 mr-4">
|
|
|
|
<slim-video-description-renderer
|
|
|
|
:render="video.renderedData.description"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Related Videos -->
|
|
|
|
<div class="loaders" v-if="!loaded">
|
|
|
|
<v-skeleton-loader
|
|
|
|
type="list-item-two-line, actions, divider, list-item-avatar, divider, list-item-three-line"
|
|
|
|
/>
|
|
|
|
<vid-load-renderer :count="5" />
|
|
|
|
</div>
|
|
|
|
<item-section-renderer v-else :render="recommends" />
|
2022-02-24 22:29:34 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-03-22 05:47:28 +00:00
|
|
|
import { Share } from "@capacitor/share";
|
2022-03-24 20:46:17 +00:00
|
|
|
import VidLoadRenderer from "~/components/vidLoadRenderer.vue";
|
2022-04-01 13:04:52 +00:00
|
|
|
import { getCpn } from "~/plugins/utils";
|
2022-04-01 00:15:13 +00:00
|
|
|
import SlimVideoDescriptionRenderer from "~/components/UtilRenderers/slimVideoDescriptionRenderer.vue";
|
2022-04-04 11:33:16 +00:00
|
|
|
import ItemSectionRenderer from "~/components/SectionRenderers/itemSectionRenderer.vue";
|
2022-03-22 05:47:28 +00:00
|
|
|
|
2022-02-24 22:29:34 +00:00
|
|
|
export default {
|
2022-04-04 11:33:16 +00:00
|
|
|
components: {
|
|
|
|
VidLoadRenderer,
|
|
|
|
SlimVideoDescriptionRenderer,
|
|
|
|
ItemSectionRenderer,
|
|
|
|
},
|
2022-02-24 22:29:34 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2022-03-20 00:27:45 +00:00
|
|
|
interactions: [
|
2022-03-21 00:30:59 +00:00
|
|
|
{
|
|
|
|
name: "Likes",
|
2022-03-22 01:13:48 +00:00
|
|
|
icon: "mdi-thumb-up-outline",
|
2022-03-22 05:47:28 +00:00
|
|
|
// action: null,
|
2022-03-21 00:30:59 +00:00
|
|
|
value: this.likes,
|
|
|
|
disabled: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "Dislikes",
|
2022-03-22 01:13:48 +00:00
|
|
|
icon: "mdi-thumb-down-outline",
|
2022-03-22 05:47:28 +00:00
|
|
|
// action: this.dislike(),
|
|
|
|
actionName: "dislike",
|
2022-03-21 00:30:59 +00:00
|
|
|
value: this.dislikes,
|
|
|
|
disabled: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "Share",
|
2022-03-22 01:13:48 +00:00
|
|
|
icon: "mdi-share-outline",
|
2022-03-22 05:47:28 +00:00
|
|
|
// action: this.share(),
|
|
|
|
actionName: "share",
|
|
|
|
disabled: false,
|
2022-03-21 00:30:59 +00:00
|
|
|
},
|
2022-03-20 00:27:45 +00:00
|
|
|
],
|
2022-03-20 13:17:26 +00:00
|
|
|
showMore: false,
|
2022-03-22 05:47:28 +00:00
|
|
|
// share: false,
|
2022-03-20 00:27:45 +00:00
|
|
|
vidSrc: null,
|
2022-03-26 03:25:28 +00:00
|
|
|
sources: [],
|
2022-03-24 11:47:13 +00:00
|
|
|
recommends: null,
|
2022-03-22 07:48:04 +00:00
|
|
|
loaded: false,
|
2022-04-01 13:04:52 +00:00
|
|
|
interval: null,
|
2022-04-04 11:33:16 +00:00
|
|
|
video: null,
|
2022-03-20 07:24:38 +00:00
|
|
|
};
|
2022-03-13 23:21:41 +00:00
|
|
|
},
|
2022-03-25 03:25:51 +00:00
|
|
|
watch: {
|
|
|
|
// Watch for change in the route query string (in this case, ?v=xxxxxxxx to ?v=yyyyyyyy)
|
|
|
|
$route: {
|
|
|
|
deep: true,
|
|
|
|
handler(newRt, oldRt) {
|
|
|
|
if (newRt.query.v != oldRt.query.v) {
|
|
|
|
// Exit fullscreen if currently in fullscreen
|
2022-04-01 13:04:52 +00:00
|
|
|
// if (this.$refs.player) this.$refs.player.webkitExitFullscreen();
|
2022-03-25 03:25:51 +00:00
|
|
|
// Reset player and run getVideo function again
|
|
|
|
this.vidSrc = "";
|
2022-04-01 13:04:52 +00:00
|
|
|
this.startTime = Math.floor(Date.now() / 1000);
|
|
|
|
clearInterval(this.interval);
|
2022-03-25 03:25:51 +00:00
|
|
|
this.getVideo();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-03-13 23:21:41 +00:00
|
|
|
mounted() {
|
2022-04-01 13:04:52 +00:00
|
|
|
this.startTime = Math.floor(Date.now() / 1000);
|
2022-03-22 07:48:04 +00:00
|
|
|
this.getVideo();
|
|
|
|
},
|
2022-04-01 13:04:52 +00:00
|
|
|
|
|
|
|
destroyed() {
|
|
|
|
clearInterval(this.interval);
|
|
|
|
},
|
2022-03-22 07:48:04 +00:00
|
|
|
methods: {
|
|
|
|
getVideo() {
|
|
|
|
this.loaded = false;
|
2022-03-20 07:24:38 +00:00
|
|
|
|
2022-03-22 07:48:04 +00:00
|
|
|
this.$youtube.getVid(this.$route.query.v).then((result) => {
|
2022-04-04 11:33:16 +00:00
|
|
|
this.video = result;
|
2022-03-22 07:48:04 +00:00
|
|
|
console.log("Video info data", result);
|
|
|
|
console.log(result.availableResolutions);
|
2022-03-26 03:25:28 +00:00
|
|
|
|
|
|
|
//--- VueTube Player v1 ---//
|
|
|
|
this.sources = result.availableResolutions;
|
|
|
|
|
|
|
|
//--- Legacy Player ---//
|
2022-03-22 07:48:04 +00:00
|
|
|
this.vidSrc =
|
2022-03-23 11:21:06 +00:00
|
|
|
result.availableResolutions[
|
|
|
|
result.availableResolutions.length - 1
|
|
|
|
].url; // Takes the highest available resolution with both video and Audio. Note this will be lower than the actual highest resolution
|
2022-03-30 11:38:15 +00:00
|
|
|
|
2022-03-26 03:25:28 +00:00
|
|
|
//--- Content Stuff ---//
|
2022-03-22 07:48:04 +00:00
|
|
|
this.likes = result.metadata.likes.toLocaleString();
|
2022-03-29 02:47:30 +00:00
|
|
|
this.interactions[0].value = result.metadata.likes.toLocaleString();
|
2022-03-22 07:48:04 +00:00
|
|
|
this.loaded = true;
|
2022-03-23 11:21:06 +00:00
|
|
|
this.recommends = result.renderedData.recommendations;
|
2022-03-22 07:48:04 +00:00
|
|
|
// .catch((error) => this.$logger("Watch", error, true));
|
|
|
|
console.log("recommendations:", this.recommends);
|
2022-04-01 13:04:52 +00:00
|
|
|
|
|
|
|
//--- API WatchTime call ---//
|
|
|
|
this.playbackTracking = result.playbackTracking;
|
2022-04-02 06:11:52 +00:00
|
|
|
this.st = 0;
|
2022-04-01 13:04:52 +00:00
|
|
|
this.cpn = getCpn();
|
|
|
|
this.initWatchTime().then(() => {
|
|
|
|
this.sendWatchTime();
|
|
|
|
this.interval = setInterval(this.sendWatchTime, 30000);
|
|
|
|
});
|
2022-03-22 07:48:04 +00:00
|
|
|
});
|
2022-03-19 06:18:07 +00:00
|
|
|
|
2022-03-22 07:48:04 +00:00
|
|
|
this.$youtube.getReturnYoutubeDislike(this.$route.query.v, (data) => {
|
|
|
|
this.dislikes = data.dislikes.toLocaleString();
|
|
|
|
this.interactions[1].value = data.dislikes.toLocaleString();
|
|
|
|
});
|
|
|
|
},
|
2022-03-22 05:47:28 +00:00
|
|
|
callMethodByName(name) {
|
|
|
|
// Helper function needed because of issues when directly calling method
|
|
|
|
// using item.action in the v-for loop
|
|
|
|
this[name]();
|
|
|
|
},
|
2022-03-21 23:47:11 +00:00
|
|
|
dislike() {},
|
2022-03-22 05:47:28 +00:00
|
|
|
async share() {
|
|
|
|
// this.share = !this.share;
|
|
|
|
await Share.share({
|
2022-04-04 11:33:16 +00:00
|
|
|
title: this.video.title,
|
|
|
|
text: this.video.title,
|
2022-03-23 11:21:06 +00:00
|
|
|
url: "https://youtu.be/" + this.$route.query.v,
|
|
|
|
dialogTitle: "Share video",
|
2022-03-22 05:47:28 +00:00
|
|
|
});
|
2022-03-23 00:35:15 +00:00
|
|
|
},
|
2022-04-01 13:04:52 +00:00
|
|
|
sendWatchTime() {
|
|
|
|
const player = this.$refs.player.getPlayer();
|
2022-04-02 06:11:52 +00:00
|
|
|
const rt = Math.floor(Date.now() / 1000) - this.startTime;
|
|
|
|
const params = {
|
|
|
|
cpn: this.cpn,
|
|
|
|
rt: rt,
|
|
|
|
rti: rt,
|
|
|
|
rtn: rt,
|
|
|
|
cmt: player.currentTime,
|
|
|
|
et: player.currentTime,
|
|
|
|
st: this.st,
|
|
|
|
state: player.paused ? "paused" : "playing",
|
|
|
|
volume: 100,
|
|
|
|
muted: 0,
|
|
|
|
fmt: 396,
|
|
|
|
};
|
|
|
|
this.st = player.currentTime;
|
2022-04-01 13:04:52 +00:00
|
|
|
this.$youtube.saveApiStats(
|
2022-04-02 06:11:52 +00:00
|
|
|
params,
|
2022-04-01 13:04:52 +00:00
|
|
|
this.playbackTracking.videostatsWatchtimeUrl.baseUrl
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
async initWatchTime() {
|
|
|
|
await this.$youtube.saveApiStats(
|
|
|
|
{
|
|
|
|
cpn: this.cpn,
|
2022-04-02 06:11:52 +00:00
|
|
|
fmt: 243,
|
|
|
|
rtn: Math.floor(Date.now() / 1000) - this.startTime,
|
2022-04-01 13:04:52 +00:00
|
|
|
rt: Math.floor(Date.now() / 1000) - this.startTime,
|
2022-04-02 06:11:52 +00:00
|
|
|
fmt: 243,
|
|
|
|
muted: 0,
|
2022-04-01 13:04:52 +00:00
|
|
|
},
|
|
|
|
this.playbackTracking.videostatsPlaybackUrl.baseUrl
|
|
|
|
);
|
|
|
|
},
|
2022-03-21 23:47:11 +00:00
|
|
|
},
|
2022-03-20 07:24:38 +00:00
|
|
|
};
|
2022-02-24 22:29:34 +00:00
|
|
|
</script>
|
2022-03-30 11:38:15 +00:00
|
|
|
|
|
|
|
<style>
|
|
|
|
.vertical-button span.v-btn__content {
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: space-around;
|
|
|
|
}
|
2022-04-04 11:33:16 +00:00
|
|
|
|
|
|
|
.channel-section,
|
|
|
|
.comment-button {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 12px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.channel-section #details {
|
|
|
|
flex-grow: 1;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
min-width: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.channel-section .channel-byline {
|
|
|
|
min-width: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.channel-section .avatar-thumbnail {
|
|
|
|
border-radius: 50%;
|
|
|
|
width: 35px;
|
|
|
|
height: 35px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.channel-section .channel-name {
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
2022-03-30 11:38:15 +00:00
|
|
|
</style>
|