diff options
Diffstat (limited to 'client/src/assets/player/videojs-components')
6 files changed, 18 insertions, 27 deletions
diff --git a/client/src/assets/player/videojs-components/p2p-info-button.ts b/client/src/assets/player/videojs-components/p2p-info-button.ts index 81f9544f4..07ed18989 100644 --- a/client/src/assets/player/videojs-components/p2p-info-button.ts +++ b/client/src/assets/player/videojs-components/p2p-info-button.ts | |||
@@ -96,11 +96,11 @@ class P2pInfoButton extends Button { | |||
96 | } | 96 | } |
97 | subDivWebtorrent.title += this.player().localize('Total uploaded: ') + totalUploaded.join(' ') | 97 | subDivWebtorrent.title += this.player().localize('Total uploaded: ') + totalUploaded.join(' ') |
98 | 98 | ||
99 | downloadSpeedNumber.textContent = downloadSpeed[ 0 ] | 99 | downloadSpeedNumber.textContent = downloadSpeed[0] |
100 | downloadSpeedUnit.textContent = ' ' + downloadSpeed[ 1 ] | 100 | downloadSpeedUnit.textContent = ' ' + downloadSpeed[1] |
101 | 101 | ||
102 | uploadSpeedNumber.textContent = uploadSpeed[ 0 ] | 102 | uploadSpeedNumber.textContent = uploadSpeed[0] |
103 | uploadSpeedUnit.textContent = ' ' + uploadSpeed[ 1 ] | 103 | uploadSpeedUnit.textContent = ' ' + uploadSpeed[1] |
104 | 104 | ||
105 | peersNumber.textContent = numPeers.toString() | 105 | peersNumber.textContent = numPeers.toString() |
106 | peersText.textContent = ' ' + (numPeers > 1 ? this.player().localize('peers') : this.player_.localize('peer')) | 106 | peersText.textContent = ' ' + (numPeers > 1 ? this.player().localize('peers') : this.player_.localize('peer')) |
diff --git a/client/src/assets/player/videojs-components/resolution-menu-item.ts b/client/src/assets/player/videojs-components/resolution-menu-item.ts index 73ad47d2b..c1f502600 100644 --- a/client/src/assets/player/videojs-components/resolution-menu-item.ts +++ b/client/src/assets/player/videojs-components/resolution-menu-item.ts | |||
@@ -6,7 +6,7 @@ const MenuItem = videojs.getComponent('MenuItem') | |||
6 | export interface ResolutionMenuItemOptions extends videojs.MenuItemOptions { | 6 | export interface ResolutionMenuItemOptions extends videojs.MenuItemOptions { |
7 | labels?: { [id: number]: string } | 7 | labels?: { [id: number]: string } |
8 | id: number | 8 | id: number |
9 | callback: Function | 9 | callback: (resolutionId: number, type: 'video') => void |
10 | } | 10 | } |
11 | 11 | ||
12 | class ResolutionMenuItem extends MenuItem { | 12 | class ResolutionMenuItem extends MenuItem { |
@@ -14,7 +14,7 @@ class ResolutionMenuItem extends MenuItem { | |||
14 | private readonly label: string | 14 | private readonly label: string |
15 | // Only used for the automatic item | 15 | // Only used for the automatic item |
16 | private readonly labels: { [id: number]: string } | 16 | private readonly labels: { [id: number]: string } |
17 | private readonly callback: Function | 17 | private readonly callback: (resolutionId: number, type: 'video') => void |
18 | 18 | ||
19 | private autoResolutionPossible: boolean | 19 | private autoResolutionPossible: boolean |
20 | private currentResolutionLabel: string | 20 | private currentResolutionLabel: string |
diff --git a/client/src/assets/player/videojs-components/settings-dialog.ts b/client/src/assets/player/videojs-components/settings-dialog.ts index 41911e7e8..8cd98967f 100644 --- a/client/src/assets/player/videojs-components/settings-dialog.ts +++ b/client/src/assets/player/videojs-components/settings-dialog.ts | |||
@@ -12,8 +12,6 @@ class SettingsDialog extends Component { | |||
12 | /** | 12 | /** |
13 | * Create the component's DOM element | 13 | * Create the component's DOM element |
14 | * | 14 | * |
15 | * @return {Element} | ||
16 | * @method createEl | ||
17 | */ | 15 | */ |
18 | createEl () { | 16 | createEl () { |
19 | const uniqueId = this.id() | 17 | const uniqueId = this.id() |
@@ -25,7 +23,7 @@ class SettingsDialog extends Component { | |||
25 | innerHTML: '', | 23 | innerHTML: '', |
26 | tabIndex: -1 | 24 | tabIndex: -1 |
27 | }, { | 25 | }, { |
28 | 'role': 'dialog', | 26 | role: 'dialog', |
29 | 'aria-labelledby': dialogLabelId, | 27 | 'aria-labelledby': dialogLabelId, |
30 | 'aria-describedby': dialogDescriptionId | 28 | 'aria-describedby': dialogDescriptionId |
31 | }) | 29 | }) |
diff --git a/client/src/assets/player/videojs-components/settings-menu-item.ts b/client/src/assets/player/videojs-components/settings-menu-item.ts index f1342f179..1871d41f8 100644 --- a/client/src/assets/player/videojs-components/settings-menu-item.ts +++ b/client/src/assets/player/videojs-components/settings-menu-item.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import videojs from 'video.js' | ||
1 | // Thanks to Yanko Shterev: https://github.com/yshterev/videojs-settings-menu | 2 | // Thanks to Yanko Shterev: https://github.com/yshterev/videojs-settings-menu |
2 | import { toTitleCase } from '../utils' | 3 | import { toTitleCase } from '../utils' |
3 | import videojs from 'video.js' | ||
4 | import { SettingsButton } from './settings-menu-button' | ||
5 | import { SettingsDialog } from './settings-dialog' | 4 | import { SettingsDialog } from './settings-dialog' |
5 | import { SettingsButton } from './settings-menu-button' | ||
6 | import { SettingsPanel } from './settings-panel' | 6 | import { SettingsPanel } from './settings-panel' |
7 | import { SettingsPanelChild } from './settings-panel-child' | 7 | import { SettingsPanelChild } from './settings-panel-child' |
8 | 8 | ||
@@ -57,7 +57,7 @@ class SettingsMenuItem extends MenuItem { | |||
57 | const newOptions = Object.assign({}, options, { entry: options.menuButton, menuButton: this }) | 57 | const newOptions = Object.assign({}, options, { entry: options.menuButton, menuButton: this }) |
58 | 58 | ||
59 | this.subMenu = new SubMenuComponent(this.player(), newOptions) as any // FIXME: typings | 59 | this.subMenu = new SubMenuComponent(this.player(), newOptions) as any // FIXME: typings |
60 | const subMenuClass = this.subMenu.buildCSSClass().split(' ')[ 0 ] | 60 | const subMenuClass = this.subMenu.buildCSSClass().split(' ')[0] |
61 | this.settingsSubMenuEl_.className += ' ' + subMenuClass | 61 | this.settingsSubMenuEl_.className += ' ' + subMenuClass |
62 | 62 | ||
63 | this.eventHandlers() | 63 | this.eventHandlers() |
@@ -104,7 +104,7 @@ class SettingsMenuItem extends MenuItem { | |||
104 | target = event.currentTarget | 104 | target = event.currentTarget |
105 | } | 105 | } |
106 | 106 | ||
107 | if (target && target.classList.contains('vjs-back-button')) { | 107 | if (target?.classList.contains('vjs-back-button')) { |
108 | this.loadMainMenu() | 108 | this.loadMainMenu() |
109 | return | 109 | return |
110 | } | 110 | } |
@@ -121,8 +121,6 @@ class SettingsMenuItem extends MenuItem { | |||
121 | /** | 121 | /** |
122 | * Create the component's DOM element | 122 | * Create the component's DOM element |
123 | * | 123 | * |
124 | * @return {Element} | ||
125 | * @method createEl | ||
126 | */ | 124 | */ |
127 | createEl () { | 125 | createEl () { |
128 | const el = videojs.dom.createEl('li', { | 126 | const el = videojs.dom.createEl('li', { |
@@ -198,14 +196,14 @@ class SettingsMenuItem extends MenuItem { | |||
198 | const prefix = [ 'webkit', 'moz', 'MS', 'o', '' ] | 196 | const prefix = [ 'webkit', 'moz', 'MS', 'o', '' ] |
199 | 197 | ||
200 | for (let p = 0; p < prefix.length; p++) { | 198 | for (let p = 0; p < prefix.length; p++) { |
201 | if (!prefix[ p ]) { | 199 | if (!prefix[p]) { |
202 | type = type.toLowerCase() | 200 | type = type.toLowerCase() |
203 | } | 201 | } |
204 | 202 | ||
205 | if (action === 'addEvent') { | 203 | if (action === 'addEvent') { |
206 | element.addEventListener(prefix[ p ] + type, callback, false) | 204 | element.addEventListener(prefix[p] + type, callback, false) |
207 | } else if (action === 'removeEvent') { | 205 | } else if (action === 'removeEvent') { |
208 | element.removeEventListener(prefix[ p ] + type, callback, false) | 206 | element.removeEventListener(prefix[p] + type, callback, false) |
209 | } | 207 | } |
210 | } | 208 | } |
211 | } | 209 | } |
@@ -292,7 +290,10 @@ class SettingsMenuItem extends MenuItem { | |||
292 | // Thus we get the submenu value based on the labelEl of playbackRateMenuButton | 290 | // Thus we get the submenu value based on the labelEl of playbackRateMenuButton |
293 | if (subMenu === 'PlaybackRateMenuButton') { | 291 | if (subMenu === 'PlaybackRateMenuButton') { |
294 | const html = (this.subMenu as any).labelEl_.innerHTML | 292 | const html = (this.subMenu as any).labelEl_.innerHTML |
295 | setTimeout(() => this.settingsSubMenuValueEl_.innerHTML = html, 250) | 293 | |
294 | setTimeout(() => { | ||
295 | this.settingsSubMenuValueEl_.innerHTML = html | ||
296 | }, 250) | ||
296 | } else { | 297 | } else { |
297 | // Loop trough the submenu items to find the selected child | 298 | // Loop trough the submenu items to find the selected child |
298 | for (const subMenuItem of this.subMenu.menu.children_) { | 299 | for (const subMenuItem of this.subMenu.menu.children_) { |
diff --git a/client/src/assets/player/videojs-components/settings-panel-child.ts b/client/src/assets/player/videojs-components/settings-panel-child.ts index d1582412c..161420c38 100644 --- a/client/src/assets/player/videojs-components/settings-panel-child.ts +++ b/client/src/assets/player/videojs-components/settings-panel-child.ts | |||
@@ -4,10 +4,6 @@ const Component = videojs.getComponent('Component') | |||
4 | 4 | ||
5 | class SettingsPanelChild extends Component { | 5 | class SettingsPanelChild extends Component { |
6 | 6 | ||
7 | constructor (player: videojs.Player, options?: videojs.ComponentOptions) { | ||
8 | super(player, options) | ||
9 | } | ||
10 | |||
11 | createEl () { | 7 | createEl () { |
12 | return super.createEl('div', { | 8 | return super.createEl('div', { |
13 | className: 'vjs-settings-panel-child', | 9 | className: 'vjs-settings-panel-child', |
diff --git a/client/src/assets/player/videojs-components/settings-panel.ts b/client/src/assets/player/videojs-components/settings-panel.ts index 1ad8bb1fc..28b579bdd 100644 --- a/client/src/assets/player/videojs-components/settings-panel.ts +++ b/client/src/assets/player/videojs-components/settings-panel.ts | |||
@@ -4,10 +4,6 @@ const Component = videojs.getComponent('Component') | |||
4 | 4 | ||
5 | class SettingsPanel extends Component { | 5 | class SettingsPanel extends Component { |
6 | 6 | ||
7 | constructor (player: videojs.Player, options?: videojs.ComponentOptions) { | ||
8 | super(player, options) | ||
9 | } | ||
10 | |||
11 | createEl () { | 7 | createEl () { |
12 | return super.createEl('div', { | 8 | return super.createEl('div', { |
13 | className: 'vjs-settings-panel', | 9 | className: 'vjs-settings-panel', |