aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-main/shared-main.module.ts3
-rw-r--r--client/src/app/shared/shared-main/video/index.ts1
-rw-r--r--client/src/app/shared/shared-main/video/video.model.ts5
-rw-r--r--client/src/app/shared/shared-video-live/index.ts4
-rw-r--r--client/src/app/shared/shared-video-live/live-stream-information.component.html35
-rw-r--r--client/src/app/shared/shared-video-live/live-stream-information.component.scss10
-rw-r--r--client/src/app/shared/shared-video-live/live-stream-information.component.ts41
-rw-r--r--client/src/app/shared/shared-video-live/live-video.service.ts (renamed from client/src/app/shared/shared-main/video/live-video.service.ts)2
-rw-r--r--client/src/app/shared/shared-video-live/shared-video-live.module.ts28
-rw-r--r--client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts4
-rw-r--r--client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html1
-rw-r--r--client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts22
12 files changed, 150 insertions, 6 deletions
diff --git a/client/src/app/shared/shared-main/shared-main.module.ts b/client/src/app/shared/shared-main/shared-main.module.ts
index 3816cab19..be0630395 100644
--- a/client/src/app/shared/shared-main/shared-main.module.ts
+++ b/client/src/app/shared/shared-main/shared-main.module.ts
@@ -30,7 +30,7 @@ import { FeedComponent } from './feeds'
30import { LoaderComponent, SmallLoaderComponent } from './loaders' 30import { LoaderComponent, SmallLoaderComponent } from './loaders'
31import { HelpComponent, ListOverflowComponent, TopMenuDropdownComponent } from './misc' 31import { HelpComponent, ListOverflowComponent, TopMenuDropdownComponent } from './misc'
32import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users' 32import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users'
33import { LiveVideoService, RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' 33import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video'
34import { VideoCaptionService } from './video-caption' 34import { VideoCaptionService } from './video-caption'
35import { VideoChannelService } from './video-channel' 35import { VideoChannelService } from './video-channel'
36 36
@@ -152,7 +152,6 @@ import { VideoChannelService } from './video-channel'
152 RedundancyService, 152 RedundancyService,
153 VideoImportService, 153 VideoImportService,
154 VideoOwnershipService, 154 VideoOwnershipService,
155 LiveVideoService,
156 VideoService, 155 VideoService,
157 156
158 VideoCaptionService, 157 VideoCaptionService,
diff --git a/client/src/app/shared/shared-main/video/index.ts b/client/src/app/shared/shared-main/video/index.ts
index f69089517..3053df4ef 100644
--- a/client/src/app/shared/shared-main/video/index.ts
+++ b/client/src/app/shared/shared-main/video/index.ts
@@ -1,4 +1,3 @@
1export * from './live-video.service'
2export * from './redundancy.service' 1export * from './redundancy.service'
3export * from './video-details.model' 2export * from './video-details.model'
4export * from './video-edit.model' 3export * from './video-edit.model'
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts
index e3a52af3d..92f5bc0c0 100644
--- a/client/src/app/shared/shared-main/video/video.model.ts
+++ b/client/src/app/shared/shared-main/video/video.model.ts
@@ -193,6 +193,11 @@ export class Video implements VideoServerModel {
193 return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO)) 193 return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO))
194 } 194 }
195 195
196 isLiveInfoAvailableBy (user: AuthUser) {
197 return this.isLive &&
198 user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.GET_ANY_LIVE))
199 }
200
196 canBeDuplicatedBy (user: AuthUser) { 201 canBeDuplicatedBy (user: AuthUser) {
197 return user && this.isLocal === false && user.hasRight(UserRight.MANAGE_VIDEOS_REDUNDANCIES) 202 return user && this.isLocal === false && user.hasRight(UserRight.MANAGE_VIDEOS_REDUNDANCIES)
198 } 203 }
diff --git a/client/src/app/shared/shared-video-live/index.ts b/client/src/app/shared/shared-video-live/index.ts
new file mode 100644
index 000000000..c4048e7c5
--- /dev/null
+++ b/client/src/app/shared/shared-video-live/index.ts
@@ -0,0 +1,4 @@
1export * from './live-video.service'
2export * from './live-stream-information.component'
3
4export * from './shared-video-live.module'
diff --git a/client/src/app/shared/shared-video-live/live-stream-information.component.html b/client/src/app/shared/shared-video-live/live-stream-information.component.html
new file mode 100644
index 000000000..2e65e1de9
--- /dev/null
+++ b/client/src/app/shared/shared-video-live/live-stream-information.component.html
@@ -0,0 +1,35 @@
1<ng-template #modal let-close="close" let-dismiss="dismiss">
2 <div class="modal-header">
3 <h4 i18n class="modal-title">Live information</h4>
4
5 <my-global-icon iconName="cross" aria-label="Close" role="button" (click)="dismiss()"></my-global-icon>
6 </div>
7
8 <div class="modal-body">
9 <div class="form-group">
10 <label for="liveVideoRTMPUrl" i18n>Live RTMP Url</label>
11 <my-input-readonly-copy id="liveVideoRTMPUrl" [value]="rtmpUrl"></my-input-readonly-copy>
12 </div>
13
14 <div class="form-group">
15 <label for="liveVideoStreamKey" i18n>Live stream key</label>
16 <my-input-readonly-copy id="liveVideoStreamKey" [value]="streamKey"></my-input-readonly-copy>
17
18 <div class="form-group-description" i18n>⚠️ Never share your stream key with anyone.</div>
19 </div>
20 </div>
21
22 <div class="modal-footer">
23 <div class="form-group inputs">
24 <input
25 type="button" role="button" i18n-value value="Close" class="action-button action-button-cancel"
26 (click)="dismiss()"
27 >
28
29 <my-edit-button
30 i18n-label label="Update live settings"
31 [routerLink]="[ '/videos', 'update', video.uuid ]" (click)="dismiss()"
32 ></my-edit-button>
33 </div>
34 </div>
35</ng-template>
diff --git a/client/src/app/shared/shared-video-live/live-stream-information.component.scss b/client/src/app/shared/shared-video-live/live-stream-information.component.scss
new file mode 100644
index 000000000..a79fec179
--- /dev/null
+++ b/client/src/app/shared/shared-video-live/live-stream-information.component.scss
@@ -0,0 +1,10 @@
1@import '_variables';
2@import '_mixins';
3
4p-autocomplete {
5 display: block;
6}
7
8.form-group {
9 margin: 20px 0;
10} \ No newline at end of file
diff --git a/client/src/app/shared/shared-video-live/live-stream-information.component.ts b/client/src/app/shared/shared-video-live/live-stream-information.component.ts
new file mode 100644
index 000000000..e6142eb2e
--- /dev/null
+++ b/client/src/app/shared/shared-video-live/live-stream-information.component.ts
@@ -0,0 +1,41 @@
1import { Component, ElementRef, ViewChild } from '@angular/core'
2import { Video } from '@app/shared/shared-main'
3import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
4import { LiveVideoService } from './live-video.service'
5
6@Component({
7 selector: 'my-live-stream-information',
8 templateUrl: './live-stream-information.component.html',
9 styleUrls: [ './live-stream-information.component.scss' ]
10})
11export class LiveStreamInformationComponent {
12 @ViewChild('modal', { static: true }) modal: ElementRef
13
14 video: Video
15 rtmpUrl = ''
16 streamKey = ''
17
18 constructor (
19 private modalService: NgbModal,
20 private liveVideoService: LiveVideoService
21 ) { }
22
23 show (video: Video) {
24 this.video = video
25 this.rtmpUrl = ''
26 this.streamKey = ''
27
28 this.loadLiveInfo(video)
29
30 this.modalService
31 .open(this.modal, { centered: true })
32 }
33
34 private loadLiveInfo (video: Video) {
35 this.liveVideoService.getVideoLive(video.id)
36 .subscribe(live => {
37 this.rtmpUrl = live.rtmpUrl
38 this.streamKey = live.streamKey
39 })
40 }
41}
diff --git a/client/src/app/shared/shared-main/video/live-video.service.ts b/client/src/app/shared/shared-video-live/live-video.service.ts
index 093d65e83..b02442eae 100644
--- a/client/src/app/shared/shared-main/video/live-video.service.ts
+++ b/client/src/app/shared/shared-video-live/live-video.service.ts
@@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { RestExtractor } from '@app/core' 4import { RestExtractor } from '@app/core'
5import { LiveVideo, LiveVideoCreate, LiveVideoUpdate } from '@shared/models' 5import { LiveVideo, LiveVideoCreate, LiveVideoUpdate } from '@shared/models'
6import { environment } from '../../../../environments/environment' 6import { environment } from '../../../environments/environment'
7 7
8@Injectable() 8@Injectable()
9export class LiveVideoService { 9export class LiveVideoService {
diff --git a/client/src/app/shared/shared-video-live/shared-video-live.module.ts b/client/src/app/shared/shared-video-live/shared-video-live.module.ts
new file mode 100644
index 000000000..c35c2caa3
--- /dev/null
+++ b/client/src/app/shared/shared-video-live/shared-video-live.module.ts
@@ -0,0 +1,28 @@
1
2import { NgModule } from '@angular/core'
3import { SharedFormModule } from '../shared-forms'
4import { SharedGlobalIconModule } from '../shared-icons'
5import { SharedMainModule } from '../shared-main/shared-main.module'
6import { LiveStreamInformationComponent } from './live-stream-information.component'
7import { LiveVideoService } from './live-video.service'
8
9@NgModule({
10 imports: [
11 SharedMainModule,
12 SharedFormModule,
13 SharedGlobalIconModule
14 ],
15
16 declarations: [
17 LiveStreamInformationComponent
18 ],
19
20 exports: [
21 LiveStreamInformationComponent
22 ],
23
24 providers: [
25 LiveVideoService
26 ]
27})
28export class SharedVideoLiveModule { }
diff --git a/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts b/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts
index 666144864..08c8da3dd 100644
--- a/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts
+++ b/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts
@@ -5,6 +5,7 @@ import { SharedGlobalIconModule } from '../shared-icons'
5import { SharedMainModule } from '../shared-main/shared-main.module' 5import { SharedMainModule } from '../shared-main/shared-main.module'
6import { SharedModerationModule } from '../shared-moderation' 6import { SharedModerationModule } from '../shared-moderation'
7import { SharedThumbnailModule } from '../shared-thumbnail' 7import { SharedThumbnailModule } from '../shared-thumbnail'
8import { SharedVideoLiveModule } from '../shared-video-live'
8import { SharedVideoPlaylistModule } from '../shared-video-playlist/shared-video-playlist.module' 9import { SharedVideoPlaylistModule } from '../shared-video-playlist/shared-video-playlist.module'
9import { VideoActionsDropdownComponent } from './video-actions-dropdown.component' 10import { VideoActionsDropdownComponent } from './video-actions-dropdown.component'
10import { VideoDownloadComponent } from './video-download.component' 11import { VideoDownloadComponent } from './video-download.component'
@@ -18,7 +19,8 @@ import { VideosSelectionComponent } from './videos-selection.component'
18 SharedModerationModule, 19 SharedModerationModule,
19 SharedVideoPlaylistModule, 20 SharedVideoPlaylistModule,
20 SharedThumbnailModule, 21 SharedThumbnailModule,
21 SharedGlobalIconModule 22 SharedGlobalIconModule,
23 SharedVideoLiveModule
22 ], 24 ],
23 25
24 declarations: [ 26 declarations: [
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html
index 3c8271b65..00ee196ac 100644
--- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html
+++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html
@@ -18,4 +18,5 @@
18 <my-video-download #videoDownloadModal></my-video-download> 18 <my-video-download #videoDownloadModal></my-video-download>
19 <my-video-report #videoReportModal [video]="video"></my-video-report> 19 <my-video-report #videoReportModal [video]="video"></my-video-report>
20 <my-video-block #videoBlockModal [video]="video" (videoBlocked)="onVideoBlocked()"></my-video-block> 20 <my-video-block #videoBlockModal [video]="video" (videoBlocked)="onVideoBlocked()"></my-video-block>
21 <my-live-stream-information #liveStreamInformationModal *ngIf="displayOptions.liveInfo"></my-live-stream-information>
21</ng-container> 22</ng-container>
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
index 8f4c129a5..18b4a2f3c 100644
--- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
+++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
@@ -13,6 +13,7 @@ import {
13 VideoDetails, 13 VideoDetails,
14 VideoService 14 VideoService
15} from '../shared-main' 15} from '../shared-main'
16import { LiveStreamInformationComponent } from '../shared-video-live'
16import { VideoAddToPlaylistComponent } from '../shared-video-playlist' 17import { VideoAddToPlaylistComponent } from '../shared-video-playlist'
17import { VideoDownloadComponent } from './video-download.component' 18import { VideoDownloadComponent } from './video-download.component'
18 19
@@ -25,6 +26,7 @@ export type VideoActionsDisplayType = {
25 report?: boolean 26 report?: boolean
26 duplicate?: boolean 27 duplicate?: boolean
27 mute?: boolean 28 mute?: boolean
29 liveInfo?: boolean
28} 30}
29 31
30@Component({ 32@Component({
@@ -39,6 +41,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
39 @ViewChild('videoDownloadModal') videoDownloadModal: VideoDownloadComponent 41 @ViewChild('videoDownloadModal') videoDownloadModal: VideoDownloadComponent
40 @ViewChild('videoReportModal') videoReportModal: VideoReportComponent 42 @ViewChild('videoReportModal') videoReportModal: VideoReportComponent
41 @ViewChild('videoBlockModal') videoBlockModal: VideoBlockComponent 43 @ViewChild('videoBlockModal') videoBlockModal: VideoBlockComponent
44 @ViewChild('liveStreamInformationModal') liveStreamInformationModal: LiveStreamInformationComponent
42 45
43 @Input() video: Video | VideoDetails 46 @Input() video: Video | VideoDetails
44 @Input() videoCaptions: VideoCaption[] = [] 47 @Input() videoCaptions: VideoCaption[] = []
@@ -51,7 +54,8 @@ export class VideoActionsDropdownComponent implements OnChanges {
51 delete: true, 54 delete: true,
52 report: true, 55 report: true,
53 duplicate: true, 56 duplicate: true,
54 mute: true 57 mute: true,
58 liveInfo: false
55 } 59 }
56 @Input() placement = 'left' 60 @Input() placement = 'left'
57 61
@@ -127,6 +131,12 @@ export class VideoActionsDropdownComponent implements OnChanges {
127 this.videoBlockModal.show() 131 this.videoBlockModal.show()
128 } 132 }
129 133
134 showLiveInfoModal (video: Video) {
135 this.modalOpened.emit()
136
137 this.liveStreamInformationModal.show(video)
138 }
139
130 /* Actions checker */ 140 /* Actions checker */
131 141
132 isVideoUpdatable () { 142 isVideoUpdatable () {
@@ -145,6 +155,10 @@ export class VideoActionsDropdownComponent implements OnChanges {
145 return this.video.isUnblockableBy(this.user) 155 return this.video.isUnblockableBy(this.user)
146 } 156 }
147 157
158 isVideoLiveInfoAvailable () {
159 return this.video.isLiveInfoAvailableBy(this.user)
160 }
161
148 isVideoDownloadable () { 162 isVideoDownloadable () {
149 return this.video && 163 return this.video &&
150 this.video.isLive !== true && 164 this.video.isLive !== true &&
@@ -261,6 +275,12 @@ export class VideoActionsDropdownComponent implements OnChanges {
261 iconName: 'download' 275 iconName: 'download'
262 }, 276 },
263 { 277 {
278 label: $localize`Display live information`,
279 handler: ({ video }) => this.showLiveInfoModal(video),
280 isDisplayed: () => this.isVideoLiveInfoAvailable(),
281 iconName: 'live'
282 },
283 {
264 label: $localize`Update`, 284 label: $localize`Update`,
265 linkBuilder: ({ video }) => [ '/videos/update', video.uuid ], 285 linkBuilder: ({ video }) => [ '/videos/update', video.uuid ],
266 iconName: 'edit', 286 iconName: 'edit',