mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Merge pull request #3655 from glorenzen/fix/player-settings-modal
Fix player settings modal on share page
This commit is contained in:
		
						commit
						c643d4cec8
					
				@ -53,7 +53,6 @@
 | 
				
			|||||||
      @showBookmarks="showBookmarks"
 | 
					      @showBookmarks="showBookmarks"
 | 
				
			||||||
      @showSleepTimer="showSleepTimerModal = true"
 | 
					      @showSleepTimer="showSleepTimerModal = true"
 | 
				
			||||||
      @showPlayerQueueItems="showPlayerQueueItemsModal = true"
 | 
					      @showPlayerQueueItems="showPlayerQueueItemsModal = true"
 | 
				
			||||||
      @showPlayerSettings="showPlayerSettingsModal = true"
 | 
					 | 
				
			||||||
    />
 | 
					    />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <modals-bookmarks-modal v-model="showBookmarksModal" :bookmarks="bookmarks" :current-time="bookmarkCurrentTime" :library-item-id="libraryItemId" @select="selectBookmark" />
 | 
					    <modals-bookmarks-modal v-model="showBookmarksModal" :bookmarks="bookmarks" :current-time="bookmarkCurrentTime" :library-item-id="libraryItemId" @select="selectBookmark" />
 | 
				
			||||||
