Add 4k conf in transcoding in admin panel
authorChocobozzz <me@florianbigard.com>
Wed, 12 Jun 2019 15:26:23 +0000 (17:26 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 12 Jun 2019 15:26:23 +0000 (17:26 +0200)
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
server/controllers/api/config.ts
server/initializers/config.ts
shared/models/server/custom-config.model.ts

index 44fc6dc26b4c88971088bc202a896c70ed295ade..d5b625d9c873e949a348ae22365e515e79986d30 100644 (file)
             <ng-container formGroupName="resolutions">
               <div class="form-group" *ngFor="let resolution of resolutions">
                 <my-peertube-checkbox
-                  [inputName]="getResolutionKey(resolution)" [formControlName]="resolution"
-                  i18n-labelText labelText="Resolution {{resolution}} enabled"
+                  [inputName]="getResolutionKey(resolution.id)" [formControlName]="resolution.id"
+                  i18n-labelText labelText="Resolution {{resolution.label}} enabled"
                 ></my-peertube-checkbox>
               </div>
             </ng-container>
index c238a6c8183777d2529ad4c46681e26a265e55e8..055bae8516e306d88d8609c1d1b788cfbfe26195 100644 (file)
@@ -15,7 +15,7 @@ import { FormValidatorService } from '@app/shared/forms/form-validators/form-val
 export class EditCustomConfigComponent extends FormReactive implements OnInit {
   customConfig: CustomConfig
 
-  resolutions: string[] = []
+  resolutions: { id: string, label: string }[] = []
   transcodingThreadOptions: { label: string, value: number }[] = []
 
   constructor (
@@ -30,11 +30,30 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
     super()
 
     this.resolutions = [
-      this.i18n('240p'),
-      this.i18n('360p'),
-      this.i18n('480p'),
-      this.i18n('720p'),
-      this.i18n('1080p')
+      {
+        id: '240p',
+        label: this.i18n('240p')
+      },
+      {
+        id: '360p',
+        label: this.i18n('360p')
+      },
+      {
+        id: '480p',
+        label: this.i18n('480p')
+      },
+      {
+        id: '720p',
+        label: this.i18n('720p')
+      },
+      {
+        id: '1080p',
+        label: this.i18n('1080p')
+      },
+      {
+        id: '2160p',
+        label: this.i18n('2160p')
+      }
     ]
 
     this.transcodingThreadOptions = [
@@ -140,8 +159,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
       }
     }
     for (const resolution of this.resolutions) {
-      defaultValues.transcoding.resolutions[resolution] = 'false'
-      formGroupData.transcoding.resolutions[resolution] = null
+      defaultValues.transcoding.resolutions[resolution.id] = 'false'
+      formGroupData.transcoding.resolutions[resolution.id] = null
     }
 
     this.buildForm(formGroupData)
index 27c416a12bc75c995ca83394056c0e6198518275..1d12f701b2aaeff4025a00721da482d202cb9486 100644 (file)
@@ -262,7 +262,8 @@ function customConfig (): CustomConfig {
         '360p': CONFIG.TRANSCODING.RESOLUTIONS[ '360p' ],
         '480p': CONFIG.TRANSCODING.RESOLUTIONS[ '480p' ],
         '720p': CONFIG.TRANSCODING.RESOLUTIONS[ '720p' ],
-        '1080p': CONFIG.TRANSCODING.RESOLUTIONS[ '1080p' ]
+        '1080p': CONFIG.TRANSCODING.RESOLUTIONS[ '1080p' ],
+        '2160p': CONFIG.TRANSCODING.RESOLUTIONS[ '2160p' ]
       },
       hls: {
         enabled: CONFIG.TRANSCODING.HLS.ENABLED
index 50653b0a0b1e821abead4af8017806b6e5b159fc..bb278ba43d44c1a3f1e1d5d49d34963925cfbce9 100644 (file)
@@ -156,7 +156,8 @@ const CONFIG = {
       get '360p' () { return config.get<boolean>('transcoding.resolutions.360p') },
       get '480p' () { return config.get<boolean>('transcoding.resolutions.480p') },
       get '720p' () { return config.get<boolean>('transcoding.resolutions.720p') },
-      get '1080p' () { return config.get<boolean>('transcoding.resolutions.1080p') }
+      get '1080p' () { return config.get<boolean>('transcoding.resolutions.1080p') },
+      get '2160p' () { return config.get<boolean>('transcoding.resolutions.2160p') }
     },
     HLS: {
       get ENABLED () { return config.get<boolean>('transcoding.hls.enabled') }
index 4cc379b2a89bb93373b279ff2d53238a872271c0..670553d16c6f8c819c52f961ac727a09b7e63cd7 100644 (file)
@@ -62,6 +62,7 @@ export interface CustomConfig {
       '480p': boolean
       '720p': boolean
       '1080p': boolean
+      '2160p': boolean
     }
     hls: {
       enabled: boolean