diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-23 10:53:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-23 10:53:16 +0200 |
commit | 64324ac646b0938e35cd88771492623b640bd0d8 (patch) | |
tree | 7d702cf4f79d5a39edcdf244d961f059d08d2105 /client | |
parent | 2c2befaacaa7063df0d4557b71c187ee168a8eb6 (diff) | |
parent | b6898035bfc5ba60ec54f7e61ff832e5e2ac30eb (diff) | |
download | PeerTube-64324ac646b0938e35cd88771492623b640bd0d8.tar.gz PeerTube-64324ac646b0938e35cd88771492623b640bd0d8.tar.zst PeerTube-64324ac646b0938e35cd88771492623b640bd0d8.zip |
Merge branch 'release/4.2.0' into develop
Diffstat (limited to 'client')
-rw-r--r-- | client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts | 6 | ||||
-rw-r--r-- | client/src/assets/player/shared/common/utils.ts | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts index d81f577b2..80e5a73da 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts | |||
@@ -7,7 +7,7 @@ import { FormValidatorService } from '@app/shared/shared-forms' | |||
7 | import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' | 7 | import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' |
8 | import { LiveVideoService } from '@app/shared/shared-video-live' | 8 | import { LiveVideoService } from '@app/shared/shared-video-live' |
9 | import { LoadingBarService } from '@ngx-loading-bar/core' | 9 | import { LoadingBarService } from '@ngx-loading-bar/core' |
10 | import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' | 10 | import { LiveVideo, LiveVideoCreate, LiveVideoLatencyMode, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' |
11 | import { VideoSend } from './video-send' | 11 | import { VideoSend } from './video-send' |
12 | 12 | ||
13 | @Component({ | 13 | @Component({ |
@@ -71,12 +71,13 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
71 | nsfw: this.serverConfig.instance.isNSFW, | 71 | nsfw: this.serverConfig.instance.isNSFW, |
72 | waitTranscoding: true, | 72 | waitTranscoding: true, |
73 | permanentLive: this.firstStepPermanentLive, | 73 | permanentLive: this.firstStepPermanentLive, |
74 | latencyMode: LiveVideoLatencyMode.DEFAULT, | ||
74 | saveReplay: this.isReplayAllowed(), | 75 | saveReplay: this.isReplayAllowed(), |
75 | channelId: this.firstStepChannelId | 76 | channelId: this.firstStepChannelId |
76 | } | 77 | } |
77 | 78 | ||
78 | // Go live in private mode, but correctly fill the update form with the first user choice | 79 | // Go live in private mode, but correctly fill the update form with the first user choice |
79 | const toPatch = Object.assign({}, video, { privacy: this.firstStepPrivacyId }) | 80 | const toPatch = { ...video, privacy: this.firstStepPrivacyId } |
80 | this.form.patchValue(toPatch) | 81 | this.form.patchValue(toPatch) |
81 | 82 | ||
82 | this.liveVideoService.goLive(video) | 83 | this.liveVideoService.goLive(video) |
@@ -121,6 +122,7 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
121 | 122 | ||
122 | const liveVideoUpdate: LiveVideoUpdate = { | 123 | const liveVideoUpdate: LiveVideoUpdate = { |
123 | saveReplay: this.form.value.saveReplay, | 124 | saveReplay: this.form.value.saveReplay, |
125 | latencyMode: this.form.value.latencyMode, | ||
124 | permanentLive: this.form.value.permanentLive | 126 | permanentLive: this.form.value.permanentLive |
125 | } | 127 | } |
126 | 128 | ||
diff --git a/client/src/assets/player/shared/common/utils.ts b/client/src/assets/player/shared/common/utils.ts index da7dda0c7..a010d9184 100644 --- a/client/src/assets/player/shared/common/utils.ts +++ b/client/src/assets/player/shared/common/utils.ts | |||
@@ -4,17 +4,15 @@ function toTitleCase (str: string) { | |||
4 | return str.charAt(0).toUpperCase() + str.slice(1) | 4 | return str.charAt(0).toUpperCase() + str.slice(1) |
5 | } | 5 | } |
6 | 6 | ||
7 | // https://github.com/danrevah/ngx-pipes/blob/master/src/pipes/math/bytes.ts | 7 | const dictionaryBytes = [ |
8 | // Don't import all Angular stuff, just copy the code with shame | 8 | { max: 1024, type: 'B', decimals: 0 }, |
9 | const dictionaryBytes: Array<{max: number, type: string}> = [ | 9 | { max: 1048576, type: 'KB', decimals: 0 }, |
10 | { max: 1024, type: 'B' }, | 10 | { max: 1073741824, type: 'MB', decimals: 0 }, |
11 | { max: 1048576, type: 'KB' }, | 11 | { max: 1.0995116e12, type: 'GB', decimals: 1 } |
12 | { max: 1073741824, type: 'MB' }, | ||
13 | { max: 1.0995116e12, type: 'GB' } | ||
14 | ] | 12 | ] |
15 | function bytes (value: number) { | 13 | function bytes (value: number) { |
16 | const format = dictionaryBytes.find(d => value < d.max) || dictionaryBytes[dictionaryBytes.length - 1] | 14 | const format = dictionaryBytes.find(d => value < d.max) || dictionaryBytes[dictionaryBytes.length - 1] |
17 | const calc = Math.floor(value / (format.max / 1024)).toString() | 15 | const calc = (value / (format.max / 1024)).toFixed(format.decimals) |
18 | 16 | ||
19 | return [ calc, format.type ] | 17 | return [ calc, format.type ] |
20 | } | 18 | } |