diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-15 11:37:30 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-10-15 11:45:03 +0200 |
commit | 1e2fe802d1f82b81ac30fd9ca267da12f75032a2 (patch) | |
tree | c1d7142f825e277b56b5cd73f9de601ddcb20077 /client/src/app/+videos | |
parent | 3eb7ee658db32d270553046eeb77afc679a71466 (diff) | |
download | PeerTube-1e2fe802d1f82b81ac30fd9ca267da12f75032a2.tar.gz PeerTube-1e2fe802d1f82b81ac30fd9ca267da12f75032a2.tar.zst PeerTube-1e2fe802d1f82b81ac30fd9ca267da12f75032a2.zip |
Force live type specification in first step
Diffstat (limited to 'client/src/app/+videos')
4 files changed, 56 insertions, 4 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html index fddb08e0b..fce5a1ee5 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html +++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html | |||
@@ -16,7 +16,24 @@ | |||
16 | ></my-select-options> | 16 | ></my-select-options> |
17 | </div> | 17 | </div> |
18 | 18 | ||
19 | <div class="form-group live-type"> | ||
20 | <div class="peertube-radio-container"> | ||
21 | <input type="radio" id="permanentLiveFalse" [(ngModel)]="firstStepPermanentLive" [value]="false"> | ||
22 | <label i18n for="permanentLiveFalse" class="radio">Normal live</label> | ||
23 | |||
24 | <span class="form-group-description">{{ getNormalLiveDescription() }}</span> | ||
25 | </div> | ||
26 | |||
27 | <div class="peertube-radio-container"> | ||
28 | <input type="radio" id="permanentLiveTrue" [(ngModel)]="firstStepPermanentLive" [value]="true"> | ||
29 | <label i18n for="permanentLiveTrue" class="radio">Permanent/recurring live</label> | ||
30 | |||
31 | <span class="form-group-description" i18n>{{ getPermanentLiveDescription() }}</span> | ||
32 | </div> | ||
33 | </div> | ||
34 | |||
19 | <input | 35 | <input |
36 | [disabled]="firstStepPermanentLive !== true && firstStepPermanentLive !== false" | ||
20 | type="button" i18n-value value="Go Live" (click)="goLive()" | 37 | type="button" i18n-value value="Go Live" (click)="goLive()" |
21 | /> | 38 | /> |
22 | </div> | 39 | </div> |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.scss b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.scss new file mode 100644 index 000000000..09b71018f --- /dev/null +++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.scss | |||
@@ -0,0 +1,12 @@ | |||
1 | .live-type { | ||
2 | margin-top: 15px; | ||
3 | } | ||
4 | |||
5 | .peertube-radio-container { | ||
6 | width: 250px; | ||
7 | |||
8 | .form-group-description { | ||
9 | white-space: nowrap; | ||
10 | } | ||
11 | } | ||
12 | |||
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 ee7011b4c..01eabb0d7 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 | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | import { forkJoin } from 'rxjs' | 1 | import { forkJoin } from 'rxjs' |
3 | import { AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core' | 2 | import { AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core' |
4 | import { Router } from '@angular/router' | 3 | import { Router } from '@angular/router' |
@@ -16,6 +15,7 @@ import { VideoSend } from './video-send' | |||
16 | templateUrl: './video-go-live.component.html', | 15 | templateUrl: './video-go-live.component.html', |
17 | styleUrls: [ | 16 | styleUrls: [ |
18 | '../shared/video-edit.component.scss', | 17 | '../shared/video-edit.component.scss', |
18 | './video-go-live.component.scss', | ||
19 | './video-send.scss' | 19 | './video-send.scss' |
20 | ] | 20 | ] |
21 | }) | 21 | }) |
@@ -23,6 +23,8 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
23 | @Output() firstStepDone = new EventEmitter<string>() | 23 | @Output() firstStepDone = new EventEmitter<string>() |
24 | @Output() firstStepError = new EventEmitter<void>() | 24 | @Output() firstStepError = new EventEmitter<void>() |
25 | 25 | ||
26 | firstStepPermanentLive: boolean | ||
27 | |||
26 | isInUpdateForm = false | 28 | isInUpdateForm = false |
27 | 29 | ||
28 | liveVideo: LiveVideo | 30 | liveVideo: LiveVideo |
@@ -70,8 +72,8 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
70 | waitTranscoding: true, | 72 | waitTranscoding: true, |
71 | commentsEnabled: true, | 73 | commentsEnabled: true, |
72 | downloadEnabled: true, | 74 | downloadEnabled: true, |
73 | permanentLive: false, | 75 | permanentLive: this.firstStepPermanentLive, |
74 | saveReplay: false, | 76 | saveReplay: this.firstStepPermanentLive === false && this.isReplayAllowed(), |
75 | channelId: this.firstStepChannelId | 77 | channelId: this.firstStepChannelId |
76 | } | 78 | } |
77 | 79 | ||
@@ -154,6 +156,26 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
154 | return this.form.value['saveReplay'] === true | 156 | return this.form.value['saveReplay'] === true |
155 | } | 157 | } |
156 | 158 | ||
159 | getNormalLiveDescription () { | ||
160 | if (this.isReplayAllowed()) { | ||
161 | return $localize`Stream only once and save a replay of your live` | ||
162 | } | ||
163 | |||
164 | return $localize`Stream only once` | ||
165 | } | ||
166 | |||
167 | getPermanentLiveDescription () { | ||
168 | if (this.isReplayAllowed()) { | ||
169 | return $localize`Stream multiple times, replays can't be saved` | ||
170 | } | ||
171 | |||
172 | return $localize`Stream multiple times using the same URL` | ||
173 | } | ||
174 | |||
175 | private isReplayAllowed () { | ||
176 | return this.serverConfig.live.allowReplay | ||
177 | } | ||
178 | |||
157 | private fetchVideoLive () { | 179 | private fetchVideoLive () { |
158 | this.liveVideoService.getVideoLive(this.videoId) | 180 | this.liveVideoService.getVideoLive(this.videoId) |
159 | .subscribe({ | 181 | .subscribe({ |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-send.scss b/client/src/app/+videos/+video-edit/video-add-components/video-send.scss index e601c3dff..7284ad00f 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-send.scss +++ b/client/src/app/+videos/+video-edit/video-add-components/video-send.scss | |||
@@ -1,7 +1,7 @@ | |||
1 | @use '_variables' as *; | 1 | @use '_variables' as *; |
2 | @use '_mixins' as *; | 2 | @use '_mixins' as *; |
3 | 3 | ||
4 | $width-size: 190px; | 4 | $width-size: 250px; |
5 | 5 | ||
6 | .alert.alert-danger { | 6 | .alert.alert-danger { |
7 | text-align: center; | 7 | text-align: center; |
@@ -29,6 +29,7 @@ $width-size: 190px; | |||
29 | my-select-options ::ng-deep ng-select, | 29 | my-select-options ::ng-deep ng-select, |
30 | my-select-channel ::ng-deep ng-select { | 30 | my-select-channel ::ng-deep ng-select { |
31 | width: $width-size; | 31 | width: $width-size; |
32 | |||
32 | @media screen and (max-width: $width-size) { | 33 | @media screen and (max-width: $width-size) { |
33 | width: 100%; | 34 | width: 100%; |
34 | } | 35 | } |