]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/utils.ts
Add logic to handle playlist in embed
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / utils.ts
index fa902e1f1822dd3a7d18f76b7c26fedd3c0cf3ce..20d97c7e2182192be9a3b7f7f87a59ea5279717b 100644 (file)
@@ -1,4 +1,4 @@
-import { VideoFile } from '../../../../shared/models/videos'
+import { VideoFile } from '@shared/models'
 
 function toTitleCase (str: string) {
   return str.charAt(0).toUpperCase() + str.slice(1)
@@ -8,6 +8,21 @@ function isWebRTCDisabled () {
   return !!((window as any).RTCPeerConnection || (window as any).mozRTCPeerConnection || (window as any).webkitRTCPeerConnection) === false
 }
 
+function isIOS () {
+  if (/iPad|iPhone|iPod/.test(navigator.platform)) {
+    return true
+  }
+
+  // Detect iPad Desktop mode
+  return !!(navigator.maxTouchPoints &&
+      navigator.maxTouchPoints > 2 &&
+      /MacIntel/.test(navigator.platform))
+}
+
+function isSafari () {
+  return /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
+}
+
 // https://github.com/danrevah/ngx-pipes/blob/master/src/pipes/math/bytes.ts
 // Don't import all Angular stuff, just copy the code with shame
 const dictionaryBytes: Array<{max: number, type: string}> = [
@@ -192,5 +207,7 @@ export {
   videoFileMinByResolution,
   copyToClipboard,
   isMobile,
-  bytes
+  bytes,
+  isIOS,
+  isSafari
 }