]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Client: add button control in embed videojs to go to the watch page
authorChocobozzz <florian.bigard@gmail.com>
Wed, 9 Nov 2016 22:03:17 +0000 (23:03 +0100)
committerChocobozzz <florian.bigard@gmail.com>
Wed, 16 Nov 2016 19:29:26 +0000 (20:29 +0100)
client/src/standalone/videos/embed.html

index cb4ebf2d1577d7740523fd3a9ea6ee0f386bf923..c154e9570f74656049394ef55c04c1d0a86934e5 100644 (file)
       .vjs-poster {
         background-size: 100% auto;
       }
+
+      .vjs-peertube-link {
+        color: white;
+        text-decoration: none;
+        font-size: 1.3em;
+        line-height: 2.20;
+        transition: all .4s;
+      }
+
+      .vjs-peertube-link:hover {
+        text-shadow: 0 0 1em #fff;
+      }
+
     </style>
   </head>
 
     videojs('video-container', { controls: true, autoplay: false }, function () {
       var player = this
 
+      var Button = videojs.getComponent('Button')
+      var peertubeLinkButton = videojs.extend(Button, {
+        constructor: function () {
+          Button.apply(this, arguments)
+        },
+
+        createEl: function () {
+          var link = document.createElement('a')
+          link.href = window.location.href.replace('embed', 'watch')
+          link.innerHTML = 'PeerTube'
+          link.title = 'Go to the video page'
+          link.className = 'vjs-peertube-link'
+
+          return link
+        }
+      })
+      videojs.registerComponent('PeerTubeLinkButton', peertubeLinkButton)
+
+      var controlBar = player.getChild('controlBar')
+      var addedLink = controlBar.addChild('PeerTubeLinkButton', {})
+      controlBar.el().insertBefore(addedLink.el(), controlBar.fullscreenToggle.el())
+
       player.dock({
         title: videoInfos.name
       })