diff options
Diffstat (limited to 'client/src/assets/player/peertube-player.ts')
-rw-r--r-- | client/src/assets/player/peertube-player.ts | 27 |
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 | ||
3 | import 'videojs-hotkeys' | 3 | import 'videojs-hotkeys' |
4 | import 'videojs-dock' | 4 | import 'videojs-dock' |
5 | import 'videojs-contextmenu' | ||
6 | import 'videojs-contextmenu-ui' | ||
5 | import './peertube-link-button' | 7 | import './peertube-link-button' |
6 | import './resolution-menu-button' | 8 | import './resolution-menu-button' |
7 | import './settings-menu-button' | 9 | import './settings-menu-button' |
8 | import './webtorrent-info-button' | 10 | import './webtorrent-info-button' |
9 | import './peertube-videojs-plugin' | 11 | import './peertube-videojs-plugin' |
10 | import { videojsUntyped } from './peertube-videojs-typings' | 12 | import { videojsUntyped } from './peertube-videojs-typings' |
13 | import { 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) |
13 | videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed' | 16 | videojsUntyped.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: { |