]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/utils.ts
Recover HLS video with duration inconsistency
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / utils.ts
index f0a1b1aee246c7e5141a30a139e8560ad36d475e..18380d9501033ee03baa243916f26e4e3890287d 100644 (file)
@@ -1,4 +1,3 @@
-import { escapeHTML } from '@shared/core-utils/renderer'
 import { VideoFile } from '@shared/models'
 
 function toTitleCase (str: string) {
@@ -17,7 +16,7 @@ function isIOS () {
   // Detect iPad Desktop mode
   return !!(navigator.maxTouchPoints &&
       navigator.maxTouchPoints > 2 &&
-      /MacIntel/.test(navigator.platform))
+      navigator.platform.includes('MacIntel'))
 }
 
 function isSafari () {
@@ -44,14 +43,17 @@ function isMobile () {
 }
 
 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>'
+  const iframe = document.createElement('iframe')
+
+  iframe.title = embedTitle
+  iframe.width = '560'
+  iframe.height = '315'
+  iframe.src = embedUrl
+  iframe.frameBorder = '0'
+  iframe.allowFullscreen = true
+  iframe.sandbox.add('allow-same-origin', 'allow-scripts', 'allow-popups')
+
+  return iframe.outerHTML
 }
 
 function videoFileMaxByResolution (files: VideoFile[]) {