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 | |
parent | 1896bca09e088b0da9d5e845407ecebae330618c (diff) | |
download | PeerTube-80ac2e5548bf5167d2f243a3cb0e993c75456d76.tar.gz PeerTube-80ac2e5548bf5167d2f243a3cb0e993c75456d76.tar.zst PeerTube-80ac2e5548bf5167d2f243a3cb0e993c75456d76.zip |
Support transcoding profile in client admin
4 files changed, 51 insertions, 2 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: { |
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts index 9c4e0048a..7cc073603 100644 --- a/server/initializers/checker-before-init.ts +++ b/server/initializers/checker-before-init.ts | |||
@@ -22,6 +22,7 @@ function checkMissedConfig () { | |||
22 | 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist', | 22 | 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist', |
23 | 'redundancy.videos.strategies', 'redundancy.videos.check_interval', | 23 | 'redundancy.videos.strategies', 'redundancy.videos.check_interval', |
24 | 'transcoding.enabled', 'transcoding.threads', 'transcoding.allow_additional_extensions', 'transcoding.hls.enabled', | 24 | 'transcoding.enabled', 'transcoding.threads', 'transcoding.allow_additional_extensions', 'transcoding.hls.enabled', |
25 | 'transcoding.profile', | ||
25 | 'transcoding.resolutions.0p', 'transcoding.resolutions.240p', 'transcoding.resolutions.360p', 'transcoding.resolutions.480p', | 26 | 'transcoding.resolutions.0p', 'transcoding.resolutions.240p', 'transcoding.resolutions.360p', 'transcoding.resolutions.480p', |
26 | 'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.1440p', 'transcoding.resolutions.2160p', | 27 | 'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.1440p', 'transcoding.resolutions.2160p', |
27 | 'import.videos.http.enabled', 'import.videos.torrent.enabled', 'auto_blacklist.videos.of_users.enabled', | 28 | 'import.videos.http.enabled', 'import.videos.torrent.enabled', 'auto_blacklist.videos.of_users.enabled', |
@@ -39,7 +40,7 @@ function checkMissedConfig () { | |||
39 | 'search.remote_uri.users', 'search.remote_uri.anonymous', 'search.search_index.enabled', 'search.search_index.url', | 40 | 'search.remote_uri.users', 'search.remote_uri.anonymous', 'search.search_index.enabled', 'search.search_index.url', |
40 | 'search.search_index.disable_local_search', 'search.search_index.is_default_search', | 41 | 'search.search_index.disable_local_search', 'search.search_index.is_default_search', |
41 | 'live.enabled', 'live.allow_replay', 'live.max_duration', 'live.max_user_lives', 'live.max_instance_lives', | 42 | 'live.enabled', 'live.allow_replay', 'live.max_duration', 'live.max_user_lives', 'live.max_instance_lives', |
42 | 'live.transcoding.enabled', 'live.transcoding.threads', | 43 | 'live.transcoding.enabled', 'live.transcoding.threads', 'live.transcoding.profile', |
43 | 'live.transcoding.resolutions.240p', 'live.transcoding.resolutions.360p', 'live.transcoding.resolutions.480p', | 44 | 'live.transcoding.resolutions.240p', 'live.transcoding.resolutions.360p', 'live.transcoding.resolutions.480p', |
44 | 'live.transcoding.resolutions.720p', 'live.transcoding.resolutions.1080p', 'live.transcoding.resolutions.1440p', | 45 | 'live.transcoding.resolutions.720p', 'live.transcoding.resolutions.1080p', 'live.transcoding.resolutions.1440p', |
45 | 'live.transcoding.resolutions.2160p' | 46 | 'live.transcoding.resolutions.2160p' |