diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-03 14:18:28 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-03 14:19:30 +0200 |
commit | 5a2f775a212bcb708f1756e3780c764cc232a910 (patch) | |
tree | 1d40052e3f2b36d8d44cf12099746746effa0ba9 /client | |
parent | 010382b6037cff5d0ed16fa8b158691439fac9b7 (diff) | |
download | PeerTube-5a2f775a212bcb708f1756e3780c764cc232a910.tar.gz PeerTube-5a2f775a212bcb708f1756e3780c764cc232a910.tar.zst PeerTube-5a2f775a212bcb708f1756e3780c764cc232a910.zip |
Handle playlist without videos available
Diffstat (limited to 'client')
6 files changed, 22 insertions, 4 deletions
diff --git a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.html b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.html index c6ffb1abd..be726c990 100644 --- a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.html +++ b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.html | |||
@@ -34,6 +34,10 @@ | |||
34 | This live has ended. | 34 | This live has ended. |
35 | </div> | 35 | </div> |
36 | 36 | ||
37 | <div i18n class="alert alert-warning" *ngIf="noPlaylistVideoFound"> | ||
38 | There are no videos available in this playlist. | ||
39 | </div> | ||
40 | |||
37 | <div class="alert alert-danger" *ngIf="video?.blacklisted"> | 41 | <div class="alert alert-danger" *ngIf="video?.blacklisted"> |
38 | <div class="blocked-label" i18n>This video is blocked.</div> | 42 | <div class="blocked-label" i18n>This video is blocked.</div> |
39 | {{ video.blacklistedReason }} | 43 | {{ video.blacklistedReason }} |
diff --git a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts index 79b56705f..ba79fabc8 100644 --- a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts +++ b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts | |||
@@ -9,6 +9,7 @@ import { VideoState } from '@shared/models' | |||
9 | }) | 9 | }) |
10 | export class VideoAlertComponent { | 10 | export class VideoAlertComponent { |
11 | @Input() video: VideoDetails | 11 | @Input() video: VideoDetails |
12 | @Input() noPlaylistVideoFound: boolean | ||
12 | 13 | ||
13 | isVideoToTranscode () { | 14 | isVideoToTranscode () { |
14 | return this.video && this.video.state.id === VideoState.TO_TRANSCODE | 15 | return this.video && this.video.state.id === VideoState.TO_TRANSCODE |
diff --git a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.html b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.html index da81d76d1..f5dd352a3 100644 --- a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.html +++ b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.html | |||
@@ -1,5 +1,5 @@ | |||
1 | <div | 1 | <div |
2 | *ngIf="playlist && currentPlaylistPosition" class="playlist" | 2 | *ngIf="playlist && (currentPlaylistPosition || noPlaylistVideos)" class="playlist" |
3 | myInfiniteScroller [onItself]="true" (nearOfBottom)="onPlaylistVideosNearOfBottom()" | 3 | myInfiniteScroller [onItself]="true" (nearOfBottom)="onPlaylistVideosNearOfBottom()" |
4 | > | 4 | > |
5 | <div class="playlist-info"> | 5 | <div class="playlist-info"> |
diff --git a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts index 879d296a7..ec85db0ff 100644 --- a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts +++ b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts | |||
@@ -18,6 +18,7 @@ export class VideoWatchPlaylistComponent { | |||
18 | @Input() playlist: VideoPlaylist | 18 | @Input() playlist: VideoPlaylist |
19 | 19 | ||
20 | @Output() videoFound = new EventEmitter<string>() | 20 | @Output() videoFound = new EventEmitter<string>() |
21 | @Output() noVideoFound = new EventEmitter<void>() | ||
21 | 22 | ||
22 | playlistElements: VideoPlaylistElement[] = [] | 23 | playlistElements: VideoPlaylistElement[] = [] |
23 | playlistPagination: ComponentPagination = { | 24 | playlistPagination: ComponentPagination = { |
@@ -28,10 +29,11 @@ export class VideoWatchPlaylistComponent { | |||
28 | 29 | ||
29 | autoPlayNextVideoPlaylist: boolean | 30 | autoPlayNextVideoPlaylist: boolean |
30 | autoPlayNextVideoPlaylistSwitchText = '' | 31 | autoPlayNextVideoPlaylistSwitchText = '' |
32 | |||
31 | loopPlaylist: boolean | 33 | loopPlaylist: boolean |
32 | loopPlaylistSwitchText = '' | 34 | loopPlaylistSwitchText = '' |
33 | noPlaylistVideos = false | ||
34 | 35 | ||
36 | noPlaylistVideos = false | ||
35 | currentPlaylistPosition: number | 37 | currentPlaylistPosition: number |
36 | 38 | ||
37 | constructor ( | 39 | constructor ( |
@@ -100,6 +102,7 @@ export class VideoWatchPlaylistComponent { | |||
100 | const firstAvailableVideo = this.playlistElements.find(e => !!e.video) | 102 | const firstAvailableVideo = this.playlistElements.find(e => !!e.video) |
101 | if (!firstAvailableVideo) { | 103 | if (!firstAvailableVideo) { |
102 | this.noPlaylistVideos = true | 104 | this.noPlaylistVideos = true |
105 | this.noVideoFound.emit() | ||
103 | return | 106 | return |
104 | } | 107 | } |
105 | 108 | ||
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.html b/client/src/app/+videos/+video-watch/video-watch.component.html index 4c15ae3d7..1ea0cf6b8 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.html +++ b/client/src/app/+videos/+video-watch/video-watch.component.html | |||
@@ -11,12 +11,15 @@ | |||
11 | <img class="placeholder-image" *ngIf="playerPlaceholderImgSrc" [src]="playerPlaceholderImgSrc" alt="Placeholder image" i18n-alt> | 11 | <img class="placeholder-image" *ngIf="playerPlaceholderImgSrc" [src]="playerPlaceholderImgSrc" alt="Placeholder image" i18n-alt> |
12 | </div> | 12 | </div> |
13 | 13 | ||
14 | <my-video-watch-playlist #videoWatchPlaylist [playlist]="playlist" (videoFound)="onPlaylistVideoFound($event)"></my-video-watch-playlist> | 14 | <my-video-watch-playlist |
15 | #videoWatchPlaylist [playlist]="playlist" | ||
16 | (noVideoFound)="onPlaylistNoVideoFound()" (videoFound)="onPlaylistVideoFound($event)" | ||
17 | ></my-video-watch-playlist> | ||
15 | 18 | ||
16 | <my-plugin-placeholder pluginId="player-next"></my-plugin-placeholder> | 19 | <my-plugin-placeholder pluginId="player-next"></my-plugin-placeholder> |
17 | </div> | 20 | </div> |
18 | 21 | ||
19 | <my-video-alert [video]="video"></my-video-alert> | 22 | <my-video-alert [video]="video" [noPlaylistVideoFound]="noPlaylistVideoFound"></my-video-alert> |
20 | 23 | ||
21 | <!-- Video information --> | 24 | <!-- Video information --> |
22 | <div *ngIf="video" class="margin-content video-bottom"> | 25 | <div *ngIf="video" class="margin-content video-bottom"> |
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index 5fa31ec63..d05f08a5f 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -72,6 +72,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
72 | playlist: VideoPlaylist = null | 72 | playlist: VideoPlaylist = null |
73 | 73 | ||
74 | remoteServerDown = false | 74 | remoteServerDown = false |
75 | noPlaylistVideoFound = false | ||
75 | 76 | ||
76 | private nextVideoUUID = '' | 77 | private nextVideoUUID = '' |
77 | private nextVideoTitle = '' | 78 | private nextVideoTitle = '' |
@@ -178,6 +179,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
178 | this.loadVideo(videoId) | 179 | this.loadVideo(videoId) |
179 | } | 180 | } |
180 | 181 | ||
182 | onPlaylistNoVideoFound () { | ||
183 | this.noPlaylistVideoFound = true | ||
184 | } | ||
185 | |||
181 | isUserLoggedIn () { | 186 | isUserLoggedIn () { |
182 | return this.authService.isLoggedIn() | 187 | return this.authService.isLoggedIn() |
183 | } | 188 | } |
@@ -286,6 +291,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
286 | private loadPlaylist (playlistId: string) { | 291 | private loadPlaylist (playlistId: string) { |
287 | if (this.isSameElement(this.playlist, playlistId)) return | 292 | if (this.isSameElement(this.playlist, playlistId)) return |
288 | 293 | ||
294 | this.noPlaylistVideoFound = false | ||
295 | |||
289 | this.playlistService.getVideoPlaylist(playlistId) | 296 | this.playlistService.getVideoPlaylist(playlistId) |
290 | .subscribe({ | 297 | .subscribe({ |
291 | next: playlist => { | 298 | next: playlist => { |