Chocobozzz/PeerTube

View on GitHub
client/src/app/+videos/+video-watch/video-watch.component.html

Summary

Maintainability
Test Coverage
<div class="root" [ngClass]="{ 'theater-enabled': theaterEnabled }" [hidden]="!playlist && !video">
  <!-- We need the video container for videojs so we just hide it -->
  <div id="video-wrapper">
    <div *ngIf="remoteServerDown" class="remote-server-down">
      <ng-container i18n>Sorry, but this video did not load because the remote instance did not respond.</ng-container>

      <br />

      <ng-container i18n>Please try refreshing the page, or try again later.</ng-container>
    </div>

    <div id="videojs-wrapper">
      <video #playerElement class="video-js vjs-peertube-skin" playsinline="true"></video>
    </div>

    <div class="player-widget-component">
      <my-video-watch-playlist
        #videoWatchPlaylist [playlist]="playlist"
        [hidden]="transcriptionWidgetOpened"
        (noVideoFound)="onPlaylistNoVideoFound()" (videoFound)="onPlaylistVideoFound($event)"
      ></my-video-watch-playlist>

      @if (transcriptionWidgetOpened) {
        <my-video-transcription
          [video]="video" [captions]="videoCaptions" [currentTime]="getCurrentTime()"
          (segmentClicked)="handleTimestampClicked($event)" (closeTranscription)="transcriptionWidgetOpened = false"
        ></my-video-transcription>
      }
    </div>

    <my-plugin-placeholder pluginId="player-next"></my-plugin-placeholder>
  </div>

  <my-video-alert [video]="video" [user]="user" [noPlaylistVideoFound]="noPlaylistVideoFound"></my-video-alert>

  <!-- Video information -->
  <div *ngIf="video" class="margin-content video-bottom">
    <div class="video-info">
      <div class="video-info-first-row">
        <div>
          <ng-template #publishedTemplate>
            <ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container>
            •
            <my-video-views-counter [video]="video"></my-video-views-counter>
          </ng-template>

          <div class="d-block d-md-none"> <!-- only shown on medium devices, has its counterpart for larger viewports below -->
            <h1 class="video-info-name">{{ video.name }}</h1>

            <div class="video-info-date-views">
              <ng-template *ngTemplateOutlet="publishedTemplate"></ng-template>
            </div>
          </div>

          <div class="d-flex justify-content-between flex-direction-column">
            <div class="d-none d-md-block">
              <h1 class="video-info-name">{{ video.name }}</h1>
            </div>

            <div class="video-info-first-row-bottom">
              <div class="d-none d-md-block video-info-date-views">
                <ng-template *ngTemplateOutlet="publishedTemplate"></ng-template>
              </div>

              <my-action-buttons
                [video]="video" [videoPassword]="videoPassword" [videoCaptions]="videoCaptions"
                [isUserLoggedIn]="isUserLoggedIn()" [isUserOwner]="isUserOwner()"
                [transcriptionWidgetOpened]="transcriptionWidgetOpened"
                [playlist]="playlist" [currentTime]="getCurrentTime()" [currentPlaylistPosition]="getCurrentPlaylistPosition()"
                (showTranscriptionWidget)="transcriptionWidgetOpened = true" (hideTranscriptionWidget)="transcriptionWidgetOpened = false"
              ></my-action-buttons>
            </div>
          </div>

          <div class="pt-3 border-top video-info-channel d-flex">
            <div class="video-info-channel-left d-flex">
              <my-video-avatar-channel [video]="video" [showChannel]="!isChannelDisplayNameGeneric()"></my-video-avatar-channel>

              <div class="video-info-channel-left-links ms-1">
                <ng-container *ngIf="!isChannelDisplayNameGeneric()">
                  <a [routerLink]="[ '/c', video.byVideoChannel ]" i18n-title title="Channel page">
                    {{ video.channel.displayName }}
                  </a>
                  <a [routerLink]="[ '/a', video.byAccount ]" i18n-title title="Account page">
                    <span i18n>By {{ video.byAccount }}</span>
                  </a>
                </ng-container>

                <ng-container *ngIf="isChannelDisplayNameGeneric()">
                  <a [routerLink]="[ '/a', video.byAccount ]" class="single-link" i18n-title title="Account page">
                    <span i18n>{{ video.byAccount }}</span>
                  </a>
                </ng-container>
              </div>
            </div>

            <my-subscribe-button #subscribeButton [videoChannels]="[video.channel]" size="small"></my-subscribe-button>
          </div>
        </div>

      </div>

      <my-video-description [video]="video" (timestampClicked)="handleTimestampClicked($event)"></my-video-description>

      <my-video-attributes [video]="video"></my-video-attributes>

      <my-video-comments
        class="border-top"
        [video]="video"
        [videoPassword]="videoPassword"
        [user]="user"
        (timestampClicked)="handleTimestampClicked($event)"
      ></my-video-comments>
    </div>

    <my-recommended-videos
      [displayAsRow]="displayOtherVideosAsRow()"
      [currentVideo]="video"
      [playlist]="playlist"
      (gotRecommendations)="onRecommendations($event)"
    ></my-recommended-videos>
  </div>

  <my-privacy-concerns *ngIf="video" [video]="video"></my-privacy-concerns>
</div>

<my-player-styles></my-player-styles>