@ -61,8 +60,6 @@
 | 
				
			|||||||
    <modals-sleep-timer-modal v-model="showSleepTimerModal" :timer-set="sleepTimerSet" :timer-type="sleepTimerType" :remaining="sleepTimerRemaining" :has-chapters="!!chapters.length" @set="setSleepTimer" @cancel="cancelSleepTimer" @increment="incrementSleepTimer" @decrement="decrementSleepTimer" />
 | 
					    <modals-sleep-timer-modal v-model="showSleepTimerModal" :timer-set="sleepTimerSet" :timer-type="sleepTimerType" :remaining="sleepTimerRemaining" :has-chapters="!!chapters.length" @set="setSleepTimer" @cancel="cancelSleepTimer" @increment="incrementSleepTimer" @decrement="decrementSleepTimer" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <modals-player-queue-items-modal v-model="showPlayerQueueItemsModal" />
 | 
					    <modals-player-queue-items-modal v-model="showPlayerQueueItemsModal" />
 | 
				
			||||||
 | 
					 | 
				
			||||||
    <modals-player-settings-modal v-model="showPlayerSettingsModal" />
 | 
					 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -81,7 +78,6 @@ export default {
 | 
				
			|||||||
      currentTime: 0,
 | 
					      currentTime: 0,
 | 
				
			||||||
      showSleepTimerModal: false,
 | 
					      showSleepTimerModal: false,
 | 
				
			||||||
      showPlayerQueueItemsModal: false,
 | 
					      showPlayerQueueItemsModal: false,
 | 
				
			||||||
      showPlayerSettingsModal: false,
 | 
					 | 
				
			||||||
      sleepTimerSet: false,
 | 
					      sleepTimerSet: false,
 | 
				
			||||||
      sleepTimerRemaining: 0,
 | 
					      sleepTimerRemaining: 0,
 | 
				
			||||||
      sleepTimerType: null,
 | 
					      sleepTimerType: null,
 | 
				
			||||||
 | 
				
			|||||||
@ -59,12 +59,19 @@ export default {
 | 
				
			|||||||
    setJumpBackwardAmount(val) {
 | 
					    setJumpBackwardAmount(val) {
 | 
				
			||||||
      this.jumpBackwardAmount = val
 | 
					      this.jumpBackwardAmount = val
 | 
				
			||||||
      this.$store.dispatch('user/updateUserSettings', { jumpBackwardAmount: val })
 | 
					      this.$store.dispatch('user/updateUserSettings', { jumpBackwardAmount: val })
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  mounted() {
 | 
					    settingsUpdated() {
 | 
				
			||||||
      this.useChapterTrack = this.$store.getters['user/getUserSetting']('useChapterTrack')
 | 
					      this.useChapterTrack = this.$store.getters['user/getUserSetting']('useChapterTrack')
 | 
				
			||||||
      this.jumpForwardAmount = this.$store.getters['user/getUserSetting']('jumpForwardAmount')
 | 
					      this.jumpForwardAmount = this.$store.getters['user/getUserSetting']('jumpForwardAmount')
 | 
				
			||||||
      this.jumpBackwardAmount = this.$store.getters['user/getUserSetting']('jumpBackwardAmount')
 | 
					      this.jumpBackwardAmount = this.$store.getters['user/getUserSetting']('jumpBackwardAmount')
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  mounted() {
 | 
				
			||||||
 | 
					    this.settingsUpdated()
 | 
				
			||||||
 | 
					    this.$eventBus.$on('user-settings', this.settingsUpdated)
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  beforeDestroy() {
 | 
				
			||||||
 | 
					    this.$eventBus.$off('user-settings', this.settingsUpdated)
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
				
			|||||||
@ -37,7 +37,7 @@
 | 
				
			|||||||
        </ui-tooltip>
 | 
					        </ui-tooltip>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <ui-tooltip direction="top" :text="$strings.LabelViewPlayerSettings">
 | 
					        <ui-tooltip direction="top" :text="$strings.LabelViewPlayerSettings">
 | 
				
			||||||
          <button :aria-label="$strings.LabelViewPlayerSettings" class="outline-none text-gray-300 mx-1 lg:mx-2 hover:text-white" @mousedown.prevent @mouseup.prevent @click.stop="$emit('showPlayerSettings')">
 | 
					          <button :aria-label="$strings.LabelViewPlayerSettings" class="outline-none text-gray-300 mx-1 lg:mx-2 hover:text-white" @mousedown.prevent @mouseup.prevent @click.stop="showPlayerSettings">
 | 
				
			||||||
            <span class="material-symbols text-2xl sm:text-2.5xl">settings_slow_motion</span>
 | 
					            <span class="material-symbols text-2xl sm:text-2.5xl">settings_slow_motion</span>
 | 
				
			||||||
          </button>
 | 
					          </button>
 | 
				
			||||||
        </ui-tooltip>
 | 
					        </ui-tooltip>
 | 
				
			||||||
@ -64,6 +64,8 @@
 | 
				
			|||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <modals-chapters-modal v-model="showChaptersModal" :current-chapter="currentChapter" :playback-rate="playbackRate" :chapters="chapters" @select="selectChapter" />
 | 
					    <modals-chapters-modal v-model="showChaptersModal" :current-chapter="currentChapter" :playback-rate="playbackRate" :chapters="chapters" @select="selectChapter" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <modals-player-settings-modal v-model="showPlayerSettingsModal" />
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -96,6 +98,7 @@ export default {
 | 
				
			|||||||
      audioEl: null,
 | 
					      audioEl: null,
 | 
				
			||||||
      seekLoading: false,
 | 
					      seekLoading: false,
 | 
				
			||||||
      showChaptersModal: false,
 | 
					      showChaptersModal: false,
 | 
				
			||||||
 | 
					      showPlayerSettingsModal: false,
 | 
				
			||||||
      currentTime: 0,
 | 
					      currentTime: 0,
 | 
				
			||||||
      duration: 0
 | 
					      duration: 0
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -315,6 +318,9 @@ export default {
 | 
				
			|||||||
      if (!this.chapters.length) return
 | 
					      if (!this.chapters.length) return
 | 
				
			||||||
      this.showChaptersModal = !this.showChaptersModal
 | 
					      this.showChaptersModal = !this.showChaptersModal
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    showPlayerSettings() {
 | 
				
			||||||
 | 
					      this.showPlayerSettingsModal = !this.showPlayerSettingsModal
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    init() {
 | 
					    init() {
 | 
				
			||||||
      this.playbackRate = this.$store.getters['user/getUserSetting']('playbackRate') || 1
 | 
					      this.playbackRate = this.$store.getters['user/getUserSetting']('playbackRate') || 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -126,12 +126,14 @@ export default {
 | 
				
			|||||||
      if (!this.localAudioPlayer || !this.hasLoaded) return
 | 
					      if (!this.localAudioPlayer || !this.hasLoaded) return
 | 
				
			||||||
      const currentTime = this.localAudioPlayer.getCurrentTime()
 | 
					      const currentTime = this.localAudioPlayer.getCurrentTime()
 | 
				
			||||||
      const duration = this.localAudioPlayer.getDuration()
 | 
					      const duration = this.localAudioPlayer.getDuration()
 | 
				
			||||||
      this.seek(Math.min(currentTime + 10, duration))
 | 
					      const jumpForwardAmount = this.$store.getters['user/getUserSetting']('jumpForwardAmount') || 10
 | 
				
			||||||
 | 
					      this.seek(Math.min(currentTime + jumpForwardAmount, duration))
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    jumpBackward() {
 | 
					    jumpBackward() {
 | 
				
			||||||
      if (!this.localAudioPlayer || !this.hasLoaded) return
 | 
					      if (!this.localAudioPlayer || !this.hasLoaded) return
 | 
				
			||||||
      const currentTime = this.localAudioPlayer.getCurrentTime()
 | 
					      const currentTime = this.localAudioPlayer.getCurrentTime()
 | 
				
			||||||
      this.seek(Math.max(currentTime - 10, 0))
 | 
					      const jumpBackwardAmount = this.$store.getters['user/getUserSetting']('jumpBackwardAmount') || 10
 | 
				
			||||||
 | 
					      this.seek(Math.max(currentTime - jumpBackwardAmount, 0))
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    setVolume(volume) {
 | 
					    setVolume(volume) {
 | 
				
			||||||
      if (!this.localAudioPlayer || !this.hasLoaded) return
 | 
					      if (!this.localAudioPlayer || !this.hasLoaded) return
 | 
				
			||||||
@ -248,6 +250,8 @@ export default {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  mounted() {
 | 
					  mounted() {
 | 
				
			||||||
 | 
					    this.$store.dispatch('user/loadUserSettings')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.resize()
 | 
					    this.resize()
 | 
				
			||||||
    window.addEventListener('resize', this.resize)
 | 
					    window.addEventListener('resize', this.resize)
 | 
				
			||||||
    window.addEventListener('keydown', this.keyDown)
 | 
					    window.addEventListener('keydown', this.keyDown)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user