aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/root-helpers/video.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-14 14:28:20 +0100
committerChocobozzz <me@florianbigard.com>2022-03-14 14:36:35 +0100
commit57d6503286b114fee61b5e4725825e2490dcac29 (patch)
tree2d3d23f697b2986d7e41bb443754394296b66ec3 /client/src/root-helpers/video.ts
parent9597920ee3d4ac99803e7107983ddf98a9dfb3c4 (diff)
downloadPeerTube-57d6503286b114fee61b5e4725825e2490dcac29.tar.gz
PeerTube-57d6503286b114fee61b5e4725825e2490dcac29.tar.zst
PeerTube-57d6503286b114fee61b5e4725825e2490dcac29.zip
Reorganize player files
Diffstat (limited to 'client/src/root-helpers/video.ts')
-rw-r--r--client/src/root-helpers/video.ts33
1 files changed, 33 insertions, 0 deletions
diff --git a/client/src/root-helpers/video.ts b/client/src/root-helpers/video.ts
new file mode 100644
index 000000000..4290992aa
--- /dev/null
+++ b/client/src/root-helpers/video.ts
@@ -0,0 +1,33 @@
1import { HTMLServerConfig, Video } from '@shared/models'
2
3function buildVideoOrPlaylistEmbed (embedUrl: string, embedTitle: string) {
4 const iframe = document.createElement('iframe')
5
6 iframe.title = embedTitle
7 iframe.width = '560'
8 iframe.height = '315'
9 iframe.src = embedUrl
10 iframe.frameBorder = '0'
11 iframe.allowFullscreen = true
12 iframe.sandbox.add('allow-same-origin', 'allow-scripts', 'allow-popups')
13
14 return iframe.outerHTML
15}
16
17function isP2PEnabled (video: Video, config: HTMLServerConfig, userP2PEnabled: boolean) {
18 if (video.isLocal && config.tracker.enabled === false) return false
19 if (isWebRTCDisabled()) return false
20
21 return userP2PEnabled
22}
23
24export {
25 buildVideoOrPlaylistEmbed,
26 isP2PEnabled
27}
28
29// ---------------------------------------------------------------------------
30
31function isWebRTCDisabled () {
32 return !!((window as any).RTCPeerConnection || (window as any).mozRTCPeerConnection || (window as any).webkitRTCPeerConnection) === false
33}