]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/utils.ts
Merge branch 'release/3.2.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / utils.ts
index 6767459ce9fbc800788cb39bd96a2855b3f92d97..2bb70d1fa1a99ba0118eac6647fa96f36b4ee84d 100644 (file)
@@ -1,4 +1,5 @@
 import { VideoFile } from '@shared/models'
+import { escapeHTML } from '@shared/core-utils/renderer'
 
 function toTitleCase (str: string) {
   return str.charAt(0).toUpperCase() + str.slice(1)
@@ -64,7 +65,7 @@ function buildVideoLink (options: {
 
   const url = baseUrl
     ? baseUrl
-    : window.location.origin + window.location.pathname.replace('/embed/', '/watch/')
+    : window.location.origin + window.location.pathname.replace('/embed/', '/w/')
 
   const params = generateParams(window.location.search)
 
@@ -94,13 +95,13 @@ function buildVideoLink (options: {
 function buildPlaylistLink (options: {
   baseUrl?: string
 
-  playlistPosition: number
+  playlistPosition?: number
 }) {
   const { baseUrl } = options
 
   const url = baseUrl
     ? baseUrl
-    : window.location.origin + window.location.pathname.replace('/video-playlists/embed/', '/videos/watch/playlist/')
+    : window.location.origin + window.location.pathname.replace('/video-playlists/embed/', '/w/p/')
 
   const params = generateParams(window.location.search)
 
@@ -170,9 +171,11 @@ function secondsToTime (seconds: number, full = false, symbol?: string) {
   return time
 }
 
-function buildVideoOrPlaylistEmbed (embedUrl: string) {
+function buildVideoOrPlaylistEmbed (embedUrl: string, embedTitle: string) {
+  const title = escapeHTML(embedTitle)
   return '<iframe width="560" height="315" ' +
     'sandbox="allow-same-origin allow-scripts allow-popups" ' +
+    'title="' + title + '" ' +
     'src="' + embedUrl + '" ' +
     'frameborder="0" allowfullscreen>' +
     '</iframe>'