]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
Live streaming implementation first step
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / config / edit-custom-config / edit-custom-config.component.ts
index 78e9dd5e5e8a28467434db09711c0a9b6c4b550b..de800c87ef06aa6ef00be6be5103a339c157dd92 100644 (file)
@@ -34,6 +34,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
   customConfig: CustomConfig
 
   resolutions: { id: string, label: string, description?: string }[] = []
+  liveResolutions: { id: string, label: string, description?: string }[] = []
   transcodingThreadOptions: { label: string, value: number }[] = []
 
   languageItems: SelectOptionsItem[] = []
@@ -82,6 +83,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
       }
     ]
 
+    this.liveResolutions = this.resolutions.filter(r => r.id !== '0p')
+
     this.transcodingThreadOptions = [
       { value: 0, label: $localize`Auto (via ffmpeg)` },
       { value: 1, label: '1' },
@@ -198,6 +201,15 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
           enabled: null
         }
       },
+      live: {
+        enabled: null,
+
+        transcoding: {
+          enabled: null,
+          threads: TRANSCODING_THREADS_VALIDATOR,
+          resolutions: {}
+        }
+      },
       autoBlacklist: {
         videos: {
           ofUsers: {
@@ -245,13 +257,24 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
     const defaultValues = {
       transcoding: {
         resolutions: {}
+      },
+      live: {
+        transcoding: {
+          resolutions: {}
+        }
       }
     }
+
     for (const resolution of this.resolutions) {
       defaultValues.transcoding.resolutions[resolution.id] = 'false'
       formGroupData.transcoding.resolutions[resolution.id] = null
     }
 
+    for (const resolution of this.liveResolutions) {
+      defaultValues.live.transcoding.resolutions[resolution.id] = 'false'
+      formGroupData.live.transcoding.resolutions[resolution.id] = null
+    }
+
     this.buildForm(formGroupData)
     this.loadForm()
     this.checkTranscodingFields()
@@ -268,6 +291,14 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
     return this.form.value['transcoding']['enabled'] === true
   }
 
+  isLiveEnabled () {
+    return this.form.value['live']['enabled'] === true
+  }
+
+  isLiveTranscodingEnabled () {
+    return this.form.value['live']['transcoding']['enabled'] === true
+  }
+
   isSignupEnabled () {
     return this.form.value['signup']['enabled'] === true
   }