From fb7194043d0486ce0a6a40b2ffbdf32878c33a6f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 25 Sep 2020 16:19:35 +0200 Subject: Check live duration and size --- .../edit-custom-config.component.html | 102 +++++++++++++-------- .../edit-custom-config.component.ts | 30 +++++- client/src/app/core/server/server.service.ts | 2 + 3 files changed, 97 insertions(+), 37 deletions(-) (limited to 'client/src') 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 8000f471f..2f3202e06 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 @@ -699,7 +699,7 @@ - +
Live streaming @@ -722,54 +722,78 @@ Allow live streaming - - Enabling live streaming requires trust in your users and extra moderation work - + + ⚠️ Enabling live streaming requires trust in your users and extra moderation work + - +
- - Requires a lot of CPU! + + If the user quota is reached, PeerTube will automatically terminate the live streaming
-
- +
+
- +
-
{{ formErrors.live.transcoding.threads }}
-
- - - -
- -
- - -
-
-
-
-
+ + +
+ + + Requires a lot of CPU! + +
-
+ +
+ +
+ +
+
{{ formErrors.live.transcoding.threads }}
+
+ +
+ + +
+ +
+ + +
+
+
+
+
+
+
+
@@ -778,7 +802,7 @@
-
+
Advanced configuration @@ -1026,9 +1050,15 @@
- It seems like the configuration is invalid. Please search for potential errors in the different tabs. + + It seems like the configuration is invalid. Please search for potential errors in the different tabs. + + + + You cannot allow live replay if you don't enable transcoding. + - +
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 de800c87e..745238647 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 @@ -36,6 +36,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A resolutions: { id: string, label: string, description?: string }[] = [] liveResolutions: { id: string, label: string, description?: string }[] = [] transcodingThreadOptions: { label: string, value: number }[] = [] + liveMaxDurationOptions: { label: string, value: number }[] = [] languageItems: SelectOptionsItem[] = [] categoryItems: SelectOptionsItem[] = [] @@ -92,6 +93,14 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A { value: 4, label: '4' }, { value: 8, label: '8' } ] + + this.liveMaxDurationOptions = [ + { value: 0, label: $localize`No limit` }, + { value: 1000 * 3600, label: $localize`1 hour` }, + { value: 1000 * 3600 * 3, label: $localize`3 hours` }, + { value: 1000 * 3600 * 5, label: $localize`5 hours` }, + { value: 1000 * 3600 * 10, label: $localize`10 hours` } + ] } get videoQuotaOptions () { @@ -114,7 +123,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A ngOnInit () { this.serverConfig = this.serverService.getTmpConfig() this.serverService.getConfig() - .subscribe(config => this.serverConfig = config) + .subscribe(config => { + this.serverConfig = config + }) const formGroupData: { [key in keyof CustomConfig ]: any } = { instance: { @@ -204,6 +215,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A live: { enabled: null, + maxDuration: null, + allowReplay: null, + transcoding: { enabled: null, threads: TRANSCODING_THREADS_VALIDATOR, @@ -341,6 +355,20 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A } } + hasConsistentOptions () { + if (this.hasLiveAllowReplayConsistentOptions()) return true + + return false + } + + hasLiveAllowReplayConsistentOptions () { + if (this.isTranscodingEnabled() === false && this.isLiveEnabled() && this.form.value['live']['allowReplay'] === true) { + return false + } + + return true + } + private updateForm () { this.form.patchValue(this.customConfig) } diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index bc76bacfc..c19c3c12e 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts @@ -76,6 +76,8 @@ export class ServerService { }, live: { enabled: false, + allowReplay: true, + maxDuration: null, transcoding: { enabled: false, enabledResolutions: [] -- cgit v1.2.3