]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/peertube-player-manager.ts
Fix http player defaulting to audio resolution
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / peertube-player-manager.ts
index 018845a54c85fecfb3da850273ec86d8dfdeea1b..62dff82859320aa1dc8b6e041a850ee022d9922b 100644 (file)
@@ -4,6 +4,8 @@ import 'videojs-contextmenu-pt'
 import 'videojs-contrib-quality-levels'
 import './upnext/end-card'
 import './upnext/upnext-plugin'
+import './stats/stats-card'
+import './stats/stats-plugin'
 import './bezels/bezels-plugin'
 import './peertube-plugin'
 import './videojs-components/next-previous-video-button'
@@ -170,6 +172,11 @@ export class PeertubePlayerManager {
         self.addContextMenu(mode, player, options.common.embedUrl, options.common.embedTitle)
 
         player.bezels()
+        player.stats({
+          videoUUID: options.common.videoUUID,
+          videoIsLive: options.common.isLive,
+          mode
+        })
 
         return res(player)
       })
@@ -220,7 +227,9 @@ export class PeertubePlayerManager {
     const isHLS = mode === 'p2p-media-loader'
 
     let autoplay = this.getAutoPlayValue(commonOptions.autoplay)
-    let html5 = {}
+    let html5 = {
+      preloadTextTracks: false
+    }
 
     const plugins: VideoJSPluginOptions = {
       peertube: {
@@ -248,7 +257,7 @@ export class PeertubePlayerManager {
     if (isHLS) {
       const { hlsjs } = PeertubePlayerManager.addP2PMediaLoaderOptions(plugins, options, p2pMediaLoaderModule)
 
-      html5 = hlsjs.html5
+      Object.assign(html5, hlsjs.html5)
     }
 
     if (mode === 'webtorrent') {
@@ -500,7 +509,8 @@ export class PeertubePlayerManager {
       const isLoopEnabled = player.options_['loop']
       const items = [
         {
-          label: isLoopEnabled ? player.localize('Stop playing in loop') : player.localize('Play in loop'),
+          icon: 'repeat',
+          label: player.localize('Play in loop') + (isLoopEnabled ? '<span class="vjs-icon-tick-white"></span>' : ''),
           listener: function () {
             player.options_['loop'] = !isLoopEnabled
           }
@@ -518,6 +528,7 @@ export class PeertubePlayerManager {
           }
         },
         {
+          icon: 'code',
           label: player.localize('Copy embed code'),
           listener: () => {
             copyToClipboard(buildVideoOrPlaylistEmbed(videoEmbedUrl, videoEmbedTitle))
@@ -534,7 +545,18 @@ export class PeertubePlayerManager {
         })
       }
 
-      return items
+      items.push({
+        icon: 'info',
+        label: player.localize('Stats for nerds'),
+        listener: () => {
+          player.stats().show()
+        }
+      })
+
+      return items.map(i => ({
+        ...i,
+        label: `<span class="vjs-icon-${i.icon || 'link-2'}"></span>` + i.label
+      }))
     }
 
     // adding the menu