diff options
author | Chocobozzz <me@florianbigard.com> | 2019-01-23 15:36:45 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-02-11 09:13:02 +0100 |
commit | 2adfc7ea9a1f858db874df9fe322e7ae833db77c (patch) | |
tree | e27c6ebe01b7c96ea0e053839a38fc1f824d1284 /client/src/assets/player/p2p-media-loader-plugin.ts | |
parent | 7eeb6a0ba4028d0e20847b846332dd0b7747c7f8 (diff) | |
download | PeerTube-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.ts | 33 |
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 | ||
3 | import * as videojs from 'video.js' | ||
4 | import { P2PMediaLoaderPluginOptions, VideoJSComponentInterface } from './peertube-videojs-typings' | ||
5 | |||
6 | // videojs-hlsjs-plugin needs videojs in window | ||
7 | window['videojs'] = videojs | ||
8 | import '@streamroot/videojs-hlsjs-plugin' | ||
9 | |||
10 | import { initVideoJsContribHlsJsPlayer } from 'p2p-media-loader-hlsjs' | ||
11 | |||
12 | // import { Events } from '../p2p-media-loader/p2p-media-loader-core/lib' | ||
13 | |||
14 | const Plugin: VideoJSComponentInterface = videojs.getPlugin('plugin') | ||
15 | class 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 | |||
32 | videojs.registerPlugin('p2pMediaLoader', P2pMediaLoaderPlugin) | ||
33 | export { P2pMediaLoaderPlugin } | ||