From a7c862f3c77242c8fcb0d5ac5490dd0b3561a8ce Mon Sep 17 00:00:00 2001 From: Nikita Krupin Date: Sun, 22 May 2022 01:28:13 -0400 Subject: [PATCH] srub-a-dub-dub --- NUXT/components/Player/legacy.vue | 119 ++++++++++++++++++++---------- 1 file changed, 82 insertions(+), 37 deletions(-) diff --git a/NUXT/components/Player/legacy.vue b/NUXT/components/Player/legacy.vue index 723709b..35b1ada 100644 --- a/NUXT/components/Player/legacy.vue +++ b/NUXT/components/Player/legacy.vue @@ -1,7 +1,7 @@ @@ -146,6 +168,7 @@ export default { props: ["vidSrc"], data() { return { + scrubbing: false, percent: 0, progress: 0, buffered: 0, @@ -157,22 +180,44 @@ export default { mounted() { let vid = this.$refs.player; vid.addEventListener("loadeddata", (e) => { + console.log("%c loadeddata", "color: #00ff00"); + console.log(e); //Video should now be loaded but we can add a second check if (vid.readyState >= 3) { vid.ontimeupdate = () => { + console.log("%c timeupdate", "color: #aaaaff"); this.duration = vid.duration; - this.progress = vid.currentTime; + if (!this.scrubbing) this.progress = vid.currentTime; this.percent = (vid.currentTime / vid.duration) * 100; this.watched = this.$vuetube.humanTime(vid.currentTime); this.total = this.$vuetube.humanTime(vid.duration); }; - vid.addEventListener("progress", () => { + vid.onprogress = () => { + console.log("%c progress", "color: #ff00ff"); this.buffered = (vid.buffered.end(0) / vid.duration) * 100; - }); + }; } }); }, methods: { + seek(e) { + console.log(`scrubbing ${e}`); + let vid = this.$refs.playerfake; + let canvas = this.$refs.preview; + this.$refs.playerfake.currentTime = e; + canvas + .getContext("2d") + .drawImage( + vid, + 0, + 0, + this.$refs.player.clientWidth / 4, + this.$refs.player.clientHeight / 4 + ); + }, + scrub(e) { + this.$refs.player.currentTime = e; + }, handleFullscreenChange() { if (document.fullscreenElement === this.$refs.player) { this.$vuetube.statusBar.hide();