]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Don't fallback to HLS with private videos
authorChocobozzz <me@florianbigard.com>
Fri, 21 Oct 2022 09:27:39 +0000 (11:27 +0200)
committerChocobozzz <chocobozzz@cpy.re>
Mon, 24 Oct 2022 12:48:24 +0000 (14:48 +0200)
client/src/assets/player/shared/manager-options/hls-options-builder.ts
client/src/assets/player/shared/p2p-media-loader/p2p-media-loader-plugin.ts
client/src/assets/player/types/peertube-videojs-typings.ts

index 933c0d595890d435b4a33c7894cd0d15fc6d9291..497a974363c769280c5e27f1a14cafd57f839e7b 100644 (file)
@@ -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,
index 3c4482f2e5281c023136ceb3a14d391ec9ca2d6a..2ed09c61c49857a73d66576095a4963268722599 100644 (file)
@@ -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)))
index 037c4b74b26dc184dfea9c54e4ecda86928ec995..f02673a665b54613e8fddab12ef99d8b562d7b47 100644 (file)
@@ -166,6 +166,8 @@ type P2PMediaLoaderPluginOptions = {
   startTime: number | string
 
   loader: P2PMediaLoader
+
+  requiresAuth: boolean
 }
 
 export type P2PMediaLoader = {