]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+videos/+video-watch/video-watch.component.ts
Use new primeng i18n api
[github/Chocobozzz/PeerTube.git] / client / src / app / +videos / +video-watch / video-watch.component.ts
index 9a34397312163581ba160d553f94f47ea8f0b817..b15de2a79633922f5f030097a5bddf32d4292523 100644 (file)
@@ -21,7 +21,7 @@ import { isXPercentInViewport, scrollToTop } from '@app/helpers'
 import { Video, VideoCaptionService, VideoDetails, VideoService } from '@app/shared/shared-main'
 import { VideoShareComponent } from '@app/shared/shared-share-modal'
 import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription'
-import { VideoDownloadComponent } from '@app/shared/shared-video-miniature'
+import { VideoActionsDisplayType, VideoDownloadComponent } from '@app/shared/shared-video-miniature'
 import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
 import { MetaService } from '@ngx-meta/core'
 import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
@@ -82,6 +82,18 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
   tooltipSupport = ''
   tooltipSaveToPlaylist = ''
 
+  videoActionsOptions: VideoActionsDisplayType = {
+    playlist: false,
+    download: true,
+    update: true,
+    blacklist: true,
+    delete: true,
+    report: true,
+    duplicate: true,
+    mute: true,
+    liveInfo: true
+  }
+
   private nextVideoUuid = ''
   private nextVideoTitle = ''
   private currentTime: number
@@ -595,6 +607,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
         }
       })
 
+      this.player.one('ended', () => {
+        if (this.video.isLive) {
+          this.video.state.id = VideoState.LIVE_ENDED
+        }
+      })
+
       this.player.on('theaterChange', (_: any, enabled: boolean) => {
         this.zone.run(() => this.theaterEnabled = enabled)
       })
@@ -759,6 +777,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
           : null,
         embedUrl: video.embedUrl,
 
+        isLive: video.isLive,
+
         language: this.localeId,
 
         userWatching: user && user.videosHistoryEnabled === true ? {
@@ -830,7 +850,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
     if (!this.liveVideosSub) {
       this.liveVideosSub = this.peertubeSocket.getLiveVideosObservable()
         .subscribe(({ payload }) => {
-          if (payload.state !== VideoState.PUBLISHED || this.video.state.id !== VideoState.WAITING_FOR_LIVE) return
+          if (payload.state !== VideoState.PUBLISHED) return
+
+          const videoState = this.video.state.id
+          if (videoState !== VideoState.WAITING_FOR_LIVE && videoState !== VideoState.LIVE_ENDED) return
+
+          console.log('Loading video after live update.')
 
           const videoUUID = this.video.uuid