VueTube/NUXT/pages/watch.vue

97 lines
2.5 KiB
Vue
Raw Normal View History

2022-02-24 22:29:34 +00:00
<template>
<div>
<video controls autoplay :src="vidSrc" width="100%" height="300vh" />
<v-card class="ml-2 mr-2 flat light" flat>
<v-card-title style="padding-top: 0;">{{ title }}</v-card-title>
<v-card-text>
<span>{{ views }} views {{uploaded}}</span><br />
<!-- Scrolling Div For Interactions --->
<div style="display: flex;">
<v-list-item v-for="(item, index) in interactions" :key="index">
<button class="vertical-button" style="padding: 0; margin: 0;" elevation=0 :disabled="item.disabled">
<v-icon v-text="item.icon" />
<div v-text="item.value || item.name" />
</button>
</v-list-item>
</div>
<!-- End Scrolling Div For Interactions --->
</v-card-text>
2022-03-19 06:18:07 +00:00
<p>{{ description }}</p>
</v-card>
<recommended />
2022-02-24 22:29:34 +00:00
</div>
</template>
<style>
.vertical-button span.v-btn__content {
flex-direction: column;
justify-content: space-around;
}
</style>
2022-02-24 22:29:34 +00:00
<script>
import recommended from '../components/recommended.vue';
2022-02-24 22:29:34 +00:00
export default {
components: { recommended },
2022-02-24 22:29:34 +00:00
data() {
return {
interactions: [
{ name: "Likes", icon: "mdi-thumb-up", action: null, value: this.likes, disabled: true },
{ name: "Dislikes", icon: "mdi-thumb-down", action: null, value: this.dislikes, disabled: true },
{ name: "Share", icon: "mdi-share", action: null, disabled: true },
],
title: null,
likes: 100,
dislikes: null,
uploaded: null,
vidSrc: null,
description: null,
views: null,
2022-02-24 22:29:34 +00:00
}
2022-03-13 23:21:41 +00:00
},
mounted() {
2022-03-19 19:49:28 +00:00
this.likes = 100
2022-03-19 06:18:07 +00:00
this.$youtube.getVid(this.$route.query.v).then(result => {
2022-03-19 19:39:07 +00:00
console.log('Video info data', result)
2022-03-19 06:18:07 +00:00
result = result.data;
console.log(result.streamingData.formats)
this.vidSrc = result.streamingData.formats[result.streamingData.formats.length-1].url
this.title = result.videoDetails.title
this.description = result.videoDetails.shortDescription;
2022-03-20 00:10:18 +00:00
this.views = result.videoDetails.viewCount.toLocaleString();
2022-03-19 06:18:07 +00:00
});
this.$youtube.getRemainingVideoInfo(this.$route.query.v, (data) => {
2022-03-20 00:10:18 +00:00
this.likes = data.likes.toLocaleString();
2022-03-19 06:18:07 +00:00
this.uploaded = data.uploadDate;
this.interactions[0].value = data.likes;
2022-03-19 06:18:07 +00:00
});
this.$youtube.getReturnYoutubeDislike(this.$route.query.v, (data) => {
2022-03-20 00:43:55 +00:00
2022-03-20 00:10:18 +00:00
this.dislikes = data.dislikes.toLocaleString();
2022-03-20 00:43:55 +00:00
this.interactions[1].value = data.dislikes.toLocaleString();
2022-03-19 06:18:07 +00:00
});
2022-02-24 22:29:34 +00:00
}
}
</script>