]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts
Enhance plugin video fields
[github/Chocobozzz/PeerTube.git] / client / src / app / +videos / +video-edit / video-add-components / video-go-live.component.ts
index ee7011b4c1a5d5bb3bb7f24692de41ba746424a3..46a7ebb0b97f18afdb77de71d0c5d0b297f34829 100644 (file)
@@ -1,4 +1,3 @@
-
 import { forkJoin } from 'rxjs'
 import { AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core'
 import { Router } from '@angular/router'
@@ -16,6 +15,7 @@ import { VideoSend } from './video-send'
   templateUrl: './video-go-live.component.html',
   styleUrls: [
     '../shared/video-edit.component.scss',
+    './video-go-live.component.scss',
     './video-send.scss'
   ]
 })
@@ -23,6 +23,8 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
   @Output() firstStepDone = new EventEmitter<string>()
   @Output() firstStepError = new EventEmitter<void>()
 
+  firstStepPermanentLive: boolean
+
   isInUpdateForm = false
 
   liveVideo: LiveVideo
@@ -68,10 +70,8 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
       privacy: this.highestPrivacy,
       nsfw: this.serverConfig.instance.isNSFW,
       waitTranscoding: true,
-      commentsEnabled: true,
-      downloadEnabled: true,
-      permanentLive: false,
-      saveReplay: false,
+      permanentLive: this.firstStepPermanentLive,
+      saveReplay: this.firstStepPermanentLive === false && this.isReplayAllowed(),
       channelId: this.firstStepChannelId
     }
 
@@ -154,6 +154,26 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
     return this.form.value['saveReplay'] === true
   }
 
+  getNormalLiveDescription () {
+    if (this.isReplayAllowed()) {
+      return $localize`Stream only once and save a replay of your live`
+    }
+
+    return $localize`Stream only once`
+  }
+
+  getPermanentLiveDescription () {
+    if (this.isReplayAllowed()) {
+      return $localize`Stream multiple times, replays can't be saved`
+    }
+
+    return $localize`Stream multiple times using the same URL`
+  }
+
+  private isReplayAllowed () {
+    return this.serverConfig.live.allowReplay
+  }
+
   private fetchVideoLive () {
     this.liveVideoService.getVideoLive(this.videoId)
       .subscribe({