+
{{ seekLoading ? 'autorenew' : !isPlaying ? 'play_arrow' : 'pause' }}
@@ -159,7 +160,7 @@ export default {
return this.showFullscreen ? 200 : 60
},
showCastBtn() {
- return this.$store.state.isCastAvailable && !this.isLocalPlayMethod
+ return this.$store.state.isCastAvailable
},
isCasting() {
return this.mediaPlayer === 'cast-player'
@@ -193,6 +194,9 @@ export default {
isLocalPlayMethod() {
return this.playMethod == this.$constants.PlayMethod.LOCAL
},
+ isDirectPlayMethod() {
+ return this.playMethod == this.$constants.PlayMethod.DIRECTPLAY
+ },
title() {
if (this.playbackSession) return this.playbackSession.displayTitle
return this.mediaMetadata ? this.mediaMetadata.title : 'Title'
@@ -269,12 +273,10 @@ export default {
this.showChapterModal = false
},
castClick() {
- console.log('Cast Btn Click')
if (this.isLocalPlayMethod) {
- this.$toast.warn('Cannot cast downloaded media items')
+ this.$eventBus.$emit('cast-local-item')
return
}
-
AbsAudioPlayer.requestSession()
},
clickContainer() {
diff --git a/components/app/AudioPlayerContainer.vue b/components/app/AudioPlayerContainer.vue
index 584239fb..3b4ea5ee 100644
--- a/components/app/AudioPlayerContainer.vue
+++ b/components/app/AudioPlayerContainer.vue
@@ -168,10 +168,36 @@ export default {
this.$refs.audioPlayer.closePlayback()
}
},
+ castLocalItem() {
+ if (!this.serverLibraryItemId) {
+ this.$toast.error(`Cannot cast locally downloaded media`)
+ } else {
+ // Change to server library item
+ this.playServerLibraryItemAndCast(this.serverLibraryItemId)
+ }
+ },
+ playServerLibraryItemAndCast(libraryItemId) {
+ var playbackRate = 1
+ if (this.$refs.audioPlayer) {
+ playbackRate = this.$refs.audioPlayer.currentPlaybackRate || 1
+ }
+ AbsAudioPlayer.prepareLibraryItem({ libraryItemId, episodeId: null, playWhenReady: false, playbackRate })
+ .then((data) => {
+ console.log('Library item play response', JSON.stringify(data))
+ AbsAudioPlayer.requestSession()
+ })
+ .catch((error) => {
+ console.error('Failed', error)
+ })
+ },
async playLibraryItem(payload) {
var libraryItemId = payload.libraryItemId
var episodeId = payload.episodeId
+ // When playing local library item and can also play this item from the server
+ // then store the server library item id so it can be used if a cast is made
+ var serverLibraryItemId = payload.serverLibraryItemId || null
+
if (libraryItemId.startsWith('local') && this.$store.state.isCasting) {
const { value } = await Dialog.confirm({
title: 'Warning',
@@ -195,6 +221,8 @@ export default {
console.log('Library item play response', JSON.stringify(data))
if (!libraryItemId.startsWith('local')) {
this.serverLibraryItemId = libraryItemId
+ } else {
+ this.serverLibraryItemId = serverLibraryItemId
}
})
.catch((error) => {
@@ -228,6 +256,7 @@ export default {
this.$eventBus.$on('play-item', this.playLibraryItem)
this.$eventBus.$on('pause-item', this.pauseItem)
this.$eventBus.$on('close-stream', this.closeStreamOnly)
+ this.$eventBus.$on('cast-local-item', this.castLocalItem)
this.$store.commit('user/addSettingsListener', { id: 'streamContainer', meth: this.settingsUpdated })
},
beforeDestroy() {
@@ -246,6 +275,7 @@ export default {
this.$eventBus.$off('play-item', this.playLibraryItem)
this.$eventBus.$off('pause-item', this.pauseItem)
this.$eventBus.$off('close-stream', this.closeStreamOnly)
+ this.$eventBus.$off('cast-local-item', this.castLocalItem)
this.$store.commit('user/removeSettingsListener', 'streamContainer')
}
}
diff --git a/components/cards/LazyBookCard.vue b/components/cards/LazyBookCard.vue
index da8207f2..eafbb09f 100644
--- a/components/cards/LazyBookCard.vue
+++ b/components/cards/LazyBookCard.vue
@@ -446,10 +446,6 @@ export default {
this.selected = !this.selected
this.$emit('select', this.libraryItem)
},
- play() {
- var eventBus = this.$eventBus || this.$nuxt.$eventBus
- eventBus.$emit('play-item', { libraryItemId: this.libraryItemId })
- },
destroy() {
// destroy the vue listeners, etc
this.$destroy()
diff --git a/ios/App/Podfile b/ios/App/Podfile
index 584acebb..44119188 100644
--- a/ios/App/Podfile
+++ b/ios/App/Podfile
@@ -9,13 +9,13 @@ install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
- pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
- pod 'CapacitorDialog', :path => '../../node_modules/@capacitor/dialog'
- pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics'
- pod 'CapacitorNetwork', :path => '../../node_modules/@capacitor/network'
- pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
- pod 'CapacitorStorage', :path => '../../node_modules/@capacitor/storage'
- pod 'RobingenzCapacitorAppUpdate', :path => '../../node_modules/@robingenz/capacitor-app-update'
+ pod 'CapacitorApp', :path => '..\..\node_modules\@capacitor\app'
+ pod 'CapacitorDialog', :path => '..\..\node_modules\@capacitor\dialog'
+ pod 'CapacitorHaptics', :path => '..\..\node_modules\@capacitor\haptics'
+ pod 'CapacitorNetwork', :path => '..\..\node_modules\@capacitor\network'
+ pod 'CapacitorStatusBar', :path => '..\..\node_modules\@capacitor\status-bar'
+ pod 'CapacitorStorage', :path => '..\..\node_modules\@capacitor\storage'
+ pod 'RobingenzCapacitorAppUpdate', :path => '..\..\node_modules\@robingenz\capacitor-app-update'
end
target 'App' do
diff --git a/pages/item/_id.vue b/pages/item/_id.vue
index 1c17d9c5..80430d1b 100644
--- a/pages/item/_id.vue
+++ b/pages/item/_id.vue
@@ -6,10 +6,13 @@