aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html102
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts30
-rw-r--r--client/src/app/core/server/server.service.ts2
3 files changed, 97 insertions, 37 deletions
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 @@
699 </ng-template> 699 </ng-template>
700 </ng-container> 700 </ng-container>
701 701
702 <ng-container ngbNavItem="live"> 702 <div ngbNavItem="live">
703 <a ngbNavLink i18n>Live streaming</a> 703 <a ngbNavLink i18n>Live streaming</a>
704 704
705 <ng-template ngbNavContent> 705 <ng-template ngbNavContent>
@@ -722,54 +722,78 @@
722 <ng-container i18n>Allow live streaming</ng-container> 722 <ng-container i18n>Allow live streaming</ng-container>
723 </ng-template> 723 </ng-template>
724 724
725 <ng-template ptTemplate="help"> 725 <ng-container ngProjectAs="description" i18n>
726 <ng-container i18n>Enabling live streaming requires trust in your users and extra moderation work</ng-container> 726 ⚠️ Enabling live streaming requires trust in your users and extra moderation work
727 </ng-template> 727 </ng-container>
728 728
729 <ng-container ngProjectAs="extra" formGroupName="transcoding"> 729 <ng-container ngProjectAs="extra">
730 730
731 <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() }"> 731 <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() }">
732 <my-peertube-checkbox 732 <my-peertube-checkbox
733 inputName="liveTranscodingEnabled" formControlName="enabled" 733 inputName="liveAllowReplay" formControlName="allowReplay"
734 i18n-labelText labelText="Enable live transcoding" 734 i18n-labelText labelText="Allow your users to automatically publish a replay of their live"
735 > 735 >
736 <ng-container ngProjectAs="description"> 736 <ng-container ngProjectAs="description" i18n>
737 Requires a lot of CPU! 737 If the user quota is reached, PeerTube will automatically terminate the live streaming
738 </ng-container> 738 </ng-container>
739 </my-peertube-checkbox> 739 </my-peertube-checkbox>
740 </div> 740 </div>
741 741
742 <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() || !isLiveTranscodingEnabled() }"> 742 <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() }">
743 <label i18n for="liveTranscodingThreads">Live transcoding threads</label> 743 <label i18n for="liveMaxDuration">Max live duration</label>
744 <div class="peertube-select-container"> 744 <div class="peertube-select-container">
745 <select id="liveTranscodingThreads" formControlName="threads" class="form-control"> 745 <select id="liveMaxDuration" formControlName="maxDuration" class="form-control">
746 <option *ngFor="let transcodingThreadOption of transcodingThreadOptions" [value]="transcodingThreadOption.value"> 746 <option *ngFor="let liveMaxDurationOption of liveMaxDurationOptions" [value]="liveMaxDurationOption.value">
747 {{ transcodingThreadOption.label }} 747 {{ liveMaxDurationOption.label }}
748 </option> 748 </option>
749 </select> 749 </select>
750 </div> 750 </div>
751 <div *ngIf="formErrors.live.transcoding.threads" class="form-error">{{ formErrors.live.transcoding.threads }}</div>
752 </div> 751 </div>
753 752
754 <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() || !isLiveTranscodingEnabled() }"> 753 <ng-container formGroupName="transcoding">
755 754
756 <label i18n for="liveTranscodingThreads">Live resolutions to generate</label> 755 <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() }">
757 756 <my-peertube-checkbox
758 <div class="ml-2 mt-2 d-flex flex-column"> 757 inputName="liveTranscodingEnabled" formControlName="enabled"
759 <ng-container formGroupName="resolutions"> 758 i18n-labelText labelText="Enable live transcoding"
760 <div class="form-group" *ngFor="let resolution of liveResolutions"> 759 >
761 <my-peertube-checkbox 760 <ng-container ngProjectAs="description" i18n>
762 [inputName]="getResolutionKey(resolution.id)" [formControlName]="resolution.id" 761 Requires a lot of CPU!
763 labelText="{{resolution.label}}" 762 </ng-container>
764 > 763 </my-peertube-checkbox>
765 <ng-template *ngIf="resolution.description" ptTemplate="help">
766 <div [innerHTML]="resolution.description"></div>
767 </ng-template>
768 </my-peertube-checkbox>
769 </div>
770 </ng-container>
771 </div> 764 </div>
772 </div> 765
766 <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() || !isLiveTranscodingEnabled() }">
767 <label i18n for="liveTranscodingThreads">Live transcoding threads</label>
768 <div class="peertube-select-container">
769 <select id="liveTranscodingThreads" formControlName="threads" class="form-control">
770 <option *ngFor="let transcodingThreadOption of transcodingThreadOptions" [value]="transcodingThreadOption.value">
771 {{ transcodingThreadOption.label }}
772 </option>
773 </select>
774 </div>
775 <div *ngIf="formErrors.live.transcoding.threads" class="form-error">{{ formErrors.live.transcoding.threads }}</div>
776 </div>
777
778 <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() || !isLiveTranscodingEnabled() }">
779 <label i18n for="liveTranscodingThreads">Live resolutions to generate</label>
780
781 <div class="ml-2 mt-2 d-flex flex-column">
782 <ng-container formGroupName="resolutions">
783 <div class="form-group" *ngFor="let resolution of liveResolutions">
784 <my-peertube-checkbox
785 [inputName]="getResolutionKey(resolution.id)" [formControlName]="resolution.id"
786 labelText="{{resolution.label}}"
787 >
788 <ng-template *ngIf="resolution.description" ptTemplate="help">
789 <div [innerHTML]="resolution.description"></div>
790 </ng-template>
791 </my-peertube-checkbox>
792 </div>
793 </ng-container>
794 </div>
795 </div>
796 </ng-container>
773 </ng-container> 797 </ng-container>
774 </my-peertube-checkbox> 798 </my-peertube-checkbox>
775 </div> 799 </div>
@@ -778,7 +802,7 @@
778 </div> 802 </div>
779 803
780 </ng-template> 804 </ng-template>
781 </ng-container> 805 </div>
782 806
783 <ng-container ngbNavItem="advanced-configuration"> 807 <ng-container ngbNavItem="advanced-configuration">
784 <a ngbNavLink i18n>Advanced configuration</a> 808 <a ngbNavLink i18n>Advanced configuration</a>
@@ -1026,9 +1050,15 @@
1026 <div class="form-row mt-4"> <!-- submit placement block --> 1050 <div class="form-row mt-4"> <!-- submit placement block -->
1027 <div class="col-md-7 col-xl-5"></div> 1051 <div class="col-md-7 col-xl-5"></div>
1028 <div class="col-md-5 col-xl-5"> 1052 <div class="col-md-5 col-xl-5">
1029 <span class="form-error submit-error" i18n *ngIf="!form.valid">It seems like the configuration is invalid. Please search for potential errors in the different tabs.</span> 1053 <span class="form-error submit-error" i18n *ngIf="!form.valid">
1054 It seems like the configuration is invalid. Please search for potential errors in the different tabs.
1055 </span>
1056
1057 <span class="form-error submit-error" i18n *ngIf="!hasLiveAllowReplayConsistentOptions()">
1058 You cannot allow live replay if you don't enable transcoding.
1059 </span>
1030 1060
1031 <input (click)="formValidated()" type="submit" i18n-value value="Update configuration" [disabled]="!form.valid"> 1061 <input (click)="formValidated()" type="submit" i18n-value value="Update configuration" [disabled]="!form.valid || !hasConsistentOptions()">
1032 </div> 1062 </div>
1033 </div> 1063 </div>
1034</form> 1064</form>
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
36 resolutions: { id: string, label: string, description?: string }[] = [] 36 resolutions: { id: string, label: string, description?: string }[] = []
37 liveResolutions: { id: string, label: string, description?: string }[] = [] 37 liveResolutions: { id: string, label: string, description?: string }[] = []
38 transcodingThreadOptions: { label: string, value: number }[] = [] 38 transcodingThreadOptions: { label: string, value: number }[] = []
39 liveMaxDurationOptions: { label: string, value: number }[] = []
39 40
40 languageItems: SelectOptionsItem[] = [] 41 languageItems: SelectOptionsItem[] = []
41 categoryItems: SelectOptionsItem[] = [] 42 categoryItems: SelectOptionsItem[] = []
@@ -92,6 +93,14 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
92 { value: 4, label: '4' }, 93 { value: 4, label: '4' },
93 { value: 8, label: '8' } 94 { value: 8, label: '8' }
94 ] 95 ]
96
97 this.liveMaxDurationOptions = [
98 { value: 0, label: $localize`No limit` },
99 { value: 1000 * 3600, label: $localize`1 hour` },
100 { value: 1000 * 3600 * 3, label: $localize`3 hours` },
101 { value: 1000 * 3600 * 5, label: $localize`5 hours` },
102 { value: 1000 * 3600 * 10, label: $localize`10 hours` }
103 ]
95 } 104 }
96 105
97 get videoQuotaOptions () { 106 get videoQuotaOptions () {
@@ -114,7 +123,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
114 ngOnInit () { 123 ngOnInit () {
115 this.serverConfig = this.serverService.getTmpConfig() 124 this.serverConfig = this.serverService.getTmpConfig()
116 this.serverService.getConfig() 125 this.serverService.getConfig()
117 .subscribe(config => this.serverConfig = config) 126 .subscribe(config => {
127 this.serverConfig = config
128 })
118 129
119 const formGroupData: { [key in keyof CustomConfig ]: any } = { 130 const formGroupData: { [key in keyof CustomConfig ]: any } = {
120 instance: { 131 instance: {
@@ -204,6 +215,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
204 live: { 215 live: {
205 enabled: null, 216 enabled: null,
206 217
218 maxDuration: null,
219 allowReplay: null,
220
207 transcoding: { 221 transcoding: {
208 enabled: null, 222 enabled: null,
209 threads: TRANSCODING_THREADS_VALIDATOR, 223 threads: TRANSCODING_THREADS_VALIDATOR,
@@ -341,6 +355,20 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
341 } 355 }
342 } 356 }
343 357
358 hasConsistentOptions () {
359 if (this.hasLiveAllowReplayConsistentOptions()) return true
360
361 return false
362 }
363
364 hasLiveAllowReplayConsistentOptions () {
365 if (this.isTranscodingEnabled() === false && this.isLiveEnabled() && this.form.value['live']['allowReplay'] === true) {
366 return false
367 }
368
369 return true
370 }
371
344 private updateForm () { 372 private updateForm () {
345 this.form.patchValue(this.customConfig) 373 this.form.patchValue(this.customConfig)
346 } 374 }
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 {
76 }, 76 },
77 live: { 77 live: {
78 enabled: false, 78 enabled: false,
79 allowReplay: true,
80 maxDuration: null,
79 transcoding: { 81 transcoding: {
80 enabled: false, 82 enabled: false,
81 enabledResolutions: [] 83 enabledResolutions: []