Browse Source

fix(mobile): ios devices will forcibly pause playback locally

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan 3 years ago
parent
commit
65fa3c1579
1 changed files with 11 additions and 4 deletions
  1. 11 4
      frontend/src/pages/Station/index.vue

+ 11 - 4
frontend/src/pages/Station/index.vue

@@ -723,9 +723,8 @@ export default {
 				if (newValue === true) {
 					this.beforeEditSongModalLocalPaused = this.localPaused;
 					this.pauseLocalStation();
-				} else if (!this.beforeEditSongModalLocalPaused) {
+				} else if (!this.beforeEditSongModalLocalPaused)
 					this.resumeLocalStation();
-				}
 			}
 		);
 
@@ -1198,6 +1197,14 @@ export default {
 							}
 						},
 						onStateChange: event => {
+							// on ios, playback will be paused locally by default
+							if (
+								event.data === window.YT.PlayerState.PAUSED &&
+								!this.localPaused &&
+								this.isIOS
+							)
+								this.localPaused = true;
+
 							if (
 								event.data === window.YT.PlayerState.PLAYING &&
 								this.videoLoading === true
@@ -1223,9 +1230,9 @@ export default {
 							} else if (
 								event.data === window.YT.PlayerState.PLAYING &&
 								this.seeking === true
-							) {
+							)
 								this.seeking = false;
-							}
+
 							if (
 								event.data === window.YT.PlayerState.PAUSED &&
 								!this.localPaused &&