mirror of
https://github.com/VueTubeApp/VueTube
synced 2025-01-06 23:51:13 +00:00
cleanup undo
This commit is contained in:
parent
47dc607d28
commit
c0671d923a
2 changed files with 9 additions and 18 deletions
|
@ -405,14 +405,6 @@ export default {
|
||||||
isMusic: false,
|
isMusic: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
$route: {
|
|
||||||
deep: true,
|
|
||||||
handler() {
|
|
||||||
this.cleanup();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log("sources", this.sources);
|
console.log("sources", this.sources);
|
||||||
console.log("recommends", this.recommends);
|
console.log("recommends", this.recommends);
|
||||||
|
@ -481,8 +473,8 @@ export default {
|
||||||
) {
|
) {
|
||||||
console.log("Skipping the sponsor");
|
console.log("Skipping the sponsor");
|
||||||
this.$youtube.showToast("Skipped sponsor");
|
this.$youtube.showToast("Skipped sponsor");
|
||||||
vid.currentTime = sponsor.segment[1] + 1;
|
this.$refs.player.currentTime = sponsor.segment[1] + 1;
|
||||||
this.$refs.audio.currentTime = vid.currentTime;
|
this.$refs.audio.currentTime = this.$refs.player.currentTime;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -494,7 +486,7 @@ export default {
|
||||||
clearTimeout(this.bufferingDetected);
|
clearTimeout(this.bufferingDetected);
|
||||||
this.bufferingDetected = false;
|
this.bufferingDetected = false;
|
||||||
}
|
}
|
||||||
if (this.$refs.audio.paused && !vid.paused) this.$refs.audio.play();
|
if (this.$refs.audio.paused && !this.$refs.player.paused) this.$refs.audio.play();
|
||||||
this.buffered = (vid.buffered.end(0) / vid.duration) * 100;
|
this.buffered = (vid.buffered.end(0) / vid.duration) * 100;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -502,7 +494,7 @@ export default {
|
||||||
let threshold = 250; //ms after which user perceives buffering
|
let threshold = 250; //ms after which user perceives buffering
|
||||||
|
|
||||||
this.$refs.player.addEventListener("waiting", () => {
|
this.$refs.player.addEventListener("waiting", () => {
|
||||||
if (!vid.paused) {
|
if (!this.$refs.player.paused) {
|
||||||
this.bufferingDetected = setTimeout(() => {
|
this.bufferingDetected = setTimeout(() => {
|
||||||
this.bufferingDetected = true;
|
this.bufferingDetected = true;
|
||||||
this.$refs.audio.pause();
|
this.$refs.audio.pause();
|
||||||
|
@ -535,11 +527,11 @@ export default {
|
||||||
if (this.isFullscreen) this.exitFullscreen();
|
if (this.isFullscreen) this.exitFullscreen();
|
||||||
if (this.bufferingDetected) clearTimeout(this.bufferingDetected);
|
if (this.bufferingDetected) clearTimeout(this.bufferingDetected);
|
||||||
screen.orientation.removeEventListener("change");
|
screen.orientation.removeEventListener("change");
|
||||||
this.$refs.player.removeEventListener("loadeddata");
|
//! this.$refs.player.removeEventListener("loadeddata"); // NOTE: needs a function to be passed as the 2nd argument, but breaks if called with vue method as the 2nd argument in mounted()
|
||||||
this.$refs.player.removeEventListener("timeupdate");
|
// this.$refs.player.removeEventListener("timeupdate");
|
||||||
this.$refs.player.removeEventListener("progress");
|
this.$refs.player.removeEventListener("progress", () => {});
|
||||||
this.$refs.player.removeEventListener("waiting");
|
this.$refs.player.removeEventListener("waiting", () => {});
|
||||||
this.$refs.player.removeEventListener("playing");
|
this.$refs.player.removeEventListener("playing", () => {});
|
||||||
},
|
},
|
||||||
prebuffer(url) {
|
prebuffer(url) {
|
||||||
this.xhr = new XMLHttpRequest();
|
this.xhr = new XMLHttpRequest();
|
||||||
|
|
|
@ -317,7 +317,6 @@ export default {
|
||||||
$route: {
|
$route: {
|
||||||
deep: true,
|
deep: true,
|
||||||
handler(newRt, oldRt) {
|
handler(newRt, oldRt) {
|
||||||
this.$refs.player.cleanup();
|
|
||||||
if (newRt.query.v && newRt.query.v != oldRt.query.v) {
|
if (newRt.query.v && newRt.query.v != oldRt.query.v) {
|
||||||
// Exit fullscreen if currently in fullscreen
|
// Exit fullscreen if currently in fullscreen
|
||||||
// if (this.$refs.player) this.$refs.player.webkitExitFullscreen();
|
// if (this.$refs.player) this.$refs.player.webkitExitFullscreen();
|
||||||
|
|
Loading…
Reference in a new issue