Support transcoding profile in client admin
This commit is contained in:
parent
1896bca09e
commit
80ac2e5548
|
@ -883,6 +883,20 @@
|
|||
<div *ngIf="formErrors.transcoding.threads" class="form-error">{{ formErrors.transcoding.threads }}</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-4" [ngClass]="{ 'disabled-checkbox-extra': !isTranscodingEnabled() }">
|
||||
<label i18n for="transcodingProfile">Transcoding profile</label>
|
||||
<span class="text-muted ml-1" i18n>New transcoding profiles can be added by PeerTube plugins</span>
|
||||
|
||||
<div class="peertube-select-container">
|
||||
<select id="transcodingProfile" formControlName="profile" class="form-control">
|
||||
<option *ngFor="let vodTranscodingProfileOption of getAvailableTranscodingProfile('vod')" [value]="vodTranscodingProfileOption">
|
||||
{{ vodTranscodingProfileOption }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div *ngIf="formErrors.transcoding.profile" class="form-error">{{ formErrors.transcoding.profile }}</div>
|
||||
</div>
|
||||
|
||||
</ng-container>
|
||||
|
||||
</div>
|
||||
|
@ -1023,6 +1037,20 @@
|
|||
<div *ngIf="formErrors.live.transcoding.threads" class="form-error">{{ formErrors.live.transcoding.threads }}</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-4" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() || !isLiveTranscodingEnabled() }">
|
||||
<label i18n for="liveTranscodingProfile">Live transcoding profile</label>
|
||||
<span class="text-muted ml-1" i18n>New live transcoding profiles can be added by PeerTube plugins</span>
|
||||
|
||||
<div class="peertube-select-container">
|
||||
<select id="liveTranscodingProfile" formControlName="profile" class="form-control">
|
||||
<option *ngFor="let liveTranscodingProfileOption of getAvailableTranscodingProfile('live')" [value]="liveTranscodingProfileOption">
|
||||
{{ liveTranscodingProfileOption }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div *ngIf="formErrors.live.transcoding.profile" class="form-error">{{ formErrors.live.transcoding.profile }}</div>
|
||||
</div>
|
||||
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
||||
|
|
|
@ -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: {}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -22,6 +22,7 @@ function checkMissedConfig () {
|
|||
'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist',
|
||||
'redundancy.videos.strategies', 'redundancy.videos.check_interval',
|
||||
'transcoding.enabled', 'transcoding.threads', 'transcoding.allow_additional_extensions', 'transcoding.hls.enabled',
|
||||
'transcoding.profile',
|
||||
'transcoding.resolutions.0p', 'transcoding.resolutions.240p', 'transcoding.resolutions.360p', 'transcoding.resolutions.480p',
|
||||
'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.1440p', 'transcoding.resolutions.2160p',
|
||||
'import.videos.http.enabled', 'import.videos.torrent.enabled', 'auto_blacklist.videos.of_users.enabled',
|
||||
|
@ -39,7 +40,7 @@ function checkMissedConfig () {
|
|||
'search.remote_uri.users', 'search.remote_uri.anonymous', 'search.search_index.enabled', 'search.search_index.url',
|
||||
'search.search_index.disable_local_search', 'search.search_index.is_default_search',
|
||||
'live.enabled', 'live.allow_replay', 'live.max_duration', 'live.max_user_lives', 'live.max_instance_lives',
|
||||
'live.transcoding.enabled', 'live.transcoding.threads',
|
||||
'live.transcoding.enabled', 'live.transcoding.threads', 'live.transcoding.profile',
|
||||
'live.transcoding.resolutions.240p', 'live.transcoding.resolutions.360p', 'live.transcoding.resolutions.480p',
|
||||
'live.transcoding.resolutions.720p', 'live.transcoding.resolutions.1080p', 'live.transcoding.resolutions.1440p',
|
||||
'live.transcoding.resolutions.2160p'
|
||||
|
|
Loading…
Reference in New Issue