diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-10 11:06:32 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-02-10 11:36:40 +0100 |
commit | 5f46d28ccac4a20fcbb12c96a047a84a08e485ae (patch) | |
tree | 6529920195176736d187b93bcac8f3ad6920853d /client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts | |
parent | 53e4e201797aa1b581209ffd775bf05197efa78f (diff) | |
download | PeerTube-5f46d28ccac4a20fcbb12c96a047a84a08e485ae.tar.gz PeerTube-5f46d28ccac4a20fcbb12c96a047a84a08e485ae.tar.zst PeerTube-5f46d28ccac4a20fcbb12c96a047a84a08e485ae.zip |
Split admin conf page
Diffstat (limited to 'client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts')
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts new file mode 100644 index 000000000..a82a40a84 --- /dev/null +++ b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts | |||
@@ -0,0 +1,67 @@ | |||
1 | |||
2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' | ||
3 | import { Component, Input, OnInit } from '@angular/core' | ||
4 | import { FormGroup } from '@angular/forms' | ||
5 | import { ServerConfig } from '@shared/models' | ||
6 | import { ConfigService } from '../shared/config.service' | ||
7 | import { EditConfigurationService, ResolutionOption } from './edit-configuration.service' | ||
8 | |||
9 | @Component({ | ||
10 | selector: 'my-edit-live-configuration', | ||
11 | templateUrl: './edit-live-configuration.component.html', | ||
12 | styleUrls: [ './edit-custom-config.component.scss' ] | ||
13 | }) | ||
14 | export class EditLiveConfigurationComponent implements OnInit { | ||
15 | @Input() form: FormGroup | ||
16 | @Input() formErrors: any | ||
17 | @Input() serverConfig: ServerConfig | ||
18 | |||
19 | transcodingThreadOptions: SelectOptionsItem[] = [] | ||
20 | liveMaxDurationOptions: SelectOptionsItem[] = [] | ||
21 | liveResolutions: ResolutionOption[] = [] | ||
22 | |||
23 | constructor ( | ||
24 | private configService: ConfigService, | ||
25 | private editConfigurationService: EditConfigurationService | ||
26 | ) { } | ||
27 | |||
28 | ngOnInit () { | ||
29 | this.transcodingThreadOptions = this.configService.transcodingThreadOptions | ||
30 | |||
31 | this.liveMaxDurationOptions = [ | ||
32 | { id: -1, label: $localize`No limit` }, | ||
33 | { id: 1000 * 3600, label: $localize`1 hour` }, | ||
34 | { id: 1000 * 3600 * 3, label: $localize`3 hours` }, | ||
35 | { id: 1000 * 3600 * 5, label: $localize`5 hours` }, | ||
36 | { id: 1000 * 3600 * 10, label: $localize`10 hours` } | ||
37 | ] | ||
38 | |||
39 | this.liveResolutions = this.editConfigurationService.getLiveResolutions() | ||
40 | } | ||
41 | |||
42 | getAvailableTranscodingProfile () { | ||
43 | const profiles = this.serverConfig.live.transcoding.availableProfiles | ||
44 | |||
45 | return profiles.map(p => ({ id: p, label: p })) | ||
46 | } | ||
47 | |||
48 | getResolutionKey (resolution: string) { | ||
49 | return 'live.transcoding.resolutions.' + resolution | ||
50 | } | ||
51 | |||
52 | getLiveRTMPPort () { | ||
53 | return this.serverConfig.live.rtmp.port | ||
54 | } | ||
55 | |||
56 | isLiveEnabled () { | ||
57 | return this.editConfigurationService.isLiveEnabled(this.form) | ||
58 | } | ||
59 | |||
60 | isLiveTranscodingEnabled () { | ||
61 | return this.editConfigurationService.isLiveTranscodingEnabled(this.form) | ||
62 | } | ||
63 | |||
64 | getTotalTranscodingThreads () { | ||
65 | return this.editConfigurationService.getTotalTranscodingThreads(this.form) | ||
66 | } | ||
67 | } | ||