- 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' })