diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-22 10:53:25 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-02-22 10:53:25 +0100 |
commit | c15d61f5fee4e7a1b5de4c6359ecbf28598a55ef (patch) | |
tree | 2ec682162acc62453b74f427eebd2db7b5b37368 | |
parent | 0a6817f0ba29865576bb16e87fbf62679de885d7 (diff) | |
download | PeerTube-c15d61f5fee4e7a1b5de4c6359ecbf28598a55ef.tar.gz PeerTube-c15d61f5fee4e7a1b5de4c6359ecbf28598a55ef.tar.zst PeerTube-c15d61f5fee4e7a1b5de4c6359ecbf28598a55ef.zip |
Display the preview image on waiting lives
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.html | 4 | ||||
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.ts | 19 |
2 files changed, 18 insertions, 5 deletions
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 669fede43..b17f898ce 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.html +++ b/client/src/app/+videos/+video-watch/video-watch.component.html | |||
@@ -7,7 +7,9 @@ | |||
7 | Please try again later. | 7 | Please try again later. |
8 | </div> | 8 | </div> |
9 | 9 | ||
10 | <div id="videojs-wrapper"></div> | 10 | <div id="videojs-wrapper"> |
11 | <img *ngIf="playerPlaceholderImgSrc" [src]="playerPlaceholderImgSrc" alt="Placeholder image" i18n-alt> | ||
12 | </div> | ||
11 | 13 | ||
12 | <my-video-watch-playlist | 14 | <my-video-watch-playlist |
13 | #videoWatchPlaylist | 15 | #videoWatchPlaylist |
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 11b63297e..7a98cab3b 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -60,9 +60,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
60 | 60 | ||
61 | player: any | 61 | player: any |
62 | playerElement: HTMLVideoElement | 62 | playerElement: HTMLVideoElement |
63 | |||
63 | theaterEnabled = false | 64 | theaterEnabled = false |
65 | |||
64 | userRating: UserVideoRateType = null | 66 | userRating: UserVideoRateType = null |
65 | descriptionLoading = false | 67 | |
68 | playerPlaceholderImgSrc: string | ||
66 | 69 | ||
67 | video: VideoDetails = null | 70 | video: VideoDetails = null |
68 | videoCaptions: VideoCaption[] = [] | 71 | videoCaptions: VideoCaption[] = [] |
@@ -70,13 +73,17 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
70 | playlistPosition: number | 73 | playlistPosition: number |
71 | playlist: VideoPlaylist = null | 74 | playlist: VideoPlaylist = null |
72 | 75 | ||
76 | descriptionLoading = false | ||
73 | completeDescriptionShown = false | 77 | completeDescriptionShown = false |
74 | completeVideoDescription: string | 78 | completeVideoDescription: string |
75 | shortVideoDescription: string | 79 | shortVideoDescription: string |
76 | videoHTMLDescription = '' | 80 | videoHTMLDescription = '' |
81 | |||
77 | likesBarTooltipText = '' | 82 | likesBarTooltipText = '' |
83 | |||
78 | hasAlreadyAcceptedPrivacyConcern = false | 84 | hasAlreadyAcceptedPrivacyConcern = false |
79 | remoteServerDown = false | 85 | remoteServerDown = false |
86 | |||
80 | hotkeys: Hotkey[] = [] | 87 | hotkeys: Hotkey[] = [] |
81 | 88 | ||
82 | tooltipLike = '' | 89 | tooltipLike = '' |
@@ -539,6 +546,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
539 | this.videoCaptions = videoCaptions | 546 | this.videoCaptions = videoCaptions |
540 | 547 | ||
541 | // Re init attributes | 548 | // Re init attributes |
549 | this.playerPlaceholderImgSrc = undefined | ||
542 | this.descriptionLoading = false | 550 | this.descriptionLoading = false |
543 | this.completeDescriptionShown = false | 551 | this.completeDescriptionShown = false |
544 | this.completeVideoDescription = undefined | 552 | this.completeVideoDescription = undefined |
@@ -566,12 +574,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
566 | } | 574 | } |
567 | 575 | ||
568 | private async buildPlayer (urlOptions: URLOptions) { | 576 | private async buildPlayer (urlOptions: URLOptions) { |
569 | const videoState = this.video.state.id | ||
570 | if (videoState === VideoState.LIVE_ENDED || videoState === VideoState.WAITING_FOR_LIVE) return | ||
571 | |||
572 | // Flush old player if needed | 577 | // Flush old player if needed |
573 | this.flushPlayer() | 578 | this.flushPlayer() |
574 | 579 | ||
580 | const videoState = this.video.state.id | ||
581 | if (videoState === VideoState.LIVE_ENDED || videoState === VideoState.WAITING_FOR_LIVE) { | ||
582 | this.playerPlaceholderImgSrc = this.video.previewPath | ||
583 | return | ||
584 | } | ||
585 | |||
575 | // Build video element, because videojs removes it on dispose | 586 | // Build video element, because videojs removes it on dispose |
576 | const playerElementWrapper = this.elementRef.nativeElement.querySelector('#videojs-wrapper') | 587 | const playerElementWrapper = this.elementRef.nativeElement.querySelector('#videojs-wrapper') |
577 | this.playerElement = document.createElement('video') | 588 | this.playerElement = document.createElement('video') |