Procházet zdrojové kódy

refactor(EditSong): Set player to play if not already on seekTo

Owen Diffey před 3 roky
rodič
revize
096f6f44d8

+ 6 - 5
frontend/src/components/modals/EditSong/index.vue

@@ -1136,9 +1136,7 @@ export default {
 									this.video.player.getCurrentTime() <
 									this.song.skipDuration
 								) {
-									return this.video.player.seekTo(
-										this.song.skipDuration
-									);
+									return this.seekTo(this.song.skipDuration);
 								}
 							} else if (event.data === 2) {
 								this.video.paused = true;
@@ -1522,8 +1520,7 @@ export default {
 					break;
 				case "skipToLast10Secs":
 					this.skipToLast10SecsPressed = true;
-					if (this.video.paused) this.pauseVideo(false);
-					this.video.player.seekTo(
+					this.seekTo(
 						this.song.duration - 10 + this.song.skipDuration
 					);
 					break;
@@ -1541,6 +1538,10 @@ export default {
 			}
 			this.settings("play");
 		},
+		seekTo(position) {
+			if (!this.video.paused) this.settings("play");
+			this.video.player.seekTo(position);
+		},
 		changeVolume() {
 			const volume = this.volumeSliderValue;
 			localStorage.setItem("volume", volume / 100);