diff --git a/components/app/AudioPlayerContainer.vue b/components/app/AudioPlayerContainer.vue index 48d0be6d..b1923e2b 100644 --- a/components/app/AudioPlayerContainer.vue +++ b/components/app/AudioPlayerContainer.vue @@ -214,6 +214,8 @@ export default { if (startTime !== undefined && startTime !== null) { // seek to start time AbsAudioPlayer.seek({ value: Math.floor(startTime) }) + } else if (this.$refs.audioPlayer) { + this.$refs.audioPlayer.play() } return } diff --git a/components/tables/collection/BookTableRow.vue b/components/tables/collection/BookTableRow.vue index cc3af0df..e9dc7ead 100644 --- a/components/tables/collection/BookTableRow.vue +++ b/components/tables/collection/BookTableRow.vue @@ -1,16 +1,21 @@ @@ -31,6 +36,9 @@ export default { } }, computed: { + libraryItemId() { + return this.book.id + }, media() { return this.book.media || {} }, @@ -59,22 +67,29 @@ export default { isMissing() { return this.book.isMissing }, - isIncomplete() { - return this.book.isIncomplete - }, - numTracks() { - return this.book.numTracks - }, - isStreaming() { - return this.$store.getters['getIsItemStreaming'](this.book.id) + isInvalid() { + return this.book.isInvalid }, showPlayBtn() { - return !this.isMissing && !this.isIncomplete && !this.isStreaming && this.numTracks + return !this.isMissing && !this.isInvalid && this.tracks.length + }, + isStreaming() { + return this.$store.getters['getIsEpisodeStreaming'](this.libraryItemId) + }, + streamIsPlaying() { + return this.$store.state.playerIsPlaying && this.isStreaming } }, methods: { - clickEdit() { - this.$emit('edit', this.book) + async playClick() { + await this.$hapticsImpact() + if (this.streamIsPlaying) { + this.$eventBus.$emit('pause-item') + } else { + this.$eventBus.$emit('play-item', { + libraryItemId: this.libraryItemId + }) + } } }, mounted() {} @@ -83,7 +98,7 @@ export default { \ No newline at end of file diff --git a/components/tables/playlist/ItemTableRow.vue b/components/tables/playlist/ItemTableRow.vue index 68ca70f5..7bcde807 100644 --- a/components/tables/playlist/ItemTableRow.vue +++ b/components/tables/playlist/ItemTableRow.vue @@ -1,16 +1,21 @@ @@ -83,21 +88,36 @@ export default { isInvalid() { return this.libraryItem.isInvalid }, - isStreaming() { - return this.$store.getters['getIsItemStreaming'](this.item.id) - }, showPlayBtn() { - return !this.isMissing && !this.isInvalid && !this.isStreaming && (this.tracks.length || this.episode) + return !this.isMissing && !this.isInvalid && (this.tracks.length || this.episode) + }, + isStreaming() { + return this.$store.getters['getIsEpisodeStreaming'](this.libraryItem.id, this.episodeId) + }, + streamIsPlaying() { + return this.$store.state.playerIsPlaying && this.isStreaming + } + }, + methods: { + async playClick() { + await this.$hapticsImpact() + if (this.streamIsPlaying) { + this.$eventBus.$emit('pause-item') + } else { + this.$eventBus.$emit('play-item', { + libraryItemId: this.libraryItem.id, + episodeId: this.episodeId + }) + } } }, - methods: {}, mounted() {} } \ No newline at end of file