]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/standalone/videos/embed.ts
Add messages about privacy concerns (P2P)
[github/Chocobozzz/PeerTube.git] / client / src / standalone / videos / embed.ts
index d0676968e386b2bbebd816b492f9d69b709ba780..bb6baf7f0a1ac100ceffdf7d6d9f179e5813cad7 100644 (file)
@@ -6,9 +6,13 @@ import '../../assets/player/peertube-videojs-plugin'
 import 'videojs-dock/dist/videojs-dock.es.js'
 import { VideoDetails } from '../../../../shared'
 
-async function loadVideoInfo (videoId: string) {
-  const response = await fetch(window.location.origin + '/api/v1/videos/' + videoId)
-  return response.json();
+function getVideoUrl (id: string) {
+  return window.location.origin + '/api/v1/videos/' + id
+}
+
+async function loadVideoInfo (videoId: string): Promise<VideoDetails> {
+  const response = await fetch(getVideoUrl(videoId))
+  return response.json()
 }
 
 const urlParts = window.location.href.split('/')
@@ -27,7 +31,9 @@ loadVideoInfo(videoId)
         peertube: {
           videoFiles: videoInfo.files,
           playerElement: videoElement,
-          peerTubeLink: true
+          peerTubeLink: true,
+          videoViewUrl: getVideoUrl(videoId) + '/views',
+          videoDuration: videoInfo.duration
         },
         hotkeys: {
           enableVolumeScroll: false
@@ -38,10 +44,9 @@ loadVideoInfo(videoId)
       const player = this
 
       player.dock({
-        title: videoInfo.name
+        title: videoInfo.name,
+        description: 'Use P2P, other may know you are watching that video.'
       })
     })
   })
-  .catch(err => {
-    console.error(err);
-  })
+  .catch(err => console.error(err))