From 8bd0e863ae4a82a245b87798fd0b76582bdf23b1 Mon Sep 17 00:00:00 2001 From: advplyr Date: Mon, 22 Aug 2022 17:18:46 -0500 Subject: [PATCH] Fix:iOS audio player in landscape mode --- components/app/AudioPlayer.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/app/AudioPlayer.vue b/components/app/AudioPlayer.vue index 4feb98b3..36eba3f7 100644 --- a/components/app/AudioPlayer.vue +++ b/components/app/AudioPlayer.vue @@ -772,8 +772,12 @@ export default { mounted() { this.updateScreenSize() if (screen.orientation) { + // Not available on ios screen.orientation.addEventListener('change', this.screenOrientationChange) + } else { + document.addEventListener('orientationchange', this.screenOrientationChange) } + window.addEventListener('resize', this.screenOrientationChange) this.$eventBus.$on('minimize-player', this.minimizePlayerEvt) document.body.addEventListener('touchstart', this.touchstart) @@ -783,8 +787,12 @@ export default { }, beforeDestroy() { if (screen.orientation) { + // Not available on ios screen.orientation.removeEventListener('change', this.screenOrientationChange) + } else { + document.removeEventListener('orientationchange', this.screenOrientationChange) } + window.removeEventListener('resize', this.screenOrientationChange) if (this.playbackSession) { console.log('[AudioPlayer] Before destroy closing playback')