diff options
author | Chocobozzz <me@florianbigard.com> | 2021-01-28 16:10:09 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-01-28 16:10:09 +0100 |
commit | 80ac2e5548bf5167d2f243a3cb0e993c75456d76 (patch) | |
tree | 1f1d2d7004283c48a4b142182a58fb79e68991a3 /client/src | |
parent | 1896bca09e088b0da9d5e845407ecebae330618c (diff) | |
download | PeerTube-80ac2e5548bf5167d2f243a3cb0e993c75456d76.tar.gz PeerTube-80ac2e5548bf5167d2f243a3cb0e993c75456d76.tar.zst PeerTube-80ac2e5548bf5167d2f243a3cb0e993c75456d76.zip |
Support transcoding profile in client admin
Diffstat (limited to 'client/src')
3 files changed, 49 insertions, 1 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 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 @@ | |||
883 | <div *ngIf="formErrors.transcoding.threads" class="form-error">{{ formErrors.transcoding.threads }}</div> | 883 | <div *ngIf="formErrors.transcoding.threads" class="form-error">{{ formErrors.transcoding.threads }}</div> |
884 | </div> | 884 | </div> |
885 | 885 | ||
886 | <div class="form-group mt-4" [ngClass]="{ 'disabled-checkbox-extra': !isTranscodingEnabled() }"> | ||
887 | <label i18n for="transcodingProfile">Transcoding profile</label> | ||
888 | <span class="text-muted ml-1" i18n>New transcoding profiles can be added by PeerTube plugins</span> | ||
889 | |||
890 | <div class="peertube-select-container"> | ||
891 | <select id="transcodingProfile" formControlName="profile" class="form-control"> | ||
892 | <option *ngFor="let vodTranscodingProfileOption of getAvailableTranscodingProfile('vod')" [value]="vodTranscodingProfileOption"> | ||
893 | {{ vodTranscodingProfileOption }} | ||
894 | </option> | ||
895 | </select> | ||
896 | </div> | ||
897 | <div *ngIf="formErrors.transcoding.profile" class="form-error">{{ formErrors.transcoding.profile }}</div> | ||
898 | </div> | ||
899 | |||
886 | </ng-container> | 900 | </ng-container> |
887 | 901 | ||
888 | </div> | 902 | </div> |
@@ -1023,6 +1037,20 @@ | |||
1023 | <div *ngIf="formErrors.live.transcoding.threads" class="form-error">{{ formErrors.live.transcoding.threads }}</div> | 1037 | <div *ngIf="formErrors.live.transcoding.threads" class="form-error">{{ formErrors.live.transcoding.threads }}</div> |
1024 | </div> | 1038 | </div> |
1025 | 1039 | ||
1040 | <div class="form-group mt-4" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() || !isLiveTranscodingEnabled() }"> | ||
1041 | <label i18n for="liveTranscodingProfile">Live transcoding profile</label> | ||
1042 | <span class="text-muted ml-1" i18n>New live transcoding profiles can be added by PeerTube plugins</span> | ||
1043 | |||
1044 | <div class="peertube-select-container"> | ||
1045 | <select id="liveTranscodingProfile" formControlName="profile" class="form-control"> | ||
1046 | <option *ngFor="let liveTranscodingProfileOption of getAvailableTranscodingProfile('live')" [value]="liveTranscodingProfileOption"> | ||
1047 | {{ liveTranscodingProfileOption }} | ||
1048 | </option> | ||
1049 | </select> | ||
1050 | </div> | ||
1051 | <div *ngIf="formErrors.live.transcoding.profile" class="form-error">{{ formErrors.live.transcoding.profile }}</div> | ||
1052 | </div> | ||
1053 | |||
1026 | </ng-container> | 1054 | </ng-container> |
1027 | </ng-container> | 1055 | </ng-container> |
1028 | 1056 | ||
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 @@ | |||
1 | import { forkJoin } from 'rxjs' | 1 | import { forkJoin } from 'rxjs' |
2 | import { pairwise } from 'rxjs/operators' | ||
2 | import { ViewportScroller } from '@angular/common' | 3 | import { ViewportScroller } from '@angular/common' |
3 | import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' | 4 | import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' |
4 | import { ConfigService } from '@app/+admin/config/shared/config.service' | 5 | 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 | |||
20 | import { FormReactive, FormValidatorService, SelectOptionsItem } from '@app/shared/shared-forms' | 21 | import { FormReactive, FormValidatorService, SelectOptionsItem } from '@app/shared/shared-forms' |
21 | import { NgbNav } from '@ng-bootstrap/ng-bootstrap' | 22 | import { NgbNav } from '@ng-bootstrap/ng-bootstrap' |
22 | import { CustomConfig, ServerConfig } from '@shared/models' | 23 | import { CustomConfig, ServerConfig } from '@shared/models' |
23 | import { pairwise } from 'rxjs/operators' | ||
24 | 24 | ||
25 | @Component({ | 25 | @Component({ |
26 | selector: 'my-edit-custom-config', | 26 | selector: 'my-edit-custom-config', |
@@ -39,6 +39,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
39 | transcodingThreadOptions: { label: string, value: number }[] = [] | 39 | transcodingThreadOptions: { label: string, value: number }[] = [] |
40 | liveMaxDurationOptions: { label: string, value: number }[] = [] | 40 | liveMaxDurationOptions: { label: string, value: number }[] = [] |
41 | 41 | ||
42 | vodTranscodingProfileOptions: string[] = [] | ||
43 | liveTranscodingProfileOptions: string[] = [] | ||
44 | |||
42 | languageItems: SelectOptionsItem[] = [] | 45 | languageItems: SelectOptionsItem[] = [] |
43 | categoryItems: SelectOptionsItem[] = [] | 46 | categoryItems: SelectOptionsItem[] = [] |
44 | 47 | ||
@@ -101,6 +104,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
101 | { value: 8, label: '8' } | 104 | { value: 8, label: '8' } |
102 | ] | 105 | ] |
103 | 106 | ||
107 | this.vodTranscodingProfileOptions = [ 'default' ] | ||
108 | this.liveTranscodingProfileOptions = [ 'default' ] | ||
109 | |||
104 | this.liveMaxDurationOptions = [ | 110 | this.liveMaxDurationOptions = [ |
105 | { value: -1, label: $localize`No limit` }, | 111 | { value: -1, label: $localize`No limit` }, |
106 | { value: 1000 * 3600, label: $localize`1 hour` }, | 112 | { value: 1000 * 3600, label: $localize`1 hour` }, |
@@ -127,6 +133,14 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
127 | return this.serverConfig.live.rtmp.port | 133 | return this.serverConfig.live.rtmp.port |
128 | } | 134 | } |
129 | 135 | ||
136 | getAvailableTranscodingProfile (type: 'live' | 'vod') { | ||
137 | if (type === 'live') { | ||
138 | return this.serverConfig.live.transcoding.availableProfiles | ||
139 | } | ||
140 | |||
141 | return this.serverConfig.transcoding.availableProfiles | ||
142 | } | ||
143 | |||
130 | getTotalTranscodingThreads () { | 144 | getTotalTranscodingThreads () { |
131 | const transcodingEnabled = this.form.value['transcoding']['enabled'] | 145 | const transcodingEnabled = this.form.value['transcoding']['enabled'] |
132 | const transcodingThreads = this.form.value['transcoding']['threads'] | 146 | const transcodingThreads = this.form.value['transcoding']['threads'] |
@@ -247,6 +261,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
247 | threads: TRANSCODING_THREADS_VALIDATOR, | 261 | threads: TRANSCODING_THREADS_VALIDATOR, |
248 | allowAdditionalExtensions: null, | 262 | allowAdditionalExtensions: null, |
249 | allowAudioFiles: null, | 263 | allowAudioFiles: null, |
264 | profile: null, | ||
250 | resolutions: {}, | 265 | resolutions: {}, |
251 | hls: { | 266 | hls: { |
252 | enabled: null | 267 | enabled: null |
@@ -266,6 +281,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
266 | transcoding: { | 281 | transcoding: { |
267 | enabled: null, | 282 | enabled: null, |
268 | threads: TRANSCODING_THREADS_VALIDATOR, | 283 | threads: TRANSCODING_THREADS_VALIDATOR, |
284 | profile: null, | ||
269 | resolutions: {} | 285 | resolutions: {} |
270 | } | 286 | } |
271 | }, | 287 | }, |
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 { | |||
66 | requiresEmailVerification: false | 66 | requiresEmailVerification: false |
67 | }, | 67 | }, |
68 | transcoding: { | 68 | transcoding: { |
69 | profile: 'default', | ||
70 | availableProfiles: [ 'default' ], | ||
69 | enabledResolutions: [], | 71 | enabledResolutions: [], |
70 | hls: { | 72 | hls: { |
71 | enabled: false | 73 | enabled: false |
@@ -82,6 +84,8 @@ export class ServerService { | |||
82 | maxUserLives: -1, | 84 | maxUserLives: -1, |
83 | transcoding: { | 85 | transcoding: { |
84 | enabled: false, | 86 | enabled: false, |
87 | profile: 'default', | ||
88 | availableProfiles: [ 'default' ], | ||
85 | enabledResolutions: [] | 89 | enabledResolutions: [] |
86 | }, | 90 | }, |
87 | rtmp: { | 91 | rtmp: { |