diff --git a/pages/item/_id/_episode/index.vue b/pages/item/_id/_episode/index.vue index c90cd1e8..cbed747b 100644 --- a/pages/item/_id/_episode/index.vue +++ b/pages/item/_id/_episode/index.vue @@ -33,9 +33,9 @@
- - play_arrow - {{ isPlaying ? (playerIsLocal ? 'Playing' : 'Streaming') : localEpisodeId ? 'Play' : 'Stream' }} + + {{ playerIsPlaying ? 'pause' : 'play_arrow' }} + {{ playerIsPlaying ? 'Pause' : localEpisodeId ? 'Play' : 'Stream' }} {{ downloadItem ? 'downloading' : 'download' }} diff --git a/pages/item/_id/index.vue b/pages/item/_id/index.vue index 28e34be0..74e8755d 100644 --- a/pages/item/_id/index.vue +++ b/pages/item/_id/index.vue @@ -33,28 +33,15 @@
-
- - play_arrow - {{ isPlaying ? 'Playing' : 'Play' }} +
+ + {{ playerIsPlaying ? 'pause' : 'play_arrow' }} + {{ playerIsPlaying ? 'Pause' : isPodcast ? 'Next Episode' : hasLocal ? 'Play' : 'Stream' }} auto_stories Read {{ ebookFormat }} - - more_vert - -
-
- - play_arrow - {{ isPlaying ? (isStreaming ? 'Streaming' : 'Playing') : isPodcast ? 'Next Episode' : hasLocal ? 'Play' : 'Stream' }} - - - auto_stories - Read {{ ebookFormat }} - {{ downloadItem ? 'downloading' : 'download' }} @@ -335,6 +322,9 @@ export default { if (this.localLibraryItemId && this.$store.getters['getIsItemStreaming'](this.localLibraryItemId)) return true return this.$store.getters['getIsItemStreaming'](this.libraryItemId) }, + playerIsPlaying() { + return this.$store.state.playerIsPlaying && (this.isStreaming || this.isPlaying) + }, tracks() { return this.media.tracks || [] }, @@ -348,18 +338,18 @@ export default { isMissing() { return this.libraryItem.isMissing }, - isIncomplete() { - return this.libraryItem.isIncomplete + isInvalid() { + return this.libraryItem.isInvalid }, showPlay() { - return !this.isMissing && !this.isIncomplete && (this.numTracks || this.episodes.length) + return !this.isMissing && !this.isInvalid && (this.numTracks || this.episodes.length) }, showRead() { return this.ebookFile }, showDownload() { - if (this.isPodcast) return false - return this.user && this.userCanDownload && this.showPlay && !this.hasLocal + if (this.isPodcast || this.hasLocal) return false + return this.user && this.userCanDownload && this.showPlay }, ebookFile() { return this.media.ebookFile @@ -488,12 +478,15 @@ export default { playAtTimestamp(seconds) { this.play(seconds) }, - playClick() { - this.play() + async playClick() { + await this.$hapticsImpact() + if (this.playerIsPlaying) { + this.$eventBus.$emit('pause-item') + } else { + this.play() + } }, async play(startTime = null) { - await this.$hapticsImpact() - if (this.isPodcast) { this.episodes.sort((a, b) => { return String(b.publishedAt).localeCompare(String(a.publishedAt), undefined, { numeric: true, sensitivity: 'base' })