+function addContextMenu (player: any, videoEmbedUrl: string) {
+ player.contextmenuUI({
+ content: [
+ {
+ label: player.localize('Copy the video URL'),
+ listener: function () {
+ copyToClipboard(buildVideoLink())
+ }
+ },
+ {
+ label: player.localize('Copy the video URL at the current time'),
+ listener: function () {
+ const player = this
+ copyToClipboard(buildVideoLink(player.currentTime()))
+ }
+ },
+ {
+ label: player.localize('Copy embed code'),
+ listener: () => {
+ copyToClipboard(buildVideoEmbed(videoEmbedUrl))
+ }
+ }
+ ]
+ })
+}
+
+function loadLocale (serverUrl: string, videojs: any, locale: string) {
+ const completeLocale = getCompleteLocale(locale)
+
+ if (!is18nLocale(completeLocale) || isDefaultLocale(completeLocale)) return Promise.resolve(undefined)
+
+ return fetch(serverUrl + '/client/locales/' + completeLocale + '/player.json')
+ .then(res => res.json())
+ .then(json => videojs.addLanguage(getShortLocale(completeLocale), json))
+}
+
+export {
+ loadLocale,
+ getVideojsOptions,
+ addContextMenu
+}