aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/p2p-media-loader-plugin.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-01-23 15:36:45 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-02-11 09:13:02 +0100
commit2adfc7ea9a1f858db874df9fe322e7ae833db77c (patch)
treee27c6ebe01b7c96ea0e053839a38fc1f824d1284 /client/src/assets/player/p2p-media-loader-plugin.ts
parent7eeb6a0ba4028d0e20847b846332dd0b7747c7f8 (diff)
downloadPeerTube-2adfc7ea9a1f858db874df9fe322e7ae833db77c.tar.gz
PeerTube-2adfc7ea9a1f858db874df9fe322e7ae833db77c.tar.zst
PeerTube-2adfc7ea9a1f858db874df9fe322e7ae833db77c.zip
Refractor videojs player
Add fake p2p-media-loader plugin
Diffstat (limited to 'client/src/assets/player/p2p-media-loader-plugin.ts')
-rw-r--r--client/src/assets/player/p2p-media-loader-plugin.ts33
1 files changed, 33 insertions, 0 deletions
diff --git a/client/src/assets/player/p2p-media-loader-plugin.ts b/client/src/assets/player/p2p-media-loader-plugin.ts
new file mode 100644
index 000000000..6d07a2c9c
--- /dev/null
+++ b/client/src/assets/player/p2p-media-loader-plugin.ts
@@ -0,0 +1,33 @@
1// FIXME: something weird with our path definition in tsconfig and typings
2// @ts-ignore
3import * as videojs from 'video.js'
4import { P2PMediaLoaderPluginOptions, VideoJSComponentInterface } from './peertube-videojs-typings'
5
6// videojs-hlsjs-plugin needs videojs in window
7window['videojs'] = videojs
8import '@streamroot/videojs-hlsjs-plugin'
9
10import { initVideoJsContribHlsJsPlayer } from 'p2p-media-loader-hlsjs'
11
12// import { Events } from '../p2p-media-loader/p2p-media-loader-core/lib'
13
14const Plugin: VideoJSComponentInterface = videojs.getPlugin('plugin')
15class P2pMediaLoaderPlugin extends Plugin {
16
17 constructor (player: videojs.Player, options: P2PMediaLoaderPluginOptions) {
18 super(player, options)
19
20 initVideoJsContribHlsJsPlayer(player)
21
22 console.log(options)
23
24 player.src({
25 type: options.type,
26 src: options.src
27 })
28 }
29
30}
31
32videojs.registerPlugin('p2pMediaLoader', P2pMediaLoaderPlugin)
33export { P2pMediaLoaderPlugin }