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('/')
peertube: {
videoFiles: videoInfo.files,
playerElement: videoElement,
- peerTubeLink: true
+ peerTubeLink: true,
+ videoViewUrl: getVideoUrl(videoId) + '/views',
+ videoDuration: videoInfo.duration
},
hotkeys: {
enableVolumeScroll: false
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))