diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-14 14:28:20 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-03-14 14:36:35 +0100 |
commit | 57d6503286b114fee61b5e4725825e2490dcac29 (patch) | |
tree | 2d3d23f697b2986d7e41bb443754394296b66ec3 /client/src/assets | |
parent | 9597920ee3d4ac99803e7107983ddf98a9dfb3c4 (diff) | |
download | PeerTube-57d6503286b114fee61b5e4725825e2490dcac29.tar.gz PeerTube-57d6503286b114fee61b5e4725825e2490dcac29.tar.zst PeerTube-57d6503286b114fee61b5e4725825e2490dcac29.zip |
Reorganize player files
Diffstat (limited to 'client/src/assets')
-rw-r--r-- | client/src/assets/player/index.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/peertube-player-manager.ts | 59 | ||||
-rw-r--r-- | client/src/assets/player/shared/bezels/bezels-plugin.ts (renamed from client/src/assets/player/bezels/bezels-plugin.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/bezels/index.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/bezels/pause-bezel.ts (renamed from client/src/assets/player/bezels/pause-bezel.ts) | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/common/index.ts | 1 | ||||
-rw-r--r-- | client/src/assets/player/shared/common/utils.ts | 66 | ||||
-rw-r--r-- | client/src/assets/player/shared/control-bar/index.ts | 5 | ||||
-rw-r--r-- | client/src/assets/player/shared/control-bar/next-previous-video-button.ts (renamed from client/src/assets/player/control-bar/next-previous-video-button.ts) | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/control-bar/p2p-info-button.ts (renamed from client/src/assets/player/control-bar/p2p-info-button.ts) | 4 | ||||
-rw-r--r-- | client/src/assets/player/shared/control-bar/peertube-link-button.ts (renamed from client/src/assets/player/control-bar/peertube-link-button.ts) | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/control-bar/peertube-load-progress-bar.ts (renamed from client/src/assets/player/control-bar/peertube-load-progress-bar.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/control-bar/theater-button.ts (renamed from client/src/assets/player/control-bar/theater-button.ts) | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/dock/index.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/dock/peertube-dock-component.ts (renamed from client/src/assets/player/dock/peertube-dock-component.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/dock/peertube-dock-plugin.ts (renamed from client/src/assets/player/dock/peertube-dock-plugin.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/hotkeys/index.ts | 1 | ||||
-rw-r--r-- | client/src/assets/player/shared/hotkeys/peertube-hotkeys-plugin.ts (renamed from client/src/assets/player/hotkeys/peertube-hotkeys-plugin.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/manager-options/control-bar-options-builder.ts (renamed from client/src/assets/player/manager-options/control-bar-options-builder.ts) | 11 | ||||
-rw-r--r-- | client/src/assets/player/shared/manager-options/hls-options-builder.ts (renamed from client/src/assets/player/manager-options/hls-options-builder.ts) | 8 | ||||
-rw-r--r-- | client/src/assets/player/shared/manager-options/index.ts | 1 | ||||
-rw-r--r-- | client/src/assets/player/shared/manager-options/manager-options-builder.ts (renamed from client/src/assets/player/manager-options/manager-options-builder.ts) | 9 | ||||
-rw-r--r-- | client/src/assets/player/shared/manager-options/webtorrent-options-builder.ts (renamed from client/src/assets/player/manager-options/webtorrent-options-builder.ts) | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/mobile/index.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/mobile/peertube-mobile-buttons.ts (renamed from client/src/assets/player/mobile/peertube-mobile-buttons.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/mobile/peertube-mobile-plugin.ts (renamed from client/src/assets/player/mobile/peertube-mobile-plugin.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/p2p-media-loader/hls-plugin.ts (renamed from client/src/assets/player/p2p-media-loader/hls-plugin.ts) | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/p2p-media-loader/index.ts | 5 | ||||
-rw-r--r-- | client/src/assets/player/shared/p2p-media-loader/p2p-media-loader-plugin.ts (renamed from client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts) | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/p2p-media-loader/redundancy-url-manager.ts (renamed from client/src/assets/player/p2p-media-loader/redundancy-url-manager.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/p2p-media-loader/segment-url-builder.ts (renamed from client/src/assets/player/p2p-media-loader/segment-url-builder.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/p2p-media-loader/segment-validator.ts (renamed from client/src/assets/player/p2p-media-loader/segment-validator.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/peertube/index.ts | 1 | ||||
-rw-r--r-- | client/src/assets/player/shared/peertube/peertube-plugin.ts (renamed from client/src/assets/player/peertube-plugin.ts) | 8 | ||||
-rw-r--r-- | client/src/assets/player/shared/playlist/index.ts | 4 | ||||
-rw-r--r-- | client/src/assets/player/shared/playlist/playlist-button.ts (renamed from client/src/assets/player/playlist/playlist-button.ts) | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/playlist/playlist-menu-item.ts (renamed from client/src/assets/player/playlist/playlist-menu-item.ts) | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/playlist/playlist-menu.ts (renamed from client/src/assets/player/playlist/playlist-menu.ts) | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/playlist/playlist-plugin.ts (renamed from client/src/assets/player/playlist/playlist-plugin.ts) | 4 | ||||
-rw-r--r-- | client/src/assets/player/shared/resolutions/index.ts | 1 | ||||
-rw-r--r-- | client/src/assets/player/shared/resolutions/peertube-resolutions-plugin.ts (renamed from client/src/assets/player/peertube-resolutions-plugin.ts) | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/settings/index.ts | 7 | ||||
-rw-r--r-- | client/src/assets/player/shared/settings/resolution-menu-button.ts (renamed from client/src/assets/player/settings/resolution-menu-button.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/settings/resolution-menu-item.ts (renamed from client/src/assets/player/settings/resolution-menu-item.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/settings/settings-dialog.ts (renamed from client/src/assets/player/settings/settings-dialog.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/settings/settings-menu-button.ts (renamed from client/src/assets/player/settings/settings-menu-button.ts) | 6 | ||||
-rw-r--r-- | client/src/assets/player/shared/settings/settings-menu-item.ts (renamed from client/src/assets/player/settings/settings-menu-item.ts) | 3 | ||||
-rw-r--r-- | client/src/assets/player/shared/settings/settings-panel-child.ts (renamed from client/src/assets/player/settings/settings-panel-child.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/settings/settings-panel.ts (renamed from client/src/assets/player/settings/settings-panel.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/stats/index.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/stats/stats-card.ts (renamed from client/src/assets/player/stats/stats-card.ts) | 4 | ||||
-rw-r--r-- | client/src/assets/player/shared/stats/stats-plugin.ts (renamed from client/src/assets/player/stats/stats-plugin.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/upnext/end-card.ts (renamed from client/src/assets/player/upnext/end-card.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/upnext/index.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/shared/upnext/upnext-plugin.ts (renamed from client/src/assets/player/upnext/upnext-plugin.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/webtorrent/peertube-chunk-store.ts (renamed from client/src/assets/player/webtorrent/peertube-chunk-store.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/webtorrent/video-renderer.ts (renamed from client/src/assets/player/webtorrent/video-renderer.ts) | 0 | ||||
-rw-r--r-- | client/src/assets/player/shared/webtorrent/webtorrent-plugin.ts (renamed from client/src/assets/player/webtorrent/webtorrent-plugin.ts) | 7 | ||||
-rw-r--r-- | client/src/assets/player/types/index.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/types/manager-options.ts (renamed from client/src/assets/player/manager-options/manager-options.model.ts) | 2 | ||||
-rw-r--r-- | client/src/assets/player/types/peertube-videojs-typings.ts (renamed from client/src/assets/player/peertube-videojs-typings.ts) | 24 |
61 files changed, 192 insertions, 85 deletions
diff --git a/client/src/assets/player/index.ts b/client/src/assets/player/index.ts index 92270476d..9b87afc4a 100644 --- a/client/src/assets/player/index.ts +++ b/client/src/assets/player/index.ts | |||
@@ -1,2 +1,2 @@ | |||
1 | export * from './peertube-player-manager' | 1 | export * from './peertube-player-manager' |
2 | export * from './manager-options/manager-options.model' | 2 | export * from './types' |
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index ddb521a52..1b2a67c77 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts | |||
@@ -1,35 +1,34 @@ | |||
1 | import '@peertube/videojs-contextmenu' | 1 | import '@peertube/videojs-contextmenu' |
2 | import './upnext/end-card' | 2 | import './shared/upnext/end-card' |
3 | import './upnext/upnext-plugin' | 3 | import './shared/upnext/upnext-plugin' |
4 | import './stats/stats-card' | 4 | import './shared/stats/stats-card' |
5 | import './stats/stats-plugin' | 5 | import './shared/stats/stats-plugin' |
6 | import './bezels/bezels-plugin' | 6 | import './shared/bezels/bezels-plugin' |
7 | import './peertube-plugin' | 7 | import './shared/peertube/peertube-plugin' |
8 | import './peertube-resolutions-plugin' | 8 | import './shared/resolutions/peertube-resolutions-plugin' |
9 | import './control-bar/next-previous-video-button' | 9 | import './shared/control-bar/next-previous-video-button' |
10 | import './control-bar/p2p-info-button' | 10 | import './shared/control-bar/p2p-info-button' |
11 | import './control-bar/peertube-link-button' | 11 | import './shared/control-bar/peertube-link-button' |
12 | import './control-bar/peertube-load-progress-bar' | 12 | import './shared/control-bar/peertube-load-progress-bar' |
13 | import './control-bar/theater-button' | 13 | import './shared/control-bar/theater-button' |
14 | import './settings/resolution-menu-button' | 14 | import './shared/settings/resolution-menu-button' |
15 | import './settings/resolution-menu-item' | 15 | import './shared/settings/resolution-menu-item' |
16 | import './settings/settings-dialog' | 16 | import './shared/settings/settings-dialog' |
17 | import './settings/settings-menu-button' | 17 | import './shared/settings/settings-menu-button' |
18 | import './settings/settings-menu-item' | 18 | import './shared/settings/settings-menu-item' |
19 | import './settings/settings-panel' | 19 | import './shared/settings/settings-panel' |
20 | import './settings/settings-panel-child' | 20 | import './shared/settings/settings-panel-child' |
21 | import './playlist/playlist-plugin' | 21 | import './shared/playlist/playlist-plugin' |
22 | import './mobile/peertube-mobile-plugin' | 22 | import './shared/mobile/peertube-mobile-plugin' |
23 | import './mobile/peertube-mobile-buttons' | 23 | import './shared/mobile/peertube-mobile-buttons' |
24 | import './hotkeys/peertube-hotkeys-plugin' | 24 | import './shared/hotkeys/peertube-hotkeys-plugin' |
25 | import videojs from 'video.js' | 25 | import videojs from 'video.js' |
26 | import { PluginsManager } from '@root-helpers/plugins-manager' | 26 | import { PluginsManager } from '@root-helpers/plugins-manager' |
27 | import { ManagerOptionsBuilder } from './manager-options/manager-options-builder' | 27 | import { isMobile } from '@root-helpers/web-browser' |
28 | import { CommonOptions, PeertubePlayerManagerOptions, PlayerMode } from './manager-options/manager-options.model' | ||
29 | import { saveAverageBandwidth } from './peertube-player-local-storage' | 28 | import { saveAverageBandwidth } from './peertube-player-local-storage' |
30 | import { PlayerNetworkInfo } from './peertube-videojs-typings' | 29 | import { ManagerOptionsBuilder } from './shared/manager-options' |
31 | import { TranslationsManager } from './translations-manager' | 30 | import { TranslationsManager } from './translations-manager' |
32 | import { isMobile } from './utils' | 31 | import { CommonOptions, PeertubePlayerManagerOptions, PlayerMode, PlayerNetworkInfo } from './types' |
33 | 32 | ||
34 | // Change 'Playback Rate' to 'Speed' (smaller for our settings menu) | 33 | // Change 'Playback Rate' to 'Speed' (smaller for our settings menu) |
35 | (videojs.getComponent('PlaybackRateMenuButton') as any).prototype.controlText_ = 'Speed' | 34 | (videojs.getComponent('PlaybackRateMenuButton') as any).prototype.controlText_ = 'Speed' |
@@ -60,11 +59,11 @@ export class PeertubePlayerManager { | |||
60 | this.onPlayerChange = onPlayerChange | 59 | this.onPlayerChange = onPlayerChange |
61 | this.playerElementClassName = options.common.playerElement.className | 60 | this.playerElementClassName = options.common.playerElement.className |
62 | 61 | ||
63 | if (mode === 'webtorrent') await import('./webtorrent/webtorrent-plugin') | 62 | if (mode === 'webtorrent') await import('./shared/webtorrent/webtorrent-plugin') |
64 | if (mode === 'p2p-media-loader') { | 63 | if (mode === 'p2p-media-loader') { |
65 | const [ p2pMediaLoaderModule ] = await Promise.all([ | 64 | const [ p2pMediaLoaderModule ] = await Promise.all([ |
66 | import('@peertube/p2p-media-loader-hlsjs'), | 65 | import('@peertube/p2p-media-loader-hlsjs'), |
67 | import('./p2p-media-loader/p2p-media-loader-plugin') | 66 | import('./shared/p2p-media-loader/p2p-media-loader-plugin') |
68 | ]) | 67 | ]) |
69 | 68 | ||
70 | this.p2pMediaLoaderModule = p2pMediaLoaderModule | 69 | this.p2pMediaLoaderModule = p2pMediaLoaderModule |
@@ -174,7 +173,7 @@ export class PeertubePlayerManager { | |||
174 | 173 | ||
175 | this.rebuildAndUpdateVideoElement(currentPlayer, options.common) | 174 | this.rebuildAndUpdateVideoElement(currentPlayer, options.common) |
176 | 175 | ||
177 | await import('./webtorrent/webtorrent-plugin') | 176 | await import('./shared/webtorrent/webtorrent-plugin') |
178 | 177 | ||
179 | const newPlayer = await this.buildPlayer('webtorrent', options) | 178 | const newPlayer = await this.buildPlayer('webtorrent', options) |
180 | this.onPlayerChange(newPlayer) | 179 | this.onPlayerChange(newPlayer) |
diff --git a/client/src/assets/player/bezels/bezels-plugin.ts b/client/src/assets/player/shared/bezels/bezels-plugin.ts index ca88bc1f9..ca88bc1f9 100644 --- a/client/src/assets/player/bezels/bezels-plugin.ts +++ b/client/src/assets/player/shared/bezels/bezels-plugin.ts | |||
diff --git a/client/src/assets/player/shared/bezels/index.ts b/client/src/assets/player/shared/bezels/index.ts new file mode 100644 index 000000000..da861b07a --- /dev/null +++ b/client/src/assets/player/shared/bezels/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './bezels-plugin' | ||
2 | export * from './pause-bezel' | ||
diff --git a/client/src/assets/player/bezels/pause-bezel.ts b/client/src/assets/player/shared/bezels/pause-bezel.ts index 315964311..e35c39a5f 100644 --- a/client/src/assets/player/bezels/pause-bezel.ts +++ b/client/src/assets/player/shared/bezels/pause-bezel.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { isMobile } from '../utils' | 2 | import { isMobile } from '@root-helpers/web-browser' |
3 | 3 | ||
4 | function getPauseBezel () { | 4 | function getPauseBezel () { |
5 | return ` | 5 | return ` |
diff --git a/client/src/assets/player/shared/common/index.ts b/client/src/assets/player/shared/common/index.ts new file mode 100644 index 000000000..9c56149ef --- /dev/null +++ b/client/src/assets/player/shared/common/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './utils' | |||
diff --git a/client/src/assets/player/shared/common/utils.ts b/client/src/assets/player/shared/common/utils.ts new file mode 100644 index 000000000..da7dda0c7 --- /dev/null +++ b/client/src/assets/player/shared/common/utils.ts | |||
@@ -0,0 +1,66 @@ | |||
1 | import { VideoFile } from '@shared/models' | ||
2 | |||
3 | function toTitleCase (str: string) { | ||
4 | return str.charAt(0).toUpperCase() + str.slice(1) | ||
5 | } | ||
6 | |||
7 | // https://github.com/danrevah/ngx-pipes/blob/master/src/pipes/math/bytes.ts | ||
8 | // Don't import all Angular stuff, just copy the code with shame | ||
9 | const dictionaryBytes: Array<{max: number, type: string}> = [ | ||
10 | { max: 1024, type: 'B' }, | ||
11 | { max: 1048576, type: 'KB' }, | ||
12 | { max: 1073741824, type: 'MB' }, | ||
13 | { max: 1.0995116e12, type: 'GB' } | ||
14 | ] | ||
15 | function bytes (value: number) { | ||
16 | const format = dictionaryBytes.find(d => value < d.max) || dictionaryBytes[dictionaryBytes.length - 1] | ||
17 | const calc = Math.floor(value / (format.max / 1024)).toString() | ||
18 | |||
19 | return [ calc, format.type ] | ||
20 | } | ||
21 | |||
22 | function videoFileMaxByResolution (files: VideoFile[]) { | ||
23 | let max = files[0] | ||
24 | |||
25 | for (let i = 1; i < files.length; i++) { | ||
26 | const file = files[i] | ||
27 | if (max.resolution.id < file.resolution.id) max = file | ||
28 | } | ||
29 | |||
30 | return max | ||
31 | } | ||
32 | |||
33 | function videoFileMinByResolution (files: VideoFile[]) { | ||
34 | let min = files[0] | ||
35 | |||
36 | for (let i = 1; i < files.length; i++) { | ||
37 | const file = files[i] | ||
38 | if (min.resolution.id > file.resolution.id) min = file | ||
39 | } | ||
40 | |||
41 | return min | ||
42 | } | ||
43 | |||
44 | function getRtcConfig () { | ||
45 | return { | ||
46 | iceServers: [ | ||
47 | { | ||
48 | urls: 'stun:stun.stunprotocol.org' | ||
49 | }, | ||
50 | { | ||
51 | urls: 'stun:stun.framasoft.org' | ||
52 | } | ||
53 | ] | ||
54 | } | ||
55 | } | ||
56 | |||
57 | // --------------------------------------------------------------------------- | ||
58 | |||
59 | export { | ||
60 | getRtcConfig, | ||
61 | toTitleCase, | ||
62 | |||
63 | videoFileMaxByResolution, | ||
64 | videoFileMinByResolution, | ||
65 | bytes | ||
66 | } | ||
diff --git a/client/src/assets/player/shared/control-bar/index.ts b/client/src/assets/player/shared/control-bar/index.ts new file mode 100644 index 000000000..db5b8938d --- /dev/null +++ b/client/src/assets/player/shared/control-bar/index.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export * from './next-previous-video-button' | ||
2 | export * from './p2p-info-button' | ||
3 | export * from './peertube-link-button' | ||
4 | export * from './peertube-load-progress-bar' | ||
5 | export * from './theater-button' | ||
diff --git a/client/src/assets/player/control-bar/next-previous-video-button.ts b/client/src/assets/player/shared/control-bar/next-previous-video-button.ts index fe17ce2ce..b7b986806 100644 --- a/client/src/assets/player/control-bar/next-previous-video-button.ts +++ b/client/src/assets/player/shared/control-bar/next-previous-video-button.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { NextPreviousVideoButtonOptions } from '../peertube-videojs-typings' | 2 | import { NextPreviousVideoButtonOptions } from '../../types' |
3 | 3 | ||
4 | const Button = videojs.getComponent('Button') | 4 | const Button = videojs.getComponent('Button') |
5 | 5 | ||
diff --git a/client/src/assets/player/control-bar/p2p-info-button.ts b/client/src/assets/player/shared/control-bar/p2p-info-button.ts index 081dee1d3..36517e125 100644 --- a/client/src/assets/player/control-bar/p2p-info-button.ts +++ b/client/src/assets/player/shared/control-bar/p2p-info-button.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { PeerTubeP2PInfoButtonOptions, PlayerNetworkInfo } from '../peertube-videojs-typings' | 2 | import { PeerTubeP2PInfoButtonOptions, PlayerNetworkInfo } from '../../types' |
3 | import { bytes } from '../utils' | 3 | import { bytes } from '../common' |
4 | 4 | ||
5 | const Button = videojs.getComponent('Button') | 5 | const Button = videojs.getComponent('Button') |
6 | class P2pInfoButton extends Button { | 6 | class P2pInfoButton extends Button { |
diff --git a/client/src/assets/player/control-bar/peertube-link-button.ts b/client/src/assets/player/shared/control-bar/peertube-link-button.ts index c49cee566..6d83263cc 100644 --- a/client/src/assets/player/control-bar/peertube-link-button.ts +++ b/client/src/assets/player/shared/control-bar/peertube-link-button.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { buildVideoLink, decorateVideoLink } from '@shared/core-utils' | 2 | import { buildVideoLink, decorateVideoLink } from '@shared/core-utils' |
3 | import { PeerTubeLinkButtonOptions } from '../peertube-videojs-typings' | 3 | import { PeerTubeLinkButtonOptions } from '../../types' |
4 | 4 | ||
5 | const Button = videojs.getComponent('Button') | 5 | const Button = videojs.getComponent('Button') |
6 | class PeerTubeLinkButton extends Button { | 6 | class PeerTubeLinkButton extends Button { |
diff --git a/client/src/assets/player/control-bar/peertube-load-progress-bar.ts b/client/src/assets/player/shared/control-bar/peertube-load-progress-bar.ts index 623e70eb2..623e70eb2 100644 --- a/client/src/assets/player/control-bar/peertube-load-progress-bar.ts +++ b/client/src/assets/player/shared/control-bar/peertube-load-progress-bar.ts | |||
diff --git a/client/src/assets/player/control-bar/theater-button.ts b/client/src/assets/player/shared/control-bar/theater-button.ts index f862ee224..56c349d6b 100644 --- a/client/src/assets/player/control-bar/theater-button.ts +++ b/client/src/assets/player/shared/control-bar/theater-button.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { saveTheaterInStore, getStoredTheater } from '../peertube-player-local-storage' | 2 | import { getStoredTheater, saveTheaterInStore } from '../../peertube-player-local-storage' |
3 | 3 | ||
4 | const Button = videojs.getComponent('Button') | 4 | const Button = videojs.getComponent('Button') |
5 | class TheaterButton extends Button { | 5 | class TheaterButton extends Button { |
diff --git a/client/src/assets/player/shared/dock/index.ts b/client/src/assets/player/shared/dock/index.ts new file mode 100644 index 000000000..16e70a9c1 --- /dev/null +++ b/client/src/assets/player/shared/dock/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './peertube-dock-component' | ||
2 | export * from './peertube-dock-plugin' | ||
diff --git a/client/src/assets/player/dock/peertube-dock-component.ts b/client/src/assets/player/shared/dock/peertube-dock-component.ts index 183c7a00f..183c7a00f 100644 --- a/client/src/assets/player/dock/peertube-dock-component.ts +++ b/client/src/assets/player/shared/dock/peertube-dock-component.ts | |||
diff --git a/client/src/assets/player/dock/peertube-dock-plugin.ts b/client/src/assets/player/shared/dock/peertube-dock-plugin.ts index 245981692..245981692 100644 --- a/client/src/assets/player/dock/peertube-dock-plugin.ts +++ b/client/src/assets/player/shared/dock/peertube-dock-plugin.ts | |||
diff --git a/client/src/assets/player/shared/hotkeys/index.ts b/client/src/assets/player/shared/hotkeys/index.ts new file mode 100644 index 000000000..cc99a1ea8 --- /dev/null +++ b/client/src/assets/player/shared/hotkeys/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './peertube-hotkeys-plugin' | |||
diff --git a/client/src/assets/player/hotkeys/peertube-hotkeys-plugin.ts b/client/src/assets/player/shared/hotkeys/peertube-hotkeys-plugin.ts index 5920450bd..5920450bd 100644 --- a/client/src/assets/player/hotkeys/peertube-hotkeys-plugin.ts +++ b/client/src/assets/player/shared/hotkeys/peertube-hotkeys-plugin.ts | |||
diff --git a/client/src/assets/player/manager-options/control-bar-options-builder.ts b/client/src/assets/player/shared/manager-options/control-bar-options-builder.ts index 54e61c5d0..72a10eb26 100644 --- a/client/src/assets/player/manager-options/control-bar-options-builder.ts +++ b/client/src/assets/player/shared/manager-options/control-bar-options-builder.ts | |||
@@ -1,5 +1,10 @@ | |||
1 | import { NextPreviousVideoButtonOptions, PeerTubeLinkButtonOptions } from '../peertube-videojs-typings' | 1 | import { |
2 | import { CommonOptions, PeertubePlayerManagerOptions, PlayerMode } from './manager-options.model' | 2 | CommonOptions, |
3 | NextPreviousVideoButtonOptions, | ||
4 | PeerTubeLinkButtonOptions, | ||
5 | PeertubePlayerManagerOptions, | ||
6 | PlayerMode | ||
7 | } from '../../types' | ||
3 | 8 | ||
4 | export class ControlBarOptionsBuilder { | 9 | export class ControlBarOptionsBuilder { |
5 | private options: CommonOptions | 10 | private options: CommonOptions |
@@ -41,7 +46,7 @@ export class ControlBarOptionsBuilder { | |||
41 | muteToggle: {}, | 46 | muteToggle: {}, |
42 | volumeControl: {}, | 47 | volumeControl: {}, |
43 | 48 | ||
44 | settingsButton: this.getSettingsButton() | 49 | ...this.getSettingsButton() |
45 | }) | 50 | }) |
46 | 51 | ||
47 | if (this.options.peertubeLink === true) { | 52 | if (this.options.peertubeLink === true) { |
diff --git a/client/src/assets/player/manager-options/hls-options-builder.ts b/client/src/assets/player/shared/manager-options/hls-options-builder.ts index 9de23561b..e7f664fd4 100644 --- a/client/src/assets/player/manager-options/hls-options-builder.ts +++ b/client/src/assets/player/shared/manager-options/hls-options-builder.ts | |||
@@ -1,13 +1,13 @@ | |||
1 | import { HybridLoaderSettings } from '@peertube/p2p-media-loader-core' | 1 | import { HybridLoaderSettings } from '@peertube/p2p-media-loader-core' |
2 | import { HlsJsEngineSettings } from '@peertube/p2p-media-loader-hlsjs' | 2 | import { HlsJsEngineSettings } from '@peertube/p2p-media-loader-hlsjs' |
3 | import { LiveVideoLatencyMode } from '@shared/models' | 3 | import { LiveVideoLatencyMode } from '@shared/models' |
4 | import { getAverageBandwidthInStore } from '../../peertube-player-local-storage' | ||
5 | import { P2PMediaLoader, P2PMediaLoaderPluginOptions } from '../../types' | ||
6 | import { PeertubePlayerManagerOptions } from '../../types/manager-options' | ||
7 | import { getRtcConfig } from '../common' | ||
4 | import { RedundancyUrlManager } from '../p2p-media-loader/redundancy-url-manager' | 8 | import { RedundancyUrlManager } from '../p2p-media-loader/redundancy-url-manager' |
5 | import { segmentUrlBuilderFactory } from '../p2p-media-loader/segment-url-builder' | 9 | import { segmentUrlBuilderFactory } from '../p2p-media-loader/segment-url-builder' |
6 | import { segmentValidatorFactory } from '../p2p-media-loader/segment-validator' | 10 | import { segmentValidatorFactory } from '../p2p-media-loader/segment-validator' |
7 | import { getAverageBandwidthInStore } from '../peertube-player-local-storage' | ||
8 | import { P2PMediaLoader, P2PMediaLoaderPluginOptions } from '../peertube-videojs-typings' | ||
9 | import { getRtcConfig } from '../utils' | ||
10 | import { PeertubePlayerManagerOptions } from './manager-options.model' | ||
11 | 11 | ||
12 | export class HLSOptionsBuilder { | 12 | export class HLSOptionsBuilder { |
13 | 13 | ||
diff --git a/client/src/assets/player/shared/manager-options/index.ts b/client/src/assets/player/shared/manager-options/index.ts new file mode 100644 index 000000000..4934d8302 --- /dev/null +++ b/client/src/assets/player/shared/manager-options/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './manager-options-builder' | |||
diff --git a/client/src/assets/player/manager-options/manager-options-builder.ts b/client/src/assets/player/shared/manager-options/manager-options-builder.ts index 14bdb5d96..5dab1f7a9 100644 --- a/client/src/assets/player/manager-options/manager-options-builder.ts +++ b/client/src/assets/player/shared/manager-options/manager-options-builder.ts | |||
@@ -1,12 +1,13 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { copyToClipboard } from '@root-helpers/utils' | ||
3 | import { buildVideoOrPlaylistEmbed } from '@root-helpers/video' | ||
4 | import { isIOS, isSafari } from '@root-helpers/web-browser' | ||
2 | import { buildVideoLink, decorateVideoLink } from '@shared/core-utils' | 5 | import { buildVideoLink, decorateVideoLink } from '@shared/core-utils' |
3 | import { isDefaultLocale } from '@shared/core-utils/i18n' | 6 | import { isDefaultLocale } from '@shared/core-utils/i18n' |
4 | import { copyToClipboard } from '../../../root-helpers/utils' | 7 | import { VideoJSPluginOptions } from '../../types' |
5 | import { VideoJSPluginOptions } from '../peertube-videojs-typings' | 8 | import { CommonOptions, PeertubePlayerManagerOptions, PlayerMode } from '../../types/manager-options' |
6 | import { buildVideoOrPlaylistEmbed, isIOS, isSafari } from '../utils' | ||
7 | import { ControlBarOptionsBuilder } from './control-bar-options-builder' | 9 | import { ControlBarOptionsBuilder } from './control-bar-options-builder' |
8 | import { HLSOptionsBuilder } from './hls-options-builder' | 10 | import { HLSOptionsBuilder } from './hls-options-builder' |
9 | import { CommonOptions, PeertubePlayerManagerOptions, PlayerMode } from './manager-options.model' | ||
10 | import { WebTorrentOptionsBuilder } from './webtorrent-options-builder' | 11 | import { WebTorrentOptionsBuilder } from './webtorrent-options-builder' |
11 | 12 | ||
12 | export class ManagerOptionsBuilder { | 13 | export class ManagerOptionsBuilder { |
diff --git a/client/src/assets/player/manager-options/webtorrent-options-builder.ts b/client/src/assets/player/shared/manager-options/webtorrent-options-builder.ts index 303940b29..257cf1e05 100644 --- a/client/src/assets/player/manager-options/webtorrent-options-builder.ts +++ b/client/src/assets/player/shared/manager-options/webtorrent-options-builder.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { PeertubePlayerManagerOptions } from './manager-options.model' | 1 | import { PeertubePlayerManagerOptions } from '../../types' |
2 | 2 | ||
3 | export class WebTorrentOptionsBuilder { | 3 | export class WebTorrentOptionsBuilder { |
4 | 4 | ||
diff --git a/client/src/assets/player/shared/mobile/index.ts b/client/src/assets/player/shared/mobile/index.ts new file mode 100644 index 000000000..6f42b8db7 --- /dev/null +++ b/client/src/assets/player/shared/mobile/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './peertube-mobile-buttons' | ||
2 | export * from './peertube-mobile-plugin' | ||
diff --git a/client/src/assets/player/mobile/peertube-mobile-buttons.ts b/client/src/assets/player/shared/mobile/peertube-mobile-buttons.ts index 09cb98f2e..09cb98f2e 100644 --- a/client/src/assets/player/mobile/peertube-mobile-buttons.ts +++ b/client/src/assets/player/shared/mobile/peertube-mobile-buttons.ts | |||
diff --git a/client/src/assets/player/mobile/peertube-mobile-plugin.ts b/client/src/assets/player/shared/mobile/peertube-mobile-plugin.ts index 91dda7f94..91dda7f94 100644 --- a/client/src/assets/player/mobile/peertube-mobile-plugin.ts +++ b/client/src/assets/player/shared/mobile/peertube-mobile-plugin.ts | |||
diff --git a/client/src/assets/player/p2p-media-loader/hls-plugin.ts b/client/src/assets/player/shared/p2p-media-loader/hls-plugin.ts index ccee2d90f..d0105fa36 100644 --- a/client/src/assets/player/p2p-media-loader/hls-plugin.ts +++ b/client/src/assets/player/shared/p2p-media-loader/hls-plugin.ts | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | import Hlsjs, { ErrorData, HlsConfig, Level, LevelSwitchingData, ManifestParsedData } from 'hls.js' | 4 | import Hlsjs, { ErrorData, HlsConfig, Level, LevelSwitchingData, ManifestParsedData } from 'hls.js' |
5 | import videojs from 'video.js' | 5 | import videojs from 'video.js' |
6 | import { HlsjsConfigHandlerOptions, PeerTubeResolution, VideoJSTechHLS } from '../peertube-videojs-typings' | 6 | import { HlsjsConfigHandlerOptions, PeerTubeResolution, VideoJSTechHLS } from '../../types' |
7 | 7 | ||
8 | type ErrorCounts = { | 8 | type ErrorCounts = { |
9 | [ type: string ]: number | 9 | [ type: string ]: number |
diff --git a/client/src/assets/player/shared/p2p-media-loader/index.ts b/client/src/assets/player/shared/p2p-media-loader/index.ts new file mode 100644 index 000000000..02fe71e73 --- /dev/null +++ b/client/src/assets/player/shared/p2p-media-loader/index.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export * from './hls-plugin' | ||
2 | export * from './p2p-media-loader-plugin' | ||
3 | export * from './redundancy-url-manager' | ||
4 | export * from './segment-url-builder' | ||
5 | export * from './segment-validator' | ||
diff --git a/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts b/client/src/assets/player/shared/p2p-media-loader/p2p-media-loader-plugin.ts index 1d7a39b4e..5c0f0021f 100644 --- a/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts +++ b/client/src/assets/player/shared/p2p-media-loader/p2p-media-loader-plugin.ts | |||
@@ -3,7 +3,7 @@ import videojs from 'video.js' | |||
3 | import { Events, Segment } from '@peertube/p2p-media-loader-core' | 3 | import { Events, Segment } from '@peertube/p2p-media-loader-core' |
4 | import { Engine, initHlsJsPlayer, initVideoJsContribHlsJsPlayer } from '@peertube/p2p-media-loader-hlsjs' | 4 | import { Engine, initHlsJsPlayer, initVideoJsContribHlsJsPlayer } from '@peertube/p2p-media-loader-hlsjs' |
5 | import { timeToInt } from '@shared/core-utils' | 5 | import { timeToInt } from '@shared/core-utils' |
6 | import { P2PMediaLoaderPluginOptions, PlayerNetworkInfo } from '../peertube-videojs-typings' | 6 | import { P2PMediaLoaderPluginOptions, PlayerNetworkInfo } from '../../types' |
7 | import { registerConfigPlugin, registerSourceHandler } from './hls-plugin' | 7 | import { registerConfigPlugin, registerSourceHandler } from './hls-plugin' |
8 | 8 | ||
9 | registerConfigPlugin(videojs) | 9 | registerConfigPlugin(videojs) |
diff --git a/client/src/assets/player/p2p-media-loader/redundancy-url-manager.ts b/client/src/assets/player/shared/p2p-media-loader/redundancy-url-manager.ts index abab8aa99..abab8aa99 100644 --- a/client/src/assets/player/p2p-media-loader/redundancy-url-manager.ts +++ b/client/src/assets/player/shared/p2p-media-loader/redundancy-url-manager.ts | |||
diff --git a/client/src/assets/player/p2p-media-loader/segment-url-builder.ts b/client/src/assets/player/shared/p2p-media-loader/segment-url-builder.ts index 9d324078a..9d324078a 100644 --- a/client/src/assets/player/p2p-media-loader/segment-url-builder.ts +++ b/client/src/assets/player/shared/p2p-media-loader/segment-url-builder.ts | |||
diff --git a/client/src/assets/player/p2p-media-loader/segment-validator.ts b/client/src/assets/player/shared/p2p-media-loader/segment-validator.ts index f7f83a8a4..f7f83a8a4 100644 --- a/client/src/assets/player/p2p-media-loader/segment-validator.ts +++ b/client/src/assets/player/shared/p2p-media-loader/segment-validator.ts | |||
diff --git a/client/src/assets/player/shared/peertube/index.ts b/client/src/assets/player/shared/peertube/index.ts new file mode 100644 index 000000000..ff4d5241b --- /dev/null +++ b/client/src/assets/player/shared/peertube/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './peertube-plugin' | |||
diff --git a/client/src/assets/player/peertube-plugin.ts b/client/src/assets/player/shared/peertube/peertube-plugin.ts index 4ffc9ce3e..1dc3e3de0 100644 --- a/client/src/assets/player/peertube-plugin.ts +++ b/client/src/assets/player/shared/peertube/peertube-plugin.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import debug from 'debug' | 1 | import debug from 'debug' |
2 | import videojs from 'video.js' | 2 | import videojs from 'video.js' |
3 | import { isMobile } from '@root-helpers/web-browser' | ||
3 | import { timeToInt } from '@shared/core-utils' | 4 | import { timeToInt } from '@shared/core-utils' |
4 | import { | 5 | import { |
5 | getStoredLastSubtitle, | 6 | getStoredLastSubtitle, |
@@ -9,10 +10,9 @@ import { | |||
9 | saveMuteInStore, | 10 | saveMuteInStore, |
10 | saveVideoWatchHistory, | 11 | saveVideoWatchHistory, |
11 | saveVolumeInStore | 12 | saveVolumeInStore |
12 | } from './peertube-player-local-storage' | 13 | } from '../../peertube-player-local-storage' |
13 | import { PeerTubePluginOptions, UserWatching, VideoJSCaption } from './peertube-videojs-typings' | 14 | import { PeerTubePluginOptions, UserWatching, VideoJSCaption } from '../../types' |
14 | import { SettingsButton } from './settings/settings-menu-button' | 15 | import { SettingsButton } from '../settings/settings-menu-button' |
15 | import { isMobile } from './utils' | ||
16 | 16 | ||
17 | const logger = debug('peertube:player:peertube') | 17 | const logger = debug('peertube:player:peertube') |
18 | 18 | ||
diff --git a/client/src/assets/player/shared/playlist/index.ts b/client/src/assets/player/shared/playlist/index.ts new file mode 100644 index 000000000..0be6e4d3c --- /dev/null +++ b/client/src/assets/player/shared/playlist/index.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export * from './playlist-button' | ||
2 | export * from './playlist-menu-item' | ||
3 | export * from './playlist-menu' | ||
4 | export * from './playlist-plugin' | ||
diff --git a/client/src/assets/player/playlist/playlist-button.ts b/client/src/assets/player/shared/playlist/playlist-button.ts index a7996ec60..6cfaf4158 100644 --- a/client/src/assets/player/playlist/playlist-button.ts +++ b/client/src/assets/player/shared/playlist/playlist-button.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { PlaylistPluginOptions } from '../peertube-videojs-typings' | 2 | import { PlaylistPluginOptions } from '../../types' |
3 | import { PlaylistMenu } from './playlist-menu' | 3 | import { PlaylistMenu } from './playlist-menu' |
4 | 4 | ||
5 | const ClickableComponent = videojs.getComponent('ClickableComponent') | 5 | const ClickableComponent = videojs.getComponent('ClickableComponent') |
diff --git a/client/src/assets/player/playlist/playlist-menu-item.ts b/client/src/assets/player/shared/playlist/playlist-menu-item.ts index 2519a34c7..81b5acf30 100644 --- a/client/src/assets/player/playlist/playlist-menu-item.ts +++ b/client/src/assets/player/shared/playlist/playlist-menu-item.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { secondsToTime } from '@shared/core-utils' | 2 | import { secondsToTime } from '@shared/core-utils' |
3 | import { VideoPlaylistElement } from '@shared/models' | 3 | import { VideoPlaylistElement } from '@shared/models' |
4 | import { PlaylistItemOptions } from '../peertube-videojs-typings' | 4 | import { PlaylistItemOptions } from '../../types' |
5 | 5 | ||
6 | const Component = videojs.getComponent('Component') | 6 | const Component = videojs.getComponent('Component') |
7 | 7 | ||
diff --git a/client/src/assets/player/playlist/playlist-menu.ts b/client/src/assets/player/shared/playlist/playlist-menu.ts index a2583047b..1ec9ac804 100644 --- a/client/src/assets/player/playlist/playlist-menu.ts +++ b/client/src/assets/player/shared/playlist/playlist-menu.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { VideoPlaylistElement } from '@shared/models' | 2 | import { VideoPlaylistElement } from '@shared/models' |
3 | import { PlaylistPluginOptions } from '../peertube-videojs-typings' | 3 | import { PlaylistPluginOptions } from '../../types' |
4 | import { PlaylistMenuItem } from './playlist-menu-item' | 4 | import { PlaylistMenuItem } from './playlist-menu-item' |
5 | 5 | ||
6 | const Component = videojs.getComponent('Component') | 6 | const Component = videojs.getComponent('Component') |
diff --git a/client/src/assets/player/playlist/playlist-plugin.ts b/client/src/assets/player/shared/playlist/playlist-plugin.ts index b69d82e3c..44de0da5a 100644 --- a/client/src/assets/player/playlist/playlist-plugin.ts +++ b/client/src/assets/player/shared/playlist/playlist-plugin.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { PlaylistPluginOptions } from '../peertube-videojs-typings' | 2 | import { PlaylistPluginOptions } from '../../types' |
3 | import { PlaylistButton } from './playlist-button' | 3 | import { PlaylistButton } from './playlist-button' |
4 | import { PlaylistMenu } from './playlist-menu' | 4 | import { PlaylistMenu } from './playlist-menu' |
5 | 5 | ||
@@ -20,7 +20,7 @@ class PlaylistPlugin extends Plugin { | |||
20 | }) | 20 | }) |
21 | 21 | ||
22 | this.playlistMenu = new PlaylistMenu(player, options) | 22 | this.playlistMenu = new PlaylistMenu(player, options) |
23 | this.playlistButton = new PlaylistButton(player, Object.assign({}, options, { playlistMenu: this.playlistMenu })) | 23 | this.playlistButton = new PlaylistButton(player, { ...options, playlistMenu: this.playlistMenu }) |
24 | 24 | ||
25 | player.addChild(this.playlistMenu, options) | 25 | player.addChild(this.playlistMenu, options) |
26 | player.addChild(this.playlistButton, options) | 26 | player.addChild(this.playlistButton, options) |
diff --git a/client/src/assets/player/shared/resolutions/index.ts b/client/src/assets/player/shared/resolutions/index.ts new file mode 100644 index 000000000..e56473f43 --- /dev/null +++ b/client/src/assets/player/shared/resolutions/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './peertube-resolutions-plugin' | |||
diff --git a/client/src/assets/player/peertube-resolutions-plugin.ts b/client/src/assets/player/shared/resolutions/peertube-resolutions-plugin.ts index cc36f18f3..e7899ac71 100644 --- a/client/src/assets/player/peertube-resolutions-plugin.ts +++ b/client/src/assets/player/shared/resolutions/peertube-resolutions-plugin.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { PeerTubeResolution } from './peertube-videojs-typings' | 2 | import { PeerTubeResolution } from '../../types' |
3 | 3 | ||
4 | const Plugin = videojs.getPlugin('plugin') | 4 | const Plugin = videojs.getPlugin('plugin') |
5 | 5 | ||
diff --git a/client/src/assets/player/shared/settings/index.ts b/client/src/assets/player/shared/settings/index.ts new file mode 100644 index 000000000..736d50c16 --- /dev/null +++ b/client/src/assets/player/shared/settings/index.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | export * from './resolution-menu-button' | ||
2 | export * from './resolution-menu-item' | ||
3 | export * from './settings-dialog' | ||
4 | export * from './settings-menu-button' | ||
5 | export * from './settings-menu-item' | ||
6 | export * from './settings-panel-child' | ||
7 | export * from './settings-panel' | ||
diff --git a/client/src/assets/player/settings/resolution-menu-button.ts b/client/src/assets/player/shared/settings/resolution-menu-button.ts index 8bd5b4f03..8bd5b4f03 100644 --- a/client/src/assets/player/settings/resolution-menu-button.ts +++ b/client/src/assets/player/shared/settings/resolution-menu-button.ts | |||
diff --git a/client/src/assets/player/settings/resolution-menu-item.ts b/client/src/assets/player/shared/settings/resolution-menu-item.ts index 6047f52f7..6047f52f7 100644 --- a/client/src/assets/player/settings/resolution-menu-item.ts +++ b/client/src/assets/player/shared/settings/resolution-menu-item.ts | |||
diff --git a/client/src/assets/player/settings/settings-dialog.ts b/client/src/assets/player/shared/settings/settings-dialog.ts index 8cd98967f..8cd98967f 100644 --- a/client/src/assets/player/settings/settings-dialog.ts +++ b/client/src/assets/player/shared/settings/settings-dialog.ts | |||
diff --git a/client/src/assets/player/settings/settings-menu-button.ts b/client/src/assets/player/shared/settings/settings-menu-button.ts index 6de390f4d..64866aab2 100644 --- a/client/src/assets/player/settings/settings-menu-button.ts +++ b/client/src/assets/player/shared/settings/settings-menu-button.ts | |||
@@ -1,9 +1,7 @@ | |||
1 | // Thanks to Yanko Shterev: https://github.com/yshterev/videojs-settings-menu | ||
2 | import { SettingsMenuItem } from './settings-menu-item' | ||
3 | import { toTitleCase } from '../utils' | ||
4 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
5 | 2 | import { toTitleCase } from '../common' | |
6 | import { SettingsDialog } from './settings-dialog' | 3 | import { SettingsDialog } from './settings-dialog' |
4 | import { SettingsMenuItem } from './settings-menu-item' | ||
7 | import { SettingsPanel } from './settings-panel' | 5 | import { SettingsPanel } from './settings-panel' |
8 | import { SettingsPanelChild } from './settings-panel-child' | 6 | import { SettingsPanelChild } from './settings-panel-child' |
9 | 7 | ||
diff --git a/client/src/assets/player/settings/settings-menu-item.ts b/client/src/assets/player/shared/settings/settings-menu-item.ts index 31d42c456..8d1819a2d 100644 --- a/client/src/assets/player/settings/settings-menu-item.ts +++ b/client/src/assets/player/shared/settings/settings-menu-item.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | // Thanks to Yanko Shterev: https://github.com/yshterev/videojs-settings-menu | 2 | import { toTitleCase } from '../common' |
3 | import { toTitleCase } from '../utils' | ||
4 | import { SettingsDialog } from './settings-dialog' | 3 | import { SettingsDialog } from './settings-dialog' |
5 | import { SettingsButton } from './settings-menu-button' | 4 | import { SettingsButton } from './settings-menu-button' |
6 | import { SettingsPanel } from './settings-panel' | 5 | import { SettingsPanel } from './settings-panel' |
diff --git a/client/src/assets/player/settings/settings-panel-child.ts b/client/src/assets/player/shared/settings/settings-panel-child.ts index 161420c38..161420c38 100644 --- a/client/src/assets/player/settings/settings-panel-child.ts +++ b/client/src/assets/player/shared/settings/settings-panel-child.ts | |||
diff --git a/client/src/assets/player/settings/settings-panel.ts b/client/src/assets/player/shared/settings/settings-panel.ts index 28b579bdd..28b579bdd 100644 --- a/client/src/assets/player/settings/settings-panel.ts +++ b/client/src/assets/player/shared/settings/settings-panel.ts | |||
diff --git a/client/src/assets/player/shared/stats/index.ts b/client/src/assets/player/shared/stats/index.ts new file mode 100644 index 000000000..017ec044c --- /dev/null +++ b/client/src/assets/player/shared/stats/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './stats-card' | ||
2 | export * from './stats-plugin' | ||
diff --git a/client/src/assets/player/stats/stats-card.ts b/client/src/assets/player/shared/stats/stats-card.ts index e76a81a74..1bf631d2c 100644 --- a/client/src/assets/player/stats/stats-card.ts +++ b/client/src/assets/player/shared/stats/stats-card.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { secondsToTime } from '@shared/core-utils' | 2 | import { secondsToTime } from '@shared/core-utils' |
3 | import { PlayerNetworkInfo as EventPlayerNetworkInfo } from '../peertube-videojs-typings' | 3 | import { PlayerNetworkInfo as EventPlayerNetworkInfo } from '../../types' |
4 | import { bytes } from '../utils' | 4 | import { bytes } from '../common' |
5 | 5 | ||
6 | interface StatsCardOptions extends videojs.ComponentOptions { | 6 | interface StatsCardOptions extends videojs.ComponentOptions { |
7 | videoUUID: string | 7 | videoUUID: string |
diff --git a/client/src/assets/player/stats/stats-plugin.ts b/client/src/assets/player/shared/stats/stats-plugin.ts index 8aad80e8a..8aad80e8a 100644 --- a/client/src/assets/player/stats/stats-plugin.ts +++ b/client/src/assets/player/shared/stats/stats-plugin.ts | |||
diff --git a/client/src/assets/player/upnext/end-card.ts b/client/src/assets/player/shared/upnext/end-card.ts index 61668e407..61668e407 100644 --- a/client/src/assets/player/upnext/end-card.ts +++ b/client/src/assets/player/shared/upnext/end-card.ts | |||
diff --git a/client/src/assets/player/shared/upnext/index.ts b/client/src/assets/player/shared/upnext/index.ts new file mode 100644 index 000000000..c63c5fd83 --- /dev/null +++ b/client/src/assets/player/shared/upnext/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './end-card' | ||
2 | export * from './upnext-plugin' | ||
diff --git a/client/src/assets/player/upnext/upnext-plugin.ts b/client/src/assets/player/shared/upnext/upnext-plugin.ts index db969024d..db969024d 100644 --- a/client/src/assets/player/upnext/upnext-plugin.ts +++ b/client/src/assets/player/shared/upnext/upnext-plugin.ts | |||
diff --git a/client/src/assets/player/webtorrent/peertube-chunk-store.ts b/client/src/assets/player/shared/webtorrent/peertube-chunk-store.ts index 81378c277..81378c277 100644 --- a/client/src/assets/player/webtorrent/peertube-chunk-store.ts +++ b/client/src/assets/player/shared/webtorrent/peertube-chunk-store.ts | |||
diff --git a/client/src/assets/player/webtorrent/video-renderer.ts b/client/src/assets/player/shared/webtorrent/video-renderer.ts index 9b80fea2c..9b80fea2c 100644 --- a/client/src/assets/player/webtorrent/video-renderer.ts +++ b/client/src/assets/player/shared/webtorrent/video-renderer.ts | |||
diff --git a/client/src/assets/player/webtorrent/webtorrent-plugin.ts b/client/src/assets/player/shared/webtorrent/webtorrent-plugin.ts index 4bcb2766a..b48203148 100644 --- a/client/src/assets/player/webtorrent/webtorrent-plugin.ts +++ b/client/src/assets/player/shared/webtorrent/webtorrent-plugin.ts | |||
@@ -1,10 +1,11 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import * as WebTorrent from 'webtorrent' | 2 | import * as WebTorrent from 'webtorrent' |
3 | import { isIOS } from '@root-helpers/web-browser' | ||
3 | import { timeToInt } from '@shared/core-utils' | 4 | import { timeToInt } from '@shared/core-utils' |
4 | import { VideoFile } from '@shared/models' | 5 | import { VideoFile } from '@shared/models' |
5 | import { getAverageBandwidthInStore, getStoredMute, getStoredVolume, saveAverageBandwidth } from '../peertube-player-local-storage' | 6 | import { getAverageBandwidthInStore, getStoredMute, getStoredVolume, saveAverageBandwidth } from '../../peertube-player-local-storage' |
6 | import { PeerTubeResolution, PlayerNetworkInfo, WebtorrentPluginOptions } from '../peertube-videojs-typings' | 7 | import { PeerTubeResolution, PlayerNetworkInfo, WebtorrentPluginOptions } from '../../types' |
7 | import { getRtcConfig, isIOS, videoFileMaxByResolution, videoFileMinByResolution } from '../utils' | 8 | import { getRtcConfig, videoFileMaxByResolution, videoFileMinByResolution } from '../common' |
8 | import { PeertubeChunkStore } from './peertube-chunk-store' | 9 | import { PeertubeChunkStore } from './peertube-chunk-store' |
9 | import { renderVideo } from './video-renderer' | 10 | import { renderVideo } from './video-renderer' |
10 | 11 | ||
diff --git a/client/src/assets/player/types/index.ts b/client/src/assets/player/types/index.ts new file mode 100644 index 000000000..b73e0b3cb --- /dev/null +++ b/client/src/assets/player/types/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './manager-options' | ||
2 | export * from './peertube-videojs-typings' | ||
diff --git a/client/src/assets/player/manager-options/manager-options.model.ts b/client/src/assets/player/types/manager-options.ts index 0b0f8b435..b3ad7e337 100644 --- a/client/src/assets/player/manager-options/manager-options.model.ts +++ b/client/src/assets/player/types/manager-options.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { PluginsManager } from '@root-helpers/plugins-manager' | 1 | import { PluginsManager } from '@root-helpers/plugins-manager' |
2 | import { LiveVideoLatencyMode, VideoFile } from '@shared/models' | 2 | import { LiveVideoLatencyMode, VideoFile } from '@shared/models' |
3 | import { PlaylistPluginOptions, UserWatching, VideoJSCaption } from '../peertube-videojs-typings' | 3 | import { PlaylistPluginOptions, UserWatching, VideoJSCaption } from './peertube-videojs-typings' |
4 | 4 | ||
5 | export type PlayerMode = 'webtorrent' | 'p2p-media-loader' | 5 | export type PlayerMode = 'webtorrent' | 'p2p-media-loader' |
6 | 6 | ||
diff --git a/client/src/assets/player/peertube-videojs-typings.ts b/client/src/assets/player/types/peertube-videojs-typings.ts index fcaa8a9c3..d9a388681 100644 --- a/client/src/assets/player/peertube-videojs-typings.ts +++ b/client/src/assets/player/types/peertube-videojs-typings.ts | |||
@@ -2,18 +2,18 @@ import { HlsConfig, Level } from 'hls.js' | |||
2 | import videojs from 'video.js' | 2 | import videojs from 'video.js' |
3 | import { Engine } from '@peertube/p2p-media-loader-hlsjs' | 3 | import { Engine } from '@peertube/p2p-media-loader-hlsjs' |
4 | import { VideoFile, VideoPlaylist, VideoPlaylistElement } from '@shared/models' | 4 | import { VideoFile, VideoPlaylist, VideoPlaylistElement } from '@shared/models' |
5 | import { PeerTubeDockPluginOptions } from './dock/peertube-dock-plugin' | 5 | import { PeerTubeDockPluginOptions } from '../shared/dock/peertube-dock-plugin' |
6 | import { PlayerMode } from './manager-options/manager-options.model' | 6 | import { Html5Hlsjs } from '../shared/p2p-media-loader/hls-plugin' |
7 | import { Html5Hlsjs } from './p2p-media-loader/hls-plugin' | 7 | import { P2pMediaLoaderPlugin } from '../shared/p2p-media-loader/p2p-media-loader-plugin' |
8 | import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin' | 8 | import { RedundancyUrlManager } from '../shared/p2p-media-loader/redundancy-url-manager' |
9 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' | 9 | import { PeerTubePlugin } from '../shared/peertube/peertube-plugin' |
10 | import { PeerTubePlugin } from './peertube-plugin' | 10 | import { PlaylistPlugin } from '../shared/playlist/playlist-plugin' |
11 | import { PeerTubeResolutionsPlugin } from './peertube-resolutions-plugin' | 11 | import { PeerTubeResolutionsPlugin } from '../shared/resolutions/peertube-resolutions-plugin' |
12 | import { PlaylistPlugin } from './playlist/playlist-plugin' | 12 | import { StatsCardOptions } from '../shared/stats/stats-card' |
13 | import { StatsCardOptions } from './stats/stats-card' | 13 | import { StatsForNerdsPlugin } from '../shared/stats/stats-plugin' |
14 | import { StatsForNerdsPlugin } from './stats/stats-plugin' | 14 | import { EndCardOptions } from '../shared/upnext/end-card' |
15 | import { EndCardOptions } from './upnext/end-card' | 15 | import { WebTorrentPlugin } from '../shared/webtorrent/webtorrent-plugin' |
16 | import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin' | 16 | import { PlayerMode } from './manager-options' |
17 | 17 | ||
18 | declare module 'video.js' { | 18 | declare module 'video.js' { |
19 | 19 | ||