Skip to content

Commit

Permalink
fix: Canceling video downloading from url if user changed quality (se…
Browse files Browse the repository at this point in the history
…lected another video url) or leave from the player page. Removed mimeType option from video tag.
  • Loading branch information
pixkk committed Dec 15, 2024
1 parent 62dd4b5 commit 30b5029
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions NUXT/components/Player/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -558,13 +558,14 @@ export default {
}
this.vidSrc = this.sources[indexOfPreferredQuality].url;
this.$refs.player.type = this.sources[indexOfPreferredQuality].mimeType;
// console.warn(this.vidSrc);
// this.$refs.player.type = this.sources[indexOfPreferredQuality].mimeType;
// this.prebuffer(this.sources[indexOfPreferredQuality].url);
this.sources.forEach((source) => {
if (source.mimeType.indexOf("audio") > -1 && !this.audSrc) {
this.audSrc = source.url;
this.$refs.audio.type = source.mimeType;
// this.audSrc = source.url;
// this.$refs.audio.type = source.mimeType;
}
});
Expand Down Expand Up @@ -780,6 +781,10 @@ export default {
if (this.xhr) this.xhr.abort();
if (this.isFullscreen) this.exitFullscreen();
if (this.bufferingDetected) clearTimeout(this.bufferingDetected);
this.$refs.player.pause();
this.$refs.player.src = '';
this.$refs.player.load();
// screen.orientation.removeEventListener("change");
this.$refs.player.removeEventListener("loadeddata", this.loadedDataEvent);
this.$refs.player.removeEventListener("timeupdate", this.timeUpdateEvent);
Expand Down Expand Up @@ -860,6 +865,9 @@ export default {
}, 250);
},
qualityHandler(q) {
this.$refs.player.pause();
this.$refs.player.src = '';
this.$refs.player.load();
console.log(q);
let time = this.$refs.player.currentTime;
let speed = this.$refs.player.playbackRate;
Expand Down

0 comments on commit 30b5029

Please sign in to comment.