+function isWebRTCDisabled () {
+ return !!((window as any).RTCPeerConnection || (window as any).mozRTCPeerConnection || (window as any).webkitRTCPeerConnection) === false
+}
+
+function isP2PEnabled (video: Video, config: HTMLServerConfig, userP2PEnabled: boolean) {
+ if (video.isLocal && config.tracker.enabled === false) return false
+ if (isWebRTCDisabled()) return false
+
+ return userP2PEnabled
+}
+
+function isIOS () {
+ if (/iPad|iPhone|iPod/.test(navigator.platform)) {
+ return true
+ }
+
+ // Detect iPad Desktop mode
+ return !!(navigator.maxTouchPoints &&
+ navigator.maxTouchPoints > 2 &&
+ navigator.platform.includes('MacIntel'))
+}
+
+function isSafari () {
+ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
+}
+