From 326f36929a2bc37185e9188ee4eff17b52a329e5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 21 Oct 2022 11:27:39 +0200 Subject: Don't fallback to HLS with private videos --- .../assets/player/shared/manager-options/hls-options-builder.ts | 2 ++ .../player/shared/p2p-media-loader/p2p-media-loader-plugin.ts | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) (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 933c0d595..497a97436 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 @@ -31,6 +31,8 @@ export class HLSOptionsBuilder { const loader = new this.p2pMediaLoaderModule.Engine(p2pMediaLoaderConfig).createLoaderClass() as P2PMediaLoader const p2pMediaLoader: P2PMediaLoaderPluginOptions = { + requiresAuth: commonOptions.requiresAuth, + redundancyUrlManager, type: 'application/x-mpegURL', startTime: commonOptions.startTime, diff --git a/client/src/assets/player/shared/p2p-media-loader/p2p-media-loader-plugin.ts b/client/src/assets/player/shared/p2p-media-loader/p2p-media-loader-plugin.ts index 3c4482f2e..2ed09c61c 100644 --- a/client/src/assets/player/shared/p2p-media-loader/p2p-media-loader-plugin.ts +++ b/client/src/assets/player/shared/p2p-media-loader/p2p-media-loader-plugin.ts @@ -44,8 +44,14 @@ class P2pMediaLoaderPlugin extends Plugin { if (!(videojs as any).Html5Hlsjs) { logger.warn('HLS.js does not seem to be supported. Try to fallback to built in HLS.') + let message: string if (!player.canPlayType('application/vnd.apple.mpegurl')) { - const message = 'Cannot fallback to built-in HLS' + message = 'Cannot fallback to built-in HLS' + } else if (options.requiresAuth) { + message = 'Video requires auth which is not compatible to build-in HLS player' + } + + if (message) { logger.warn(message) player.ready(() => player.trigger('error', new Error(message))) -- cgit v1.2.3