From 80ac2e5548bf5167d2f243a3cb0e993c75456d76 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 28 Jan 2021 16:10:09 +0100 Subject: Support transcoding profile in client admin --- .../edit-custom-config.component.html | 28 ++++++++++++++++++++++ .../edit-custom-config.component.ts | 18 +++++++++++++- client/src/app/core/server/server.service.ts | 4 ++++ 3 files changed, 49 insertions(+), 1 deletion(-) (limited to 'client/src/app') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index dd62a4aab..7ecfb7702 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html @@ -883,6 +883,20 @@
{{ formErrors.transcoding.threads }}
+
+ + New transcoding profiles can be added by PeerTube plugins + +
+ +
+
{{ formErrors.transcoding.profile }}
+
+ @@ -1023,6 +1037,20 @@
{{ formErrors.live.transcoding.threads }}
+
+ + New live transcoding profiles can be added by PeerTube plugins + +
+ +
+
{{ formErrors.live.transcoding.profile }}
+
+ diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 9a46a2e59..ae6a9e844 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts @@ -1,4 +1,5 @@ import { forkJoin } from 'rxjs' +import { pairwise } from 'rxjs/operators' import { ViewportScroller } from '@angular/common' import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' import { ConfigService } from '@app/+admin/config/shared/config.service' @@ -20,7 +21,6 @@ import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@a import { FormReactive, FormValidatorService, SelectOptionsItem } from '@app/shared/shared-forms' import { NgbNav } from '@ng-bootstrap/ng-bootstrap' import { CustomConfig, ServerConfig } from '@shared/models' -import { pairwise } from 'rxjs/operators' @Component({ selector: 'my-edit-custom-config', @@ -39,6 +39,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A transcodingThreadOptions: { label: string, value: number }[] = [] liveMaxDurationOptions: { label: string, value: number }[] = [] + vodTranscodingProfileOptions: string[] = [] + liveTranscodingProfileOptions: string[] = [] + languageItems: SelectOptionsItem[] = [] categoryItems: SelectOptionsItem[] = [] @@ -101,6 +104,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A { value: 8, label: '8' } ] + this.vodTranscodingProfileOptions = [ 'default' ] + this.liveTranscodingProfileOptions = [ 'default' ] + this.liveMaxDurationOptions = [ { value: -1, label: $localize`No limit` }, { value: 1000 * 3600, label: $localize`1 hour` }, @@ -127,6 +133,14 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A return this.serverConfig.live.rtmp.port } + getAvailableTranscodingProfile (type: 'live' | 'vod') { + if (type === 'live') { + return this.serverConfig.live.transcoding.availableProfiles + } + + return this.serverConfig.transcoding.availableProfiles + } + getTotalTranscodingThreads () { const transcodingEnabled = this.form.value['transcoding']['enabled'] const transcodingThreads = this.form.value['transcoding']['threads'] @@ -247,6 +261,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A threads: TRANSCODING_THREADS_VALIDATOR, allowAdditionalExtensions: null, allowAudioFiles: null, + profile: null, resolutions: {}, hls: { enabled: null @@ -266,6 +281,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A transcoding: { enabled: null, threads: TRANSCODING_THREADS_VALIDATOR, + profile: null, resolutions: {} } }, diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index a38883eee..39739afd0 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts @@ -66,6 +66,8 @@ export class ServerService { requiresEmailVerification: false }, transcoding: { + profile: 'default', + availableProfiles: [ 'default' ], enabledResolutions: [], hls: { enabled: false @@ -82,6 +84,8 @@ export class ServerService { maxUserLives: -1, transcoding: { enabled: false, + profile: 'default', + availableProfiles: [ 'default' ], enabledResolutions: [] }, rtmp: { -- cgit v1.2.3