aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/peertube-player.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player/peertube-player.ts')
-rw-r--r--client/src/assets/player/peertube-player.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts
index f419d58fc..9fe5af569 100644
--- a/client/src/assets/player/peertube-player.ts
+++ b/client/src/assets/player/peertube-player.ts
@@ -2,12 +2,15 @@ import { VideoFile } from '../../../../shared/models/videos'
2 2
3import 'videojs-hotkeys' 3import 'videojs-hotkeys'
4import 'videojs-dock' 4import 'videojs-dock'
5import 'videojs-contextmenu'
6import 'videojs-contextmenu-ui'
5import './peertube-link-button' 7import './peertube-link-button'
6import './resolution-menu-button' 8import './resolution-menu-button'
7import './settings-menu-button' 9import './settings-menu-button'
8import './webtorrent-info-button' 10import './webtorrent-info-button'
9import './peertube-videojs-plugin' 11import './peertube-videojs-plugin'
10import { videojsUntyped } from './peertube-videojs-typings' 12import { videojsUntyped } from './peertube-videojs-typings'
13import { buildVideoEmbed, buildVideoLink, copyToClipboard } from './utils'
11 14
12// Change 'Playback Rate' to 'Speed' (smaller for our settings menu) 15// Change 'Playback Rate' to 'Speed' (smaller for our settings menu)
13videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed' 16videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed'
@@ -16,6 +19,7 @@ function getVideojsOptions (options: {
16 autoplay: boolean, 19 autoplay: boolean,
17 playerElement: HTMLVideoElement, 20 playerElement: HTMLVideoElement,
18 videoViewUrl: string, 21 videoViewUrl: string,
22 videoEmbedUrl: string,
19 videoDuration: number, 23 videoDuration: number,
20 videoFiles: VideoFile[], 24 videoFiles: VideoFile[],
21 enableHotkeys: boolean, 25 enableHotkeys: boolean,
@@ -38,6 +42,29 @@ function getVideojsOptions (options: {
38 videoViewUrl: options.videoViewUrl, 42 videoViewUrl: options.videoViewUrl,
39 videoDuration: options.videoDuration, 43 videoDuration: options.videoDuration,
40 startTime: options.startTime 44 startTime: options.startTime
45 },
46 contextmenuUI: {
47 content: [
48 {
49 label: 'Copy the video URL',
50 listener: function () {
51 copyToClipboard(buildVideoLink())
52 }
53 },
54 {
55 label: 'Copy the video URL at the current time',
56 listener: function () {
57 const player = this
58 copyToClipboard(buildVideoLink(player.currentTime()))
59 }
60 },
61 {
62 label: 'Copy embed code',
63 listener: () => {
64 copyToClipboard(buildVideoEmbed(options.videoEmbedUrl))
65 }
66 }
67 ]
41 } 68 }
42 }, 69 },
43 controlBar: { 70 controlBar: {