feat(plugins): add p2p-media-loader options filter (#5318)
* feat(plugins): add p2p-media-loader options filter closes #5317 * remove obsolete await
This commit is contained in:
parent
dce2aba1e2
commit
9866921cbf
3 changed files with 11 additions and 5 deletions
|
@ -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 = {
|
||||
|
|
|
@ -20,7 +20,7 @@ export class ManagerOptionsBuilder {
|
|||
|
||||
}
|
||||
|
||||
getVideojsOptions (alreadyPlayed: boolean): videojs.PlayerOptions {
|
||||
async getVideojsOptions (alreadyPlayed: boolean): Promise<videojs.PlayerOptions> {
|
||||
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)
|
||||
|
|
|
@ -88,7 +88,10 @@ export const clientFilterHookObject = {
|
|||
'filter:share.video-playlist-url.build.result': true,
|
||||
|
||||
// Filter videojs options built for PeerTube player
|
||||
'filter:internal.player.videojs.options.result': true
|
||||
'filter:internal.player.videojs.options.result': true,
|
||||
|
||||
// Filter p2p media loader options built for PeerTube player
|
||||
'filter:internal.player.p2p-media-loader.options.result': true
|
||||
}
|
||||
|
||||
export type ClientFilterHookName = keyof typeof clientFilterHookObject
|
||||
|
|
Loading…
Reference in a new issue