From 9866921cbf3f8f0925f7ffb3a231d5dfe2d30953 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Tue, 11 Oct 2022 08:37:14 +0200 Subject: feat(plugins): add p2p-media-loader options filter (#5318) * feat(plugins): add p2p-media-loader options filter closes #5317 * remove obsolete await --- .../assets/player/shared/manager-options/hls-options-builder.ts | 7 +++++-- .../player/shared/manager-options/manager-options-builder.ts | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'client/src/assets/player/shared') diff --git a/client/src/assets/player/shared/manager-options/hls-options-builder.ts b/client/src/assets/player/shared/manager-options/hls-options-builder.ts index a572febc2..361c76f4b 100644 --- a/client/src/assets/player/shared/manager-options/hls-options-builder.ts +++ b/client/src/assets/player/shared/manager-options/hls-options-builder.ts @@ -19,12 +19,15 @@ export class HLSOptionsBuilder { } - getPluginOptions () { + async getPluginOptions () { const commonOptions = this.options.common const redundancyUrlManager = new RedundancyUrlManager(this.options.p2pMediaLoader.redundancyBaseUrls) - const p2pMediaLoaderConfig = this.getP2PMediaLoaderOptions(redundancyUrlManager) + const p2pMediaLoaderConfig = await this.options.pluginsManager.runHook( + 'filter:internal.player.p2p-media-loader.options.result', + this.getP2PMediaLoaderOptions(redundancyUrlManager) + ) const loader = new this.p2pMediaLoaderModule.Engine(p2pMediaLoaderConfig).createLoaderClass() as P2PMediaLoader const p2pMediaLoader: P2PMediaLoaderPluginOptions = { diff --git a/client/src/assets/player/shared/manager-options/manager-options-builder.ts b/client/src/assets/player/shared/manager-options/manager-options-builder.ts index 07678493d..2d96c9410 100644 --- a/client/src/assets/player/shared/manager-options/manager-options-builder.ts +++ b/client/src/assets/player/shared/manager-options/manager-options-builder.ts @@ -20,7 +20,7 @@ export class ManagerOptionsBuilder { } - getVideojsOptions (alreadyPlayed: boolean): videojs.PlayerOptions { + async getVideojsOptions (alreadyPlayed: boolean): Promise { const commonOptions = this.options.common let autoplay = this.getAutoPlayValue(commonOptions.autoplay, alreadyPlayed) @@ -61,7 +61,7 @@ export class ManagerOptionsBuilder { if (this.mode === 'p2p-media-loader') { const hlsOptionsBuilder = new HLSOptionsBuilder(this.options, this.p2pMediaLoaderModule) - const options = hlsOptionsBuilder.getPluginOptions() + const options = await hlsOptionsBuilder.getPluginOptions() Object.assign(plugins, pick(options, [ 'hlsjs', 'p2pMediaLoader' ])) Object.assign(html5, options.html5) -- cgit v1.2.3