Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix watching password protected live

Chocobozzza640fa774d37
diff --git a/client/src/app/+video-watch/video-watch.component.ts b/client/src/app/+video-watch/video-watch.component.ts
index a784612f0d..83b99d0f2b 100644
--- a/client/src/app/+video-watch/video-watch.component.ts
+++ b/client/src/app/+video-watch/video-watch.component.ts
@@ -400,7 +400,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
switchMap(video => {
if (!video.isLive) return of({ video, live: undefined })
- return this.liveVideoService.getVideoLive(video.uuid)
+ return this.liveVideoService.getVideoLive(video.uuid, videoPassword)
.pipe(map(live => ({ live, video })))
}),
switchMap(({ video, live }) => {
diff --git a/client/src/app/shared/shared-video-live/live-video.service.ts b/client/src/app/shared/shared-video-live/live-video.service.ts
index a7a009186e..4660b213b9 100644
--- a/client/src/app/shared/shared-video-live/live-video.service.ts
+++ b/client/src/app/shared/shared-video-live/live-video.service.ts
@@ -5,6 +5,7 @@ import { RestExtractor } from '@app/core'
import { LiveVideo, LiveVideoCreate, LiveVideoSession, LiveVideoUpdate, ResultList, VideoCreateResult } from '@peertube/peertube-models'
import { environment } from '../../../environments/environment'
import { VideoService } from '../shared-main/video/video.service'
+import { VideoPasswordService } from '../shared-main/video/video-password.service'
@Injectable()
export class LiveVideoService {
@@ -19,9 +20,11 @@ export class LiveVideoService {
.pipe(catchError(err => this.restExtractor.handleError(err)))
}
- getVideoLive (videoId: number | string) {
+ getVideoLive (videoId: number | string, videoPassword?: string) {
+ const headers = VideoPasswordService.buildVideoPasswordHeader(videoPassword)
+
return this.authHttp
- .get<LiveVideo>(LiveVideoService.BASE_VIDEO_LIVE_URL + videoId)
+ .get<LiveVideo>(LiveVideoService.BASE_VIDEO_LIVE_URL + videoId, { headers })
.pipe(catchError(err => this.restExtractor.handleError(err)))
}
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index f67ed9c217..9b35562976 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -263,7 +263,7 @@ export class PeerTubeEmbed {
this.playerOptionsBuilder.loadVideoParams(this.config, videoInfo)
const live = videoInfo.isLive
- ? await this.videoFetcher.loadLive(videoInfo)
+ ? await this.videoFetcher.loadLive(videoInfo, this.videoPassword)
: undefined
const videoFileToken = videoRequiresFileToken(videoInfo)
diff --git a/client/src/standalone/videos/shared/video-fetcher.ts b/client/src/standalone/videos/shared/video-fetcher.ts
index 062b7f4563..8529dbaa8c 100644
--- a/client/src/standalone/videos/shared/video-fetcher.ts
+++ b/client/src/standalone/videos/shared/video-fetcher.ts
@@ -46,8 +46,8 @@ export class VideoFetcher {
return { captionsPromise, chaptersPromise, storyboardsPromise, videoResponse, playerSettingsPromise }
}
- loadLive (video: VideoDetails) {
- return this.http.fetch(this.getLiveUrl(video.uuid), { optionalAuth: true })
+ loadLive (video: VideoDetails, videoPassword?: string) {
+ return this.http.fetch(this.getLiveUrl(video.uuid), { optionalAuth: true }, videoPassword)
.then(res => res.json() as Promise<LiveVideo>)
}