X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fassets%2Fplayer%2Futils.ts;h=81fe689514e057183b344fa75d7d1785378e1050;hb=b6a8cfc5714c93d0ecf6154e5d3a25b33b50b8cd;hp=777abb568efe89fd46940e35a1b04c3e7d19b98f;hpb=2f4c784a92ac50cacef07f4925e284b4041422f4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.ts index 777abb568..81fe68951 100644 --- a/client/src/assets/player/utils.ts +++ b/client/src/assets/player/utils.ts @@ -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}> = [ @@ -51,6 +66,9 @@ function buildVideoLink (options: { : window.location.origin + window.location.pathname.replace('/embed/', '/watch/') const params = new URLSearchParams(window.location.search) + // Remove these unused parameters when we are on a playlist page + params.delete('videoId') + params.delete('resume') if (options.startTime) { const startTimeInt = Math.floor(options.startTime) @@ -122,7 +140,7 @@ function secondsToTime (seconds: number, full = false, symbol?: string) { function buildVideoEmbed (embedUrl: string) { return '' @@ -189,5 +207,7 @@ export { videoFileMinByResolution, copyToClipboard, isMobile, - bytes + bytes, + isIOS, + isSafari }