Browse Source

feat(EditSong): added back ability to hard stop a video

Kristian Vos 3 years ago
parent
commit
39efdcaa8b

+ 21 - 2
frontend/src/components/modals/EditSong/index.vue

@@ -79,8 +79,10 @@
 									</button>
 									<button
 										class="button is-danger"
-										@click="settings('stop')"
-										@keyup.enter="settings('stop')"
+										@click.exact="settings('stop')"
+										@click.shift="settings('hardStop')"
+										@keyup.enter.exact="settings('stop')"
+										@keyup.shift.enter="settings('hardStop')"
 										content="Stop Playback"
 										v-tippy
 									>
@@ -837,6 +839,16 @@ export default {
 			}
 		});
 
+		keyboardShortcuts.registerShortcut("editSong.hardStopVideo", {
+			keyCode: 101,
+			ctrl: true,
+			shift: true,
+			preventDefault: true,
+			handler: () => {
+				this.settings("hardStop");
+			}
+		});
+
 		keyboardShortcuts.registerShortcut("editSong.skipToLast10Secs", {
 			keyCode: 102,
 			preventDefault: true,
@@ -951,6 +963,7 @@ export default {
 
 		editSong.pauseResume - Num 5 - Pause/resume song
 		editSong.stopVideo - Ctrl - Num 5 - Stop
+		editSong.hardStopVideo - Shift - Ctrl - Num 5 - Stop
 		editSong.skipToLast10Secs - Num 6 - Skip to last 10 seconds
 
 		editSong.lowerVolumeLarge - Num 2 - Volume down by 10
@@ -983,6 +996,7 @@ export default {
 		const shortcutNames = [
 			"editSong.pauseResume",
 			"editSong.stopVideo",
+			"editSong.hardStopVideo",
 			"editSong.skipToLast10Secs",
 			"editSong.lowerVolumeLarge",
 			"editSong.lowerVolumeSmall",
@@ -1539,6 +1553,10 @@ export default {
 					this.stopVideo();
 					this.pauseVideo(true);
 					break;
+				case "hardStop":
+					this.hardStopVideo();
+					this.pauseVideo(true);
+					break;
 				case "pause":
 					this.pauseVideo(true);
 					break;
@@ -1804,6 +1822,7 @@ export default {
 		}),
 		...mapActions("modals/editSong", [
 			"stopVideo",
+			"hardStopVideo",
 			"loadVideoById",
 			"pauseVideo",
 			"getCurrentTime",

+ 6 - 0
frontend/src/store/modules/modals/editSong.js

@@ -27,6 +27,7 @@ export default {
 			commit("updateOriginalSong", song),
 		resetSong: ({ commit }, songId) => commit("resetSong", songId),
 		stopVideo: ({ commit }) => commit("stopVideo"),
+		hardStopVideo: ({ commit }) => commit("hardStopVideo"),
 		loadVideoById: ({ commit }, id, skipDuration) =>
 			commit("loadVideoById", id, skipDuration),
 		pauseVideo: ({ commit }, status) => commit("pauseVideo", status),
@@ -80,6 +81,11 @@ export default {
 				state.video.player.seekTo(0);
 			}
 		},
+		hardStopVideo(state) {
+			if (state.video.player && state.video.player.stopVideo) {
+				state.video.player.stopVideo();
+			}
+		},
 		loadVideoById(state, id, skipDuration) {
 			state.song.duration = -1;
 			state.video.player.loadVideoById(id, skipDuration);