Browse Source

Pause local station when you open editsong modal from station page

Kristian Vos 3 years ago
parent
commit
1014239035
1 changed files with 17 additions and 1 deletions
  1. 17 1
      frontend/src/pages/Station/index.vue

+ 17 - 1
frontend/src/pages/Station/index.vue

@@ -692,7 +692,9 @@ export default {
 			activityWatchVideoLastStatus: "",
 			activityWatchVideoLastYouTubeId: "",
 			activityWatchVideoLastStartDuration: "",
-			nextCurrentSong: null
+			nextCurrentSong: null,
+			editSongModalWatcher: null,
+			beforeEditSongModalLocalPaused: null
 		};
 	},
 	computed: {
@@ -723,6 +725,18 @@ export default {
 		})
 	},
 	async mounted() {
+		this.editSongModalWatcher = this.$store.watch(
+			state => state.modalVisibility.modals.editSong,
+			newValue => {
+				if (newValue === true) {
+					this.beforeEditSongModalLocalPaused = this.localPaused;
+					this.pauseLocalStation();
+				} else if (!this.beforeEditSongModalLocalPaused) {
+					this.resumeLocalStation();
+				}
+			}
+		);
+
 		window.scrollTo(0, 0);
 
 		Date.currently = () => {
@@ -993,6 +1007,8 @@ export default {
 			keyboardShortcuts.unregisterShortcut(shortcutName);
 		});
 
+		this.editSongModalWatcher(); // removes the watcher
+
 		clearInterval(this.activityWatchVideoDataInterval);
 		clearTimeout(window.stationNextSongTimeout);