mirror of
https://github.com/VueTubeApp/VueTube
synced 2024-11-27 13:43:04 +00:00
Merge branch 'Frontesque-main'
This commit is contained in:
commit
610d808665
11 changed files with 276 additions and 23 deletions
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
|
@ -106,8 +106,11 @@ jobs:
|
||||||
CODE_SIGNING_REQUIRED=NO
|
CODE_SIGNING_REQUIRED=NO
|
||||||
CODE_SIGNING_ALLOWED="NO"
|
CODE_SIGNING_ALLOWED="NO"
|
||||||
CODE_SIGN_ENTITLEMENTS=""
|
CODE_SIGN_ENTITLEMENTS=""
|
||||||
|
- name: Make IPA
|
||||||
|
run: mkdir Payload && mv ~/Library/Developer/Xcode/DerivedData/App-*/Build/Products/Debug-iphoneos/App.app Payload && zip -r Payload.zip Payload && mv Payload.zip VueTube.ipa
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: iOS
|
name: iOS
|
||||||
path: ~/Library/Developer/Xcode/DerivedData/App-*/Build/Products/Debug-iphoneos/App.app
|
path: VueTube.ipa
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
<template>
|
||||||
|
<div class="description" style="white-space: pre-line">
|
||||||
|
<template v-for="(text, index) in render.description.runs">
|
||||||
|
<template
|
||||||
|
v-if="
|
||||||
|
text.navigationEndpoint && text.navigationEndpoint.webviewEndpoint
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a @click="openExternal(parseLinks(text))" :key="index" class="link">{{
|
||||||
|
text.text
|
||||||
|
}}</a>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="checkInternal(text)">
|
||||||
|
<a @click="openInternal(parseLinks(text))" :key="index" class="link">{{
|
||||||
|
text.text
|
||||||
|
}}</a>
|
||||||
|
</template>
|
||||||
|
<template v-else> {{ text.text }} </template>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { Browser } from "@capacitor/browser";
|
||||||
|
export default {
|
||||||
|
props: ["render"],
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
parseLinks(base) {
|
||||||
|
const navEndpoint = base.navigationEndpoint;
|
||||||
|
if (!navEndpoint) return;
|
||||||
|
if (navEndpoint.webviewEndpoint) {
|
||||||
|
return navEndpoint.webviewEndpoint.url;
|
||||||
|
} else if (navEndpoint.browseEndpoint) {
|
||||||
|
return navEndpoint.browseEndpoint.canonicalBaseUrl;
|
||||||
|
} else if (navEndpoint.watchEndpoint) {
|
||||||
|
return `/watch?v=${navEndpoint.watchEndpoint.videoId}`;
|
||||||
|
} else if (navEndpoint.navigationEndpoint) {
|
||||||
|
return; //for now
|
||||||
|
}
|
||||||
|
},
|
||||||
|
checkInternal(base) {
|
||||||
|
const navEndpoint = base.navigationEndpoint;
|
||||||
|
if (!navEndpoint) return false;
|
||||||
|
if (navEndpoint.browseEndpoint || navEndpoint.watchEndpoint) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async openExternal(url) {
|
||||||
|
await Browser.open({ url: url });
|
||||||
|
},
|
||||||
|
async openInternal(url) {
|
||||||
|
await this.$router.push(url);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
132
NUXT/components/VTPlayerV1.vue
Normal file
132
NUXT/components/VTPlayerV1.vue
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
|
||||||
|
<v-btn @click="playing = !playing" class="pausePlay" text><v-icon size="5em" color="white">mdi-{{playing ? 'pause' : 'play' }}</v-icon></v-btn>
|
||||||
|
|
||||||
|
<div class="seekBar">
|
||||||
|
<v-slider dense hide-details min="0" :max="videoEnd" :value="currentTime" @change="scrubTo(value)" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<video
|
||||||
|
autoplay
|
||||||
|
:src="vidSrc"
|
||||||
|
width="100%"
|
||||||
|
@webkitfullscreenchange="handleFullscreenChange"
|
||||||
|
ref="player"
|
||||||
|
style="max-height: 50vh"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-for="(source, index) in sources" :key="index">
|
||||||
|
{{ source.qualityLabel }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
sources: {
|
||||||
|
type: Array,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
//--- Basic Information ---//
|
||||||
|
playerVersion: 0.1,
|
||||||
|
vidSrc: null,
|
||||||
|
|
||||||
|
//--- Player State Information ---//
|
||||||
|
playing: true,
|
||||||
|
currentTime: 0,
|
||||||
|
videoEnd: 0,
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
playing() {
|
||||||
|
this.playing
|
||||||
|
? this.$refs.player.play()
|
||||||
|
: this.$refs.player.pause()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
handleFullscreenChange() {
|
||||||
|
if (document.fullscreenElement === this.$refs.player) {
|
||||||
|
this.$vuetube.statusBar.hide();
|
||||||
|
this.$vuetube.navigationBar.hide();
|
||||||
|
} else {
|
||||||
|
this.$vuetube.statusBar.show();
|
||||||
|
this.$vuetube.navigationBar.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
scrubTo(val) {
|
||||||
|
const player = this.$refs.player;
|
||||||
|
player.currentTime = val;
|
||||||
|
console.log(val, this.currentTime, player.currentTime)
|
||||||
|
},
|
||||||
|
|
||||||
|
updateTiming() {
|
||||||
|
const player = this.$refs.player;
|
||||||
|
this.videoEnd = player?.duration;
|
||||||
|
this.currentTime = player?.currentTime;
|
||||||
|
console.log(player.currentTime, this.currentTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
const src = this.sources[this.sources.length-1].url;
|
||||||
|
this.vidSrc = src;
|
||||||
|
|
||||||
|
setInterval(this.updateTiming, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/*** Overlay Information ***/
|
||||||
|
.content {
|
||||||
|
position: relative;
|
||||||
|
width: 500px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
.content video {
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.content:before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** General Overlay Styling ***/
|
||||||
|
.pausePlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
.seekBar {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -137,9 +137,5 @@ export default {
|
||||||
return bottomText.join(" · ");
|
return bottomText.join(" · ");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
|
||||||
console.log("gridVideoRenderer received: ", this.video);
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -128,6 +128,7 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
textChanged(text) {
|
textChanged(text) {
|
||||||
|
if (text.length <= 0) this.response = []; // No text found, no point in calling API
|
||||||
this.$youtube.autoComplete(text, (res) => {
|
this.$youtube.autoComplete(text, (res) => {
|
||||||
const data = res.replace(/^.*?\(/, "").replace(/\)$/, ""); //Format Response
|
const data = res.replace(/^.*?\(/, "").replace(/\)$/, ""); //Format Response
|
||||||
this.response = JSON.parse(data)[1];
|
this.response = JSON.parse(data)[1];
|
||||||
|
|
|
@ -32,7 +32,7 @@ export default {
|
||||||
// The following code is only a demo for debugging purposes, note that each "shelfRenderer" has a "title" value that seems to align to the categories at the top of the vanilla yt app
|
// The following code is only a demo for debugging purposes, note that each "shelfRenderer" has a "title" value that seems to align to the categories at the top of the vanilla yt app
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
if (!this.recommends.length) {
|
if (!this.recommends.items || !this.recommends.items.length) {
|
||||||
this.$youtube
|
this.$youtube
|
||||||
.recommend()
|
.recommend()
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="background">
|
<div class="background">
|
||||||
<videoPlayer :vid-src="vidSrc" />
|
|
||||||
|
<!-- Stock Player -->
|
||||||
|
<videoPlayer :vidSrc="vidSrc" />
|
||||||
|
|
||||||
|
<!-- VueTube Player V1 -->
|
||||||
|
<!-- <VTPlayerV1 :sources="sources" v-if="sources.length > 0" />-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<v-card v-if="loaded" class="ml-2 mr-2 background" flat>
|
<v-card v-if="loaded" class="ml-2 mr-2 background" flat>
|
||||||
<v-card-title
|
<v-card-title
|
||||||
class="mt-2"
|
class="mt-2"
|
||||||
|
@ -52,7 +60,7 @@
|
||||||
<p>Channel Stuff</p>
|
<p>Channel Stuff</p>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<div v-if="showMore" class="scroll-y ml-2 mr-2">
|
<div v-if="showMore" class="scroll-y ml-2 mr-2">
|
||||||
{{ description }}
|
<slim-video-description-renderer :render="description">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <v-bottom-sheet
|
<!-- <v-bottom-sheet
|
||||||
|
@ -94,9 +102,10 @@
|
||||||
import { Share } from "@capacitor/share";
|
import { Share } from "@capacitor/share";
|
||||||
import ShelfRenderer from "~/components/SectionRenderers/shelfRenderer.vue";
|
import ShelfRenderer from "~/components/SectionRenderers/shelfRenderer.vue";
|
||||||
import VidLoadRenderer from "~/components/vidLoadRenderer.vue";
|
import VidLoadRenderer from "~/components/vidLoadRenderer.vue";
|
||||||
|
import SlimVideoDescriptionRenderer from '../components/UtilRenderers/slimVideoDescriptionRenderer.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { ShelfRenderer, VidLoadRenderer },
|
components: { ShelfRenderer, VidLoadRenderer, SlimVideoDescriptionRenderer },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
interactions: [
|
interactions: [
|
||||||
|
@ -128,6 +137,7 @@ export default {
|
||||||
title: null,
|
title: null,
|
||||||
uploaded: null,
|
uploaded: null,
|
||||||
vidSrc: null,
|
vidSrc: null,
|
||||||
|
sources: [],
|
||||||
description: null,
|
description: null,
|
||||||
views: null,
|
views: null,
|
||||||
recommends: null,
|
recommends: null,
|
||||||
|
@ -141,7 +151,7 @@ export default {
|
||||||
handler(newRt, oldRt) {
|
handler(newRt, oldRt) {
|
||||||
if (newRt.query.v != oldRt.query.v) {
|
if (newRt.query.v != oldRt.query.v) {
|
||||||
// Exit fullscreen if currently in fullscreen
|
// Exit fullscreen if currently in fullscreen
|
||||||
this.$refs.player.webkitExitFullscreen();
|
if (this.$refs.player) this.$refs.player.webkitExitFullscreen();
|
||||||
// Reset player and run getVideo function again
|
// Reset player and run getVideo function again
|
||||||
this.vidSrc = "";
|
this.vidSrc = "";
|
||||||
this.getVideo();
|
this.getVideo();
|
||||||
|
@ -160,12 +170,19 @@ export default {
|
||||||
this.$youtube.getVid(this.$route.query.v).then((result) => {
|
this.$youtube.getVid(this.$route.query.v).then((result) => {
|
||||||
console.log("Video info data", result);
|
console.log("Video info data", result);
|
||||||
console.log(result.availableResolutions);
|
console.log(result.availableResolutions);
|
||||||
|
|
||||||
|
//--- VueTube Player v1 ---//
|
||||||
|
this.sources = result.availableResolutions;
|
||||||
|
|
||||||
|
//--- Legacy Player ---//
|
||||||
this.vidSrc =
|
this.vidSrc =
|
||||||
result.availableResolutions[
|
result.availableResolutions[
|
||||||
result.availableResolutions.length - 1
|
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
|
].url; // Takes the highest available resolution with both video and Audio. Note this will be lower than the actual highest resolution
|
||||||
|
|
||||||
|
//--- Content Stuff ---//
|
||||||
this.title = result.title;
|
this.title = result.title;
|
||||||
this.description = result.metadata.description; // While this works, I do recommend using the rendered description instead in the future as there are some things a pure string wouldn't work with
|
this.description = result.renderedData.description; // While this works, I do recommend using the rendered description instead in the future as there are some things a pure string wouldn't work with
|
||||||
this.views = result.metadata.viewCount.toLocaleString();
|
this.views = result.metadata.viewCount.toLocaleString();
|
||||||
this.likes = result.metadata.likes.toLocaleString();
|
this.likes = result.metadata.likes.toLocaleString();
|
||||||
this.uploaded = result.metadata.uploadDate;
|
this.uploaded = result.metadata.uploadDate;
|
||||||
|
|
21
NUXT/pages/watch_debug.vue
Normal file
21
NUXT/pages/watch_debug.vue
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<template>
|
||||||
|
<div class="accent">
|
||||||
|
|
||||||
|
<VTPlayerV1 :sources="sources" v-if="sources.length > 0" />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
sources: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.sources = [{"itag":17,"url":"https://api.celeste.photos/squish.mp4","mimeType":"video/3gpp; codecs=\"mp4v.20.3, mp4a.40.2\"","bitrate":86688,"width":176,"height":144,"lastModified":"1645932929087816","contentLength":"159084","quality":"small","fps":12,"qualityLabel":"144p","projectionType":"RECTANGULAR","averageBitrate":85910,"audioQuality":"AUDIO_QUALITY_LOW","approxDurationMs":"14814","audioSampleRate":"22050","audioChannels":1}]
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -19,7 +19,6 @@ const ytApiVal = {
|
||||||
module.exports = {
|
module.exports = {
|
||||||
URLS: url,
|
URLS: url,
|
||||||
YT_API_VALUES: ytApiVal,
|
YT_API_VALUES: ytApiVal,
|
||||||
|
|
||||||
LOGGER_NAMES: {
|
LOGGER_NAMES: {
|
||||||
search: "Search",
|
search: "Search",
|
||||||
autoComplete: "AutoComplete",
|
autoComplete: "AutoComplete",
|
||||||
|
|
|
@ -181,9 +181,11 @@ class Innertube {
|
||||||
response.data.output?.playabilityStatus?.status == ("ERROR" || undefined)
|
response.data.output?.playabilityStatus?.status == ("ERROR" || undefined)
|
||||||
)
|
)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Could not get information for video: ${response.status_code ||
|
`Could not get information for video: ${
|
||||||
|
response.status_code ||
|
||||||
response.data.output?.playabilityStatus?.status
|
response.data.output?.playabilityStatus?.status
|
||||||
} - ${response.message || response.data.output?.playabilityStatus?.reason
|
} - ${
|
||||||
|
response.message || response.data.output?.playabilityStatus?.reason
|
||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
const responseInfo = response.data.output;
|
const responseInfo = response.data.output;
|
||||||
|
@ -241,7 +243,7 @@ class Innertube {
|
||||||
.find((contents) => contents.slimVideoMetadataSectionRenderer)
|
.find((contents) => contents.slimVideoMetadataSectionRenderer)
|
||||||
.slimVideoMetadataSectionRenderer?.contents.find(
|
.slimVideoMetadataSectionRenderer?.contents.find(
|
||||||
(contents) => contents.slimVideoDescriptionRenderer
|
(contents) => contents.slimVideoDescriptionRenderer
|
||||||
)?.slimVideoDescriptionRenderer.description.runs,
|
)?.slimVideoDescriptionRenderer,
|
||||||
recommendations: columnUI?.contents.find(
|
recommendations: columnUI?.contents.find(
|
||||||
(contents) => contents.shelfRenderer
|
(contents) => contents.shelfRenderer
|
||||||
).shelfRenderer,
|
).shelfRenderer,
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { Http } from "@capacitor-community/http";
|
||||||
import Innertube from "./innertube";
|
import Innertube from "./innertube";
|
||||||
import constants from "./constants";
|
import constants from "./constants";
|
||||||
import useRender from "./renderers";
|
import useRender from "./renderers";
|
||||||
|
import { Buffer } from "buffer";
|
||||||
|
|
||||||
//--- Logger Function ---//
|
//--- Logger Function ---//
|
||||||
function logger(func, data, isError = false) {
|
function logger(func, data, isError = false) {
|
||||||
|
@ -14,19 +15,39 @@ function logger(func, data, isError = false) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getEncoding(contentType) {
|
||||||
|
const re = /charset=([^()<>@,;:\"/[\]?.=\s]*)/i;
|
||||||
|
const content = re.exec(contentType);
|
||||||
|
console.log(content);
|
||||||
|
if (!content || content[1].toLowerCase() == "utf-8") {
|
||||||
|
return "utf8";
|
||||||
|
}
|
||||||
|
if (content[1].toLowerCase() == "iso-8859-1") {
|
||||||
|
return "latin1";
|
||||||
|
}
|
||||||
|
if (content[1].toLowerCase() == "utf16le") {
|
||||||
|
return "utf16le";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const searchModule = {
|
const searchModule = {
|
||||||
logs: new Array(),
|
logs: new Array(),
|
||||||
|
|
||||||
//--- Get YouTube's Search Auto Complete ---//
|
//--- Get YouTube's Search Auto Complete ---//
|
||||||
autoComplete(text, callback) {
|
autoComplete(text, callback) {
|
||||||
Http.request({
|
Http.get({
|
||||||
method: "GET",
|
url: `${constants.URLS.YT_SUGGESTIONS}/search?q=${encodeURIComponent(
|
||||||
url: `${constants.URLS.YT_SUGGESTIONS}/search`,
|
text
|
||||||
params: { client: "youtube", q: text },
|
)}&client=youtube&ds=yt`,
|
||||||
|
responseType: "arraybuffer",
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
logger(constants.LOGGER_NAMES.autoComplete, res);
|
const contentType = res.headers["Content-Type"];
|
||||||
callback(res.data);
|
// make a new buffer object from res.data
|
||||||
|
const buffer = Buffer.from(res.data, "base64");
|
||||||
|
// convert res.data from iso-8859-1 to utf-8
|
||||||
|
const data = buffer.toString(getEncoding(contentType));
|
||||||
|
logger(constants.LOGGER_NAMES.autoComplete, data);
|
||||||
|
callback(data);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
logger(constants.LOGGER_NAMES.autoComplete, err, true);
|
logger(constants.LOGGER_NAMES.autoComplete, err, true);
|
||||||
|
|
Loading…
Reference in a new issue