diff options
Diffstat (limited to 'client/src/app/shared/shared-main')
6 files changed, 48 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 7f4676dd1..bca67b193 100644 --- a/client/src/app/shared/shared-main/shared-main.module.ts +++ b/client/src/app/shared/shared-main/shared-main.module.ts | |||
@@ -23,7 +23,7 @@ import { FeedComponent } from './feeds' | |||
23 | import { LoaderComponent, SmallLoaderComponent } from './loaders' | 23 | import { LoaderComponent, SmallLoaderComponent } from './loaders' |
24 | import { HelpComponent, ListOverflowComponent, TopMenuDropdownComponent } from './misc' | 24 | import { HelpComponent, ListOverflowComponent, TopMenuDropdownComponent } from './misc' |
25 | import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users' | 25 | import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users' |
26 | import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' | 26 | import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService, VideoLiveService } from './video' |
27 | import { VideoCaptionService } from './video-caption' | 27 | import { VideoCaptionService } from './video-caption' |
28 | import { VideoChannelService } from './video-channel' | 28 | import { VideoChannelService } from './video-channel' |
29 | 29 | ||
@@ -142,6 +142,7 @@ import { VideoChannelService } from './video-channel' | |||
142 | RedundancyService, | 142 | RedundancyService, |
143 | VideoImportService, | 143 | VideoImportService, |
144 | VideoOwnershipService, | 144 | VideoOwnershipService, |
145 | VideoLiveService, | ||
145 | VideoService, | 146 | VideoService, |
146 | 147 | ||
147 | VideoCaptionService, | 148 | VideoCaptionService, |
diff --git a/client/src/app/shared/shared-main/video/index.ts b/client/src/app/shared/shared-main/video/index.ts index 3053df4ef..121635a30 100644 --- a/client/src/app/shared/shared-main/video/index.ts +++ b/client/src/app/shared/shared-main/video/index.ts | |||
@@ -2,6 +2,7 @@ export * from './redundancy.service' | |||
2 | export * from './video-details.model' | 2 | export * from './video-details.model' |
3 | export * from './video-edit.model' | 3 | export * from './video-edit.model' |
4 | export * from './video-import.service' | 4 | export * from './video-import.service' |
5 | export * from './video-live.service' | ||
5 | export * from './video-ownership.service' | 6 | export * from './video-ownership.service' |
6 | export * from './video.model' | 7 | export * from './video.model' |
7 | export * from './video.service' | 8 | export * from './video.service' |
diff --git a/client/src/app/shared/shared-main/video/video-details.model.ts b/client/src/app/shared/shared-main/video/video-details.model.ts index a1cb051e9..f060d1dc9 100644 --- a/client/src/app/shared/shared-main/video/video-details.model.ts +++ b/client/src/app/shared/shared-main/video/video-details.model.ts | |||
@@ -62,8 +62,11 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { | |||
62 | } | 62 | } |
63 | 63 | ||
64 | getFiles () { | 64 | getFiles () { |
65 | if (this.files.length === 0) return this.getHlsPlaylist().files | 65 | if (this.files.length !== 0) return this.files |
66 | 66 | ||
67 | return this.files | 67 | const hls = this.getHlsPlaylist() |
68 | if (hls) return hls.files | ||
69 | |||
70 | return [] | ||
68 | } | 71 | } |
69 | } | 72 | } |
diff --git a/client/src/app/shared/shared-main/video/video-live.service.ts b/client/src/app/shared/shared-main/video/video-live.service.ts new file mode 100644 index 000000000..12daff756 --- /dev/null +++ b/client/src/app/shared/shared-main/video/video-live.service.ts | |||
@@ -0,0 +1,28 @@ | |||
1 | import { catchError } from 'rxjs/operators' | ||
2 | import { HttpClient } from '@angular/common/http' | ||
3 | import { Injectable } from '@angular/core' | ||
4 | import { RestExtractor } from '@app/core' | ||
5 | import { VideoCreate, VideoLive } from '@shared/models' | ||
6 | import { environment } from '../../../../environments/environment' | ||
7 | |||
8 | @Injectable() | ||
9 | export class VideoLiveService { | ||
10 | static BASE_VIDEO_LIVE_URL = environment.apiUrl + '/api/v1/videos/live/' | ||
11 | |||
12 | constructor ( | ||
13 | private authHttp: HttpClient, | ||
14 | private restExtractor: RestExtractor | ||
15 | ) {} | ||
16 | |||
17 | goLive (video: VideoCreate) { | ||
18 | return this.authHttp | ||
19 | .post<{ video: { id: number, uuid: string } }>(VideoLiveService.BASE_VIDEO_LIVE_URL, video) | ||
20 | .pipe(catchError(err => this.restExtractor.handleError(err))) | ||
21 | } | ||
22 | |||
23 | getVideoLive (videoId: number | string) { | ||
24 | return this.authHttp | ||
25 | .get<VideoLive>(VideoLiveService.BASE_VIDEO_LIVE_URL + videoId) | ||
26 | .pipe(catchError(err => this.restExtractor.handleError(err))) | ||
27 | } | ||
28 | } | ||
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 0dca3da0d..e3a52af3d 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts | |||
@@ -40,6 +40,8 @@ export class Video implements VideoServerModel { | |||
40 | thumbnailPath: string | 40 | thumbnailPath: string |
41 | thumbnailUrl: string | 41 | thumbnailUrl: string |
42 | 42 | ||
43 | isLive: boolean | ||
44 | |||
43 | previewPath: string | 45 | previewPath: string |
44 | previewUrl: string | 46 | previewUrl: string |
45 | 47 | ||
@@ -103,6 +105,8 @@ export class Video implements VideoServerModel { | |||
103 | this.state = hash.state | 105 | this.state = hash.state |
104 | this.description = hash.description | 106 | this.description = hash.description |
105 | 107 | ||
108 | this.isLive = hash.isLive | ||
109 | |||
106 | this.duration = hash.duration | 110 | this.duration = hash.duration |
107 | this.durationLabel = durationToString(hash.duration) | 111 | this.durationLabel = durationToString(hash.duration) |
108 | 112 | ||
@@ -113,10 +117,14 @@ export class Video implements VideoServerModel { | |||
113 | this.name = hash.name | 117 | this.name = hash.name |
114 | 118 | ||
115 | this.thumbnailPath = hash.thumbnailPath | 119 | this.thumbnailPath = hash.thumbnailPath |
116 | this.thumbnailUrl = hash.thumbnailUrl || (absoluteAPIUrl + hash.thumbnailPath) | 120 | this.thumbnailUrl = this.thumbnailPath |
121 | ? hash.thumbnailUrl || (absoluteAPIUrl + hash.thumbnailPath) | ||
122 | : null | ||
117 | 123 | ||
118 | this.previewPath = hash.previewPath | 124 | this.previewPath = hash.previewPath |
119 | this.previewUrl = hash.previewUrl || (absoluteAPIUrl + hash.previewPath) | 125 | this.previewUrl = this.previewPath |
126 | ? hash.previewUrl || (absoluteAPIUrl + hash.previewPath) | ||
127 | : null | ||
120 | 128 | ||
121 | this.embedPath = hash.embedPath | 129 | this.embedPath = hash.embedPath |
122 | this.embedUrl = hash.embedUrl || (getAbsoluteEmbedUrl() + hash.embedPath) | 130 | this.embedUrl = hash.embedUrl || (getAbsoluteEmbedUrl() + hash.embedPath) |
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 8a688c8ed..0e2d36081 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts | |||
@@ -18,7 +18,8 @@ import { | |||
18 | VideoFilter, | 18 | VideoFilter, |
19 | VideoPrivacy, | 19 | VideoPrivacy, |
20 | VideoSortField, | 20 | VideoSortField, |
21 | VideoUpdate | 21 | VideoUpdate, |
22 | VideoCreate | ||
22 | } from '@shared/models' | 23 | } from '@shared/models' |
23 | import { environment } from '../../../../environments/environment' | 24 | import { environment } from '../../../../environments/environment' |
24 | import { Account } from '../account/account.model' | 25 | import { Account } from '../account/account.model' |