diff options
Diffstat (limited to 'client/src/app/+videos/+video-edit')
3 files changed, 38 insertions, 2 deletions
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.html b/client/src/app/+videos/+video-edit/shared/video-edit.component.html index 2281f8631..515daf15f 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.html | |||
@@ -289,6 +289,17 @@ | |||
289 | </ng-container> | 289 | </ng-container> |
290 | </my-peertube-checkbox> | 290 | </my-peertube-checkbox> |
291 | </div> | 291 | </div> |
292 | |||
293 | <div class="form-group" *ngIf="isLatencyModeEnabled()"> | ||
294 | <label i18n for="latencyMode">Latency mode</label> | ||
295 | <my-select-options | ||
296 | labelForId="latencyMode" [items]="latencyModes" formControlName="latencyMode" [clearable]="true" | ||
297 | ></my-select-options> | ||
298 | |||
299 | <div *ngIf="formErrors.latencyMode" class="form-error"> | ||
300 | {{ formErrors.latencyMode }} | ||
301 | </div> | ||
302 | </div> | ||
292 | </div> | 303 | </div> |
293 | </div> | 304 | </div> |
294 | </ng-template> | 305 | </ng-template> |
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts index 2801fc519..a2399eafb 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { forkJoin } from 'rxjs' | 1 | import { forkJoin } from 'rxjs' |
2 | import { map } from 'rxjs/operators' | 2 | import { map } from 'rxjs/operators' |
3 | import { SelectChannelItem } from 'src/types/select-options-item.model' | 3 | import { SelectChannelItem, SelectOptionsItem } from 'src/types/select-options-item.model' |
4 | import { ChangeDetectorRef, Component, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' | 4 | import { ChangeDetectorRef, Component, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' |
5 | import { AbstractControl, FormArray, FormControl, FormGroup, Validators } from '@angular/forms' | 5 | import { AbstractControl, FormArray, FormControl, FormGroup, Validators } from '@angular/forms' |
6 | import { HooksService, PluginService, ServerService } from '@app/core' | 6 | import { HooksService, PluginService, ServerService } from '@app/core' |
@@ -26,6 +26,7 @@ import { PluginInfo } from '@root-helpers/plugins-manager' | |||
26 | import { | 26 | import { |
27 | HTMLServerConfig, | 27 | HTMLServerConfig, |
28 | LiveVideo, | 28 | LiveVideo, |
29 | LiveVideoLatencyMode, | ||
29 | RegisterClientFormFieldOptions, | 30 | RegisterClientFormFieldOptions, |
30 | RegisterClientVideoFieldOptions, | 31 | RegisterClientVideoFieldOptions, |
31 | VideoConstant, | 32 | VideoConstant, |
@@ -78,6 +79,23 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
78 | videoCategories: VideoConstant<number>[] = [] | 79 | videoCategories: VideoConstant<number>[] = [] |
79 | videoLicences: VideoConstant<number>[] = [] | 80 | videoLicences: VideoConstant<number>[] = [] |
80 | videoLanguages: VideoLanguages[] = [] | 81 | videoLanguages: VideoLanguages[] = [] |
82 | latencyModes: SelectOptionsItem[] = [ | ||
83 | { | ||
84 | id: LiveVideoLatencyMode.SMALL_LATENCY, | ||
85 | label: $localize`Small latency`, | ||
86 | description: $localize`Reduce latency to ~15s disabling P2P` | ||
87 | }, | ||
88 | { | ||
89 | id: LiveVideoLatencyMode.DEFAULT, | ||
90 | label: $localize`Default`, | ||
91 | description: $localize`Average latency of 30s` | ||
92 | }, | ||
93 | { | ||
94 | id: LiveVideoLatencyMode.HIGH_LATENCY, | ||
95 | label: $localize`High latency`, | ||
96 | description: $localize`Average latency of 60s increasing P2P ratio` | ||
97 | } | ||
98 | ] | ||
81 | 99 | ||
82 | pluginDataFormGroup: FormGroup | 100 | pluginDataFormGroup: FormGroup |
83 | 101 | ||
@@ -141,6 +159,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
141 | originallyPublishedAt: VIDEO_ORIGINALLY_PUBLISHED_AT_VALIDATOR, | 159 | originallyPublishedAt: VIDEO_ORIGINALLY_PUBLISHED_AT_VALIDATOR, |
142 | liveStreamKey: null, | 160 | liveStreamKey: null, |
143 | permanentLive: null, | 161 | permanentLive: null, |
162 | latencyMode: null, | ||
144 | saveReplay: null | 163 | saveReplay: null |
145 | } | 164 | } |
146 | 165 | ||
@@ -273,6 +292,10 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
273 | return this.form.value['permanentLive'] === true | 292 | return this.form.value['permanentLive'] === true |
274 | } | 293 | } |
275 | 294 | ||
295 | isLatencyModeEnabled () { | ||
296 | return this.serverConfig.live.latencySetting.enabled | ||
297 | } | ||
298 | |||
276 | isPluginFieldHidden (pluginField: PluginField) { | 299 | isPluginFieldHidden (pluginField: PluginField) { |
277 | if (typeof pluginField.commonOptions.hidden !== 'function') return false | 300 | if (typeof pluginField.commonOptions.hidden !== 'function') return false |
278 | 301 | ||
diff --git a/client/src/app/+videos/+video-edit/video-update.component.ts b/client/src/app/+videos/+video-edit/video-update.component.ts index d9e8344fc..9c4998f2e 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.ts +++ b/client/src/app/+videos/+video-edit/video-update.component.ts | |||
@@ -64,6 +64,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
64 | if (this.liveVideo) { | 64 | if (this.liveVideo) { |
65 | this.form.patchValue({ | 65 | this.form.patchValue({ |
66 | saveReplay: this.liveVideo.saveReplay, | 66 | saveReplay: this.liveVideo.saveReplay, |
67 | latencyMode: this.liveVideo.latencyMode, | ||
67 | permanentLive: this.liveVideo.permanentLive | 68 | permanentLive: this.liveVideo.permanentLive |
68 | }) | 69 | }) |
69 | } | 70 | } |
@@ -127,7 +128,8 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
127 | 128 | ||
128 | const liveVideoUpdate: LiveVideoUpdate = { | 129 | const liveVideoUpdate: LiveVideoUpdate = { |
129 | saveReplay: !!this.form.value.saveReplay, | 130 | saveReplay: !!this.form.value.saveReplay, |
130 | permanentLive: !!this.form.value.permanentLive | 131 | permanentLive: !!this.form.value.permanentLive, |
132 | latencyMode: this.form.value.latencyMode | ||
131 | } | 133 | } |
132 | 134 | ||
133 | // Don't update live attributes if they did not change | 135 | // Don't update live attributes if they did not change |