aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-10-21 11:27:39 +0200
committerChocobozzz <chocobozzz@cpy.re>2022-10-24 14:48:24 +0200
commit326f36929a2bc37185e9188ee4eff17b52a329e5 (patch)
tree806af38a7d22c992a91d5bbf948cad7f517c1879
parent9ab330b90decf4edf152ff8e1d2948c065766b2c (diff)
downloadPeerTube-326f36929a2bc37185e9188ee4eff17b52a329e5.tar.gz
PeerTube-326f36929a2bc37185e9188ee4eff17b52a329e5.tar.zst
PeerTube-326f36929a2bc37185e9188ee4eff17b52a329e5.zip
Don't fallback to HLS with private videos
-rw-r--r--client/src/assets/player/shared/manager-options/hls-options-builder.ts2
-rw-r--r--client/src/assets/player/shared/p2p-media-loader/p2p-media-loader-plugin.ts8
-rw-r--r--client/src/assets/player/types/peertube-videojs-typings.ts2
3 files changed, 11 insertions, 1 deletions
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 {
31 const loader = new this.p2pMediaLoaderModule.Engine(p2pMediaLoaderConfig).createLoaderClass() as P2PMediaLoader 31 const loader = new this.p2pMediaLoaderModule.Engine(p2pMediaLoaderConfig).createLoaderClass() as P2PMediaLoader
32 32
33 const p2pMediaLoader: P2PMediaLoaderPluginOptions = { 33 const p2pMediaLoader: P2PMediaLoaderPluginOptions = {
34 requiresAuth: commonOptions.requiresAuth,
35
34 redundancyUrlManager, 36 redundancyUrlManager,
35 type: 'application/x-mpegURL', 37 type: 'application/x-mpegURL',
36 startTime: commonOptions.startTime, 38 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 {
44 if (!(videojs as any).Html5Hlsjs) { 44 if (!(videojs as any).Html5Hlsjs) {
45 logger.warn('HLS.js does not seem to be supported. Try to fallback to built in HLS.') 45 logger.warn('HLS.js does not seem to be supported. Try to fallback to built in HLS.')
46 46
47 let message: string
47 if (!player.canPlayType('application/vnd.apple.mpegurl')) { 48 if (!player.canPlayType('application/vnd.apple.mpegurl')) {
48 const message = 'Cannot fallback to built-in HLS' 49 message = 'Cannot fallback to built-in HLS'
50 } else if (options.requiresAuth) {
51 message = 'Video requires auth which is not compatible to build-in HLS player'
52 }
53
54 if (message) {
49 logger.warn(message) 55 logger.warn(message)
50 56
51 player.ready(() => player.trigger('error', new Error(message))) 57 player.ready(() => player.trigger('error', new Error(message)))
diff --git a/client/src/assets/player/types/peertube-videojs-typings.ts b/client/src/assets/player/types/peertube-videojs-typings.ts
index 037c4b74b..f02673a66 100644
--- a/client/src/assets/player/types/peertube-videojs-typings.ts
+++ b/client/src/assets/player/types/peertube-videojs-typings.ts
@@ -166,6 +166,8 @@ type P2PMediaLoaderPluginOptions = {
166 startTime: number | string 166 startTime: number | string
167 167
168 loader: P2PMediaLoader 168 loader: P2PMediaLoader
169
170 requiresAuth: boolean
169} 171}
170 172
171export type P2PMediaLoader = { 173export type P2PMediaLoader = {