[Media UI] Start/stop streaming use the configured media plugin.

The base `media` plugin is abstract, hence the `Media` panel needs to
pass the current media plugin to the `Utils` mixins so it can pick the
right action.
This commit is contained in:
Fabio Manganiello 2023-11-04 11:53:26 +01:00
parent b4bf30945a
commit 5478b90288
Signed by: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 6 additions and 6 deletions

View file

@ -54,7 +54,7 @@ export default {
return ret.join(':') return ret.join(':')
}, },
async startStreaming(resource, download=false) { async startStreaming(resource, pluginName, download=false) {
let url = resource let url = resource
let subtitles = null let subtitles = null
@ -65,7 +65,7 @@ export default {
resource = {url: url} resource = {url: url}
} }
const ret = await this.request(`media.start_streaming`, { const ret = await this.request(`${pluginName}.start_streaming`, {
media: url, media: url,
subtitles: subtitles, subtitles: subtitles,
download: download, download: download,
@ -74,8 +74,8 @@ export default {
return {...resource, ...ret} return {...resource, ...ret}
}, },
async stopStreaming(mediaId) { async stopStreaming(mediaId, pluginName) {
await this.request('media.stop_streaming', {media_id: mediaId}) await this.request(`${pluginName}.stop_streaming`, {media_id: mediaId})
}, },
}, },
} }

View file

@ -160,7 +160,7 @@ export default {
} }
if (!this.selectedPlayer.component.supports(item)) if (!this.selectedPlayer.component.supports(item))
item = await this.startStreaming(item) item = await this.startStreaming(item, this.pluginName)
await this.selectedPlayer.component.play(item, this.selectedSubtitles, this.selectedPlayer) await this.selectedPlayer.component.play(item, this.selectedSubtitles, this.selectedPlayer)
await this.refresh() await this.refresh()
@ -187,7 +187,7 @@ export default {
}, },
async view(item) { async view(item) {
const ret = await this.startStreaming(item, true) const ret = await this.startStreaming(item, this.pluginName, true)
window.open(ret.url, '_blank') window.open(ret.url, '_blank')
}, },