]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Improve embed title background opacity
authorChocobozzz <me@florianbigard.com>
Mon, 3 Feb 2020 12:33:42 +0000 (13:33 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 3 Feb 2020 12:33:42 +0000 (13:33 +0100)
client/src/assets/player/peertube-videojs-typings.ts
client/src/assets/player/webtorrent/webtorrent-plugin.ts
client/src/sass/player/_player-variables.scss
client/src/sass/player/peertube-skin.scss
client/src/standalone/videos/embed.ts

index 8f3d76cacc707c6df1af483129eea8bfd2b64d73..a4e4c580c12c4eb5e7153b0846886ceefc3eb985 100644 (file)
@@ -42,6 +42,8 @@ declare module 'video.js' {
     }
 
     audioTracks (): AudioTrackList
+
+    dock (options: { title: string, description: string }): void
   }
 }
 
index d26fc38faa09328e522635c17f040222653c08fa..bf6b0a718dcbe024777916bf1ccf46ec091a27ea 100644 (file)
@@ -25,12 +25,13 @@ type PlayOptions = {
 const Plugin = videojs.getPlugin('plugin')
 
 class WebTorrentPlugin extends Plugin {
+  readonly videoFiles: VideoFile[]
+
   private readonly playerElement: HTMLVideoElement
 
   private readonly autoplay: boolean = false
   private readonly startTime: number = 0
   private readonly savePlayerSrcFunction: VideoJsPlayer['src']
-  private readonly videoFiles: VideoFile[]
   private readonly videoDuration: number
   private readonly CONSTANTS = {
     INFO_SCHEDULER: 1000, // Don't change this
index 0c2359ac707b2a1b6412baf4015654d4e25ae825..935a60b49b7da5bbde7cc8011630043a5885b356 100644 (file)
@@ -1,7 +1,7 @@
 $primary-foreground-color: #fff;
 $primary-foreground-opacity: 0.9;
 $primary-foreground-opacity-hover: 1;
-$primary-background-color: #000;
+$primary-background-color: rgba(0, 0, 0, 0.8);
 
 $font-size: 13px;
 $control-bar-height: 34px;
index e808538611fab7e5d1a1616c53b089c0cf6d8fdc..f801064285bede3585af21ff0b44909d02f9920b 100644 (file)
@@ -21,6 +21,12 @@ body {
 
   .vjs-dock-text {
     padding-right: 10px;
+    background: linear-gradient(to bottom, rgba(0, 0, 0, .6) 0, rgba(0, 0, 0, 0.2) 70%, rgba(0, 0, 0, 0) 100%);
+  }
+
+  .vjs-dock-title,
+  .vjs-dock-description {
+    text-shadow: 0 0 2px rgba(0, 0, 0, .5);
   }
 
   .vjs-dock-description {
@@ -55,7 +61,7 @@ body {
     $big-play-width: 1.2em;
     $big-play-height: 1.2em;
 
-    border: 4px solid #fff;
+    border: 2px solid #fff;
     border-radius: 100%;
 
     left: 50%;
index c91ae08b97d260646df77da6e57511a7e0a95f3a..d5b42a0259d065ac06423ddd527e5adb578f18b8 100644 (file)
@@ -1,15 +1,11 @@
 import './embed.scss'
 
 import {
-  getCompleteLocale,
-  is18nLocale,
-  isDefaultLocale,
   peertubeTranslate,
   ResultList,
   ServerConfig,
   VideoDetails
 } from '../../../../shared'
-import { VideoJSCaption } from '../../assets/player/peertube-videojs-typings'
 import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
 import {
   P2PMediaLoaderOptions,
@@ -19,10 +15,14 @@ import {
 import { VideoStreamingPlaylistType } from '../../../../shared/models/videos/video-streaming-playlist.type'
 import { PeerTubeEmbedApi } from './embed-api'
 import { TranslationsManager } from '../../assets/player/translations-manager'
+import { VideoJsPlayer } from 'video.js'
+import { VideoJSCaption } from '../../assets/player/peertube-videojs-typings'
+
+type Translations = { [ id: string ]: string }
 
 export class PeerTubeEmbed {
   videoElement: HTMLVideoElement
-  player: any
+  player: VideoJsPlayer
   api: PeerTubeEmbedApi = null
   autoplay: boolean
   controls: boolean
@@ -71,7 +71,7 @@ export class PeerTubeEmbed {
     element.parentElement.removeChild(element)
   }
 
-  displayError (text: string, translations?: { [ id: string ]: string }) {
+  displayError (text: string, translations?: Translations) {
     // Remove video element
     if (this.videoElement) this.removeElement(this.videoElement)
 
@@ -90,12 +90,12 @@ export class PeerTubeEmbed {
     errorText.innerHTML = translatedText
   }
 
-  videoNotFound (translations?: { [ id: string ]: string }) {
+  videoNotFound (translations?: Translations) {
     const text = 'This video does not exist.'
     this.displayError(text, translations)
   }
 
-  videoFetchError (translations?: { [ id: string ]: string }) {
+  videoFetchError (translations?: Translations) {
     const text = 'We cannot fetch the video. Please try again later.'
     this.displayError(text, translations)
   }
@@ -237,7 +237,7 @@ export class PeerTubeEmbed {
       })
     }
 
-    this.player = await PeertubePlayerManager.initialize(this.mode, options, (player: any) => this.player = player)
+    this.player = await PeertubePlayerManager.initialize(this.mode, options, (player: VideoJsPlayer) => this.player = player)
     this.player.on('customError', (event: any, data: any) => this.handleError(data.err, serverTranslations))
 
     window[ 'videojsPlayer' ] = this.player
@@ -261,19 +261,19 @@ export class PeerTubeEmbed {
   }
 
   private async buildDock (videoInfo: VideoDetails, configResponse: Response) {
-    if (this.controls) {
-      const title = this.title ? videoInfo.name : undefined
+    if (!this.controls) return
 
-      const config: ServerConfig = await configResponse.json()
-      const description = config.tracker.enabled && this.warningTitle
-        ? '<span class="text">' + this.player.localize('Watching this video may reveal your IP address to others.') + '</span>'
-        : undefined
+    const title = this.title ? videoInfo.name : undefined
 
-      this.player.dock({
-        title,
-        description
-      })
-    }
+    const config: ServerConfig = await configResponse.json()
+    const description = config.tracker.enabled && this.warningTitle
+      ? '<span class="text">' + peertubeTranslate('Watching this video may reveal your IP address to others.') + '</span>'
+      : undefined
+
+    this.player.dock({
+      title,
+      description
+    })
   }
 
   private buildCSS () {