From 3e2bc4ea4955ee452d742647683b9021d6b4d6d5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 12 May 2020 10:32:56 +0200 Subject: Fix webtorrent play on Safari --- client/src/assets/player/utils.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'client/src/assets/player/utils.ts') diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.ts index fa902e1f1..a72bf0123 100644 --- a/client/src/assets/player/utils.ts +++ b/client/src/assets/player/utils.ts @@ -8,6 +8,14 @@ function isWebRTCDisabled () { return !!((window as any).RTCPeerConnection || (window as any).mozRTCPeerConnection || (window as any).webkitRTCPeerConnection) === false } +function isIOS () { + return !!navigator.platform && /iPad|iPhone|iPod/.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 +200,7 @@ export { videoFileMinByResolution, copyToClipboard, isMobile, - bytes + bytes, + isIOS, + isSafari } -- cgit v1.2.3