diff options
Diffstat (limited to 'client/src/app/+videos/+video-edit/video-add-components')
-rw-r--r-- | client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html | 5 | ||||
-rw-r--r-- | client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts | 39 |
2 files changed, 30 insertions, 14 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 8fae4044a..5657827a9 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 | |||
@@ -27,6 +27,11 @@ | |||
27 | {{ error }} | 27 | {{ error }} |
28 | </div> | 28 | </div> |
29 | 29 | ||
30 | <div class="alert alert-info" i18n *ngIf="isInUpdateForm && getMaxLiveDuration()"> | ||
31 | Max live duration is {{ getMaxLiveDuration() | myDurationFormatter }}. | ||
32 | If your live reaches this limit, it will be automatically terminated. | ||
33 | </div> | ||
34 | |||
30 | <!-- Hidden because we want to load the component --> | 35 | <!-- Hidden because we want to load the component --> |
31 | <form [hidden]="!isInUpdateForm" novalidate [formGroup]="form"> | 36 | <form [hidden]="!isInUpdateForm" novalidate [formGroup]="form"> |
32 | <my-video-edit | 37 | <my-video-edit |
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 0a9efc693..9868c37d2 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,5 @@ | |||
1 | 1 | ||
2 | import { forkJoin } from 'rxjs' | ||
2 | import { Component, EventEmitter, OnInit, Output } from '@angular/core' | 3 | import { Component, EventEmitter, OnInit, Output } from '@angular/core' |
3 | import { Router } from '@angular/router' | 4 | import { Router } from '@angular/router' |
4 | import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@app/core' | 5 | import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@app/core' |
@@ -6,7 +7,7 @@ import { scrollToTop } from '@app/helpers' | |||
6 | import { FormValidatorService } from '@app/shared/shared-forms' | 7 | import { FormValidatorService } from '@app/shared/shared-forms' |
7 | import { LiveVideoService, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' | 8 | import { LiveVideoService, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' |
8 | import { LoadingBarService } from '@ngx-loading-bar/core' | 9 | import { LoadingBarService } from '@ngx-loading-bar/core' |
9 | import { LiveVideo, VideoCreate, VideoPrivacy } from '@shared/models' | 10 | import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoPrivacy } from '@shared/models' |
10 | import { VideoSend } from './video-send' | 11 | import { VideoSend } from './video-send' |
11 | 12 | ||
12 | @Component({ | 13 | @Component({ |
@@ -53,7 +54,7 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, CanCompon | |||
53 | } | 54 | } |
54 | 55 | ||
55 | goLive () { | 56 | goLive () { |
56 | const video: VideoCreate = { | 57 | const video: LiveVideoCreate = { |
57 | name: 'Live', | 58 | name: 'Live', |
58 | privacy: VideoPrivacy.PRIVATE, | 59 | privacy: VideoPrivacy.PRIVATE, |
59 | nsfw: this.serverConfig.instance.isNSFW, | 60 | nsfw: this.serverConfig.instance.isNSFW, |
@@ -95,22 +96,32 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, CanCompon | |||
95 | video.id = this.videoId | 96 | video.id = this.videoId |
96 | video.uuid = this.videoUUID | 97 | video.uuid = this.videoUUID |
97 | 98 | ||
99 | const liveVideoUpdate: LiveVideoUpdate = { | ||
100 | saveReplay: this.form.value.saveReplay | ||
101 | } | ||
102 | |||
98 | // Update the video | 103 | // Update the video |
99 | this.updateVideoAndCaptions(video) | 104 | forkJoin([ |
100 | .subscribe( | 105 | this.updateVideoAndCaptions(video), |
101 | () => { | ||
102 | this.notifier.success($localize`Live published.`) | ||
103 | 106 | ||
104 | this.router.navigate([ '/videos/watch', video.uuid ]) | 107 | this.liveVideoService.updateLive(this.videoId, liveVideoUpdate) |
105 | }, | 108 | ]).subscribe( |
109 | () => { | ||
110 | this.notifier.success($localize`Live published.`) | ||
111 | |||
112 | this.router.navigate(['/videos/watch', video.uuid]) | ||
113 | }, | ||
106 | 114 | ||
107 | err => { | 115 | err => { |
108 | this.error = err.message | 116 | this.error = err.message |
109 | scrollToTop() | 117 | scrollToTop() |
110 | console.error(err) | 118 | console.error(err) |
111 | } | 119 | } |
112 | ) | 120 | ) |
121 | } | ||
113 | 122 | ||
123 | getMaxLiveDuration () { | ||
124 | return this.serverConfig.live.maxDuration / 1000 | ||
114 | } | 125 | } |
115 | 126 | ||
116 | private fetchVideoLive () { | 127 | private fetchVideoLive () { |