1 import { HTMLServerConfig, Video } from '@shared/models'
3 function buildVideoOrPlaylistEmbed (embedUrl: string, embedTitle: string) {
4 const iframe = document.createElement('iframe')
6 iframe.title = embedTitle
10 iframe.frameBorder = '0'
11 iframe.allowFullscreen = true
12 iframe.sandbox.add('allow-same-origin', 'allow-scripts', 'allow-popups')
14 return iframe.outerHTML
17 function isP2PEnabled (video: Video, config: HTMLServerConfig, userP2PEnabled: boolean) {
18 if (video.isLocal && config.tracker.enabled === false) return false
19 if (isWebRTCDisabled()) return false
25 buildVideoOrPlaylistEmbed,
29 // ---------------------------------------------------------------------------
31 function isWebRTCDisabled () {
32 return !!((window as any).RTCPeerConnection || (window as any).mozRTCPeerConnection || (window as any).webkitRTCPeerConnection) === false