@24i/bigscreen-sdk 1.0.54-alpha.2836 → 2.1.1-alpha.2133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/package.json +34 -53
- package/packages/adobe-heartbeat/src/AdobeHeartbeat.ts +9 -9
- package/packages/async-image/src/AsyncImage.tsx +10 -15
- package/packages/developer-tools/PlayerDebugWindow/README.md +1 -1
- package/packages/developer-tools/src/DeveloperToolsService/DeveloperToolsList.tsx +0 -11
- package/packages/developer-tools/src/PlayerDebugWindow/PlayerDebugWindow.tsx +5 -5
- package/packages/developer-tools/src/PlayerDebugWindow/constants.ts +0 -15
- package/packages/developer-tools/src/TechnicalInfo/TechnicalInfoDetail.tsx +1 -2
- package/packages/developer-tools/src/TechnicalInfo/TechnicalInfoProvider.ts +5 -57
- package/packages/developer-tools/src/TechnicalInfo/__mocks__/Device.ts +0 -12
- package/packages/developer-tools/src/TechnicalInfo/translations.ts +0 -8
- package/packages/device/src/getKeyDigit.ts +2 -2
- package/packages/device/src/resolver/resolver.ts +5 -18
- package/packages/digital-clock/src/DigitalClock.tsx +4 -15
- package/packages/driver-androidtv/src/DeviceAndroidTV.ts +9 -92
- package/packages/driver-androidtv/src/__mocks__/javaScriptBridge.ts +5 -38
- package/packages/driver-androidtv/src/index.ts +0 -1
- package/packages/driver-androidtv/src/keymap.ts +0 -18
- package/packages/driver-androidtv/src/types.ts +16 -144
- package/packages/driver-base/src/DeviceBase.ts +2 -80
- package/packages/driver-base/src/KeyMap/Key.ts +1 -8
- package/packages/driver-base/src/KeyMap/KeyMap.ts +0 -4
- package/packages/driver-base/src/KeyMap/interface.ts +0 -1
- package/packages/driver-base/src/KeyMap/overrideValues.ts +1 -2
- package/packages/driver-base/src/__mocks__/DeviceBase.ts +0 -24
- package/packages/driver-base/src/__mocks__/keyMap.ts +0 -1
- package/packages/driver-base/src/index.ts +0 -3
- package/packages/driver-base/src/types/DeviceEvent.ts +0 -2
- package/packages/driver-base/src/types/KeycodeKeyMap.ts +0 -1
- package/packages/driver-browser/src/DeviceBrowser.ts +0 -26
- package/packages/driver-browser/src/keymap.ts +0 -8
- package/packages/driver-entone/src/DeviceEntone.ts +1 -31
- package/packages/driver-entone/src/keymap.ts +0 -1
- package/packages/driver-hbbtv/src/DeviceHbbTV.ts +0 -26
- package/packages/driver-kreatv/src/DeviceKreaTV.ts +0 -26
- package/packages/driver-saphi/src/DeviceSaphi.ts +0 -26
- package/packages/driver-tizen/src/DeviceTizen.ts +7 -126
- package/packages/driver-tizen/src/ITizen.ts +202 -15116
- package/packages/driver-tizen/src/IWebapis.ts +87 -8643
- package/packages/driver-tizen/src/TizenKeys.ts +2 -4
- package/packages/driver-tizen/src/__mocks__/tizen.ts +8 -7
- package/packages/driver-tizen/src/constants.ts +195 -1
- package/packages/driver-tizen/src/types.ts +14 -0
- package/packages/driver-vidaa/src/DeviceVidaa.ts +2 -29
- package/packages/driver-vidaa/src/__mocks__/vidaa.ts +1 -1
- package/packages/driver-vidaa/src/keymap.ts +0 -2
- package/packages/driver-webos/src/DeviceWebos.ts +0 -55
- package/packages/driver-webos/src/__mocks__/webos.ts +0 -33
- package/packages/driver-webos/src/constants.ts +0 -1
- package/packages/driver-webos/src/keymap.ts +1 -2
- package/packages/driver-webos/src/types.ts +0 -30
- package/packages/driver-xbox/src/DeviceXbox.ts +1 -30
- package/packages/driver-xbox/src/keymap.ts +1 -1
- package/packages/epg/README.md +1 -3
- package/packages/epg/src/v2/Cell.tsx +2 -16
- package/packages/epg/src/v2/DataManager.ts +41 -112
- package/packages/epg/src/v2/DatePicker.tsx +3 -9
- package/packages/epg/src/v2/DateToast/DateToast.tsx +9 -12
- package/packages/epg/src/v2/Day.tsx +3 -6
- package/packages/epg/src/v2/Epg.tsx +5 -5
- package/packages/epg/src/v2/MockGenerator/generator.ts +2 -3
- package/packages/epg/src/v2/ProgramInfo/utils.ts +3 -4
- package/packages/epg/src/v2/Row.tsx +1 -3
- package/packages/epg/src/v2/TimelineSection.tsx +1 -4
- package/packages/epg/src/v2/basic/CellsManager.tsx +2 -7
- package/packages/epg/src/v2/basic/RowsManager.tsx +1 -3
- package/packages/epg/src/v2/interface.ts +0 -13
- package/packages/events-manager/src/EventsManager.ts +56 -1
- package/packages/focus/README.md +0 -33
- package/packages/focus/src/IFocusable.ts +0 -1
- package/packages/focus/src/Layout/Base.tsx +6 -41
- package/packages/focus/src/Layout/Matrix.tsx +19 -51
- package/packages/focus/src/Layout/__test__/Base.spec.ts +180 -0
- package/packages/focus/src/Layout/__test__/Horizontal.spec.ts +94 -0
- package/packages/focus/src/Layout/__test__/Matrix.spec.ts +261 -0
- package/packages/focus/src/Layout/__test__/Vertical.spec.ts +46 -0
- package/packages/focus/src/Layout/__test__/isRtl.spec.ts +23 -0
- package/packages/focus/src/Layout/__test__/shared.ts +19 -0
- package/packages/focus/src/focusFirstExisting.ts +1 -7
- package/packages/focus/src/index.ts +1 -2
- package/packages/gallup/src/Gallup.ts +3 -3
- package/packages/grid/src/Base/Base.tsx +10 -15
- package/packages/grid/src/FirstOnlyGrid/FirstOnlyGrid.tsx +2 -4
- package/packages/grid/src/UnifiedGridController/UnifiedGridController.ts +6 -6
- package/packages/icon/src/Icon.tsx +5 -27
- package/packages/input/README.md +1 -1
- package/packages/input/src/Input.tsx +10 -16
- package/packages/interactable/README.md +1 -2
- package/packages/interactable/src/Interactable.tsx +3 -9
- package/packages/interactable/src/interface.ts +0 -1
- package/packages/jsx/src/index.ts +1 -1
- package/packages/jsx/src/test-utils/index.ts +0 -1
- package/packages/keyboard/src/Backdrop/Backdrop.scss +0 -2
- package/packages/keyboard/src/KeyboardBase.tsx +4 -16
- package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.scss +0 -4
- package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.tsx +20 -28
- package/packages/keyboard/src/WhitelabelKeyboard/_sizes.1080.scss +0 -1
- package/packages/keyboard/src/WhitelabelKeyboard/_sizes.scss +0 -1
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/index.ts +0 -12
- package/packages/keyboard/src/WhitelabelKeyboard/types.ts +0 -1
- package/packages/keyboard/src/utils/caret.ts +8 -5
- package/packages/keyboard/src/utils/input.ts +6 -5
- package/packages/l10n/README.md +0 -18
- package/packages/l10n/src/date/common.ts +6 -18
- package/packages/l10n/src/date/cs.ts +8 -2
- package/packages/l10n/src/date/en-001.ts +3 -3
- package/packages/l10n/src/date/en-common.ts +4 -5
- package/packages/l10n/src/date/en-us.ts +3 -3
- package/packages/l10n/src/date/iso.ts +13 -12
- package/packages/l10n/src/date/types.ts +0 -9
- package/packages/l10n/src/l10n.ts +3 -61
- package/packages/list/src/Base/Base.tsx +9 -19
- package/packages/list/src/Base/interface.ts +2 -2
- package/packages/list/src/BasicList/BasicList.tsx +7 -7
- package/packages/list/src/CenteredList/CenteredList.tsx +2 -2
- package/packages/list/src/CenteredList/controller.ts +1 -0
- package/packages/list/src/EdgeOffsetList/EdgeOffsetList.tsx +10 -10
- package/packages/list/src/FirstOnlyList/FirstOnlyList.tsx +2 -2
- package/packages/list/src/FirstOnlyVariedList/FirstOnlyVariedList.tsx +2 -2
- package/packages/list/src/FixedToEndList/FixedToEndList.tsx +2 -2
- package/packages/list/src/UnifiedListController/UnifiedListController.ts +2 -6
- package/packages/list/src/interface.ts +2 -2
- package/packages/logger/src/loggers/ConsoleLogger/ConsoleLogger.ts +1 -7
- package/packages/logger/src/loggers/SentryLogger/Sentry.ts +0 -1
- package/packages/logger/src/loggers/SentryLogger/SentryLogger.ts +3 -5
- package/packages/menu/src/MenuAndContentContainer/MenuAndContentContainer.tsx +3 -31
- package/packages/menu/src/MenuAndContentContainer/interface.ts +0 -8
- package/packages/modal-service/README.md +1 -4
- package/packages/modal-service/src/ModalService.tsx +5 -29
- package/packages/perf-utils/README.md +120 -1
- package/packages/perf-utils/src/array/filter.ts +54 -1
- package/packages/perf-utils/src/array/find.ts +43 -1
- package/packages/perf-utils/src/array/findIndex.ts +43 -1
- package/packages/perf-utils/src/array/forEach.ts +48 -1
- package/packages/perf-utils/src/array/includes.ts +41 -1
- package/packages/perf-utils/src/array/includesNaN.ts +32 -1
- package/packages/perf-utils/src/array/index.ts +7 -1
- package/packages/perf-utils/src/array/map.ts +52 -1
- package/packages/player-ui/README.md +1 -1
- package/packages/player-ui/src/CurrentTime.tsx +2 -2
- package/packages/player-ui/src/Duration.tsx +2 -2
- package/packages/player-ui/src/PauseButton.tsx +0 -8
- package/packages/player-ui/src/PlayerInteractable.tsx +0 -1
- package/packages/player-ui/src/PlayerTime.tsx +1 -3
- package/packages/player-ui/src/PlayerUI.tsx +35 -68
- package/packages/player-ui/src/RemainingTime.tsx +2 -2
- package/packages/player-ui/src/Seekbar.tsx +18 -110
- package/packages/player-ui/src/Seeking.ts +16 -57
- package/packages/player-ui/src/Subtitles.tsx +2 -2
- package/packages/player-ui/src/index.ts +0 -1
- package/packages/player-ui/src/mocks.ts +8 -32
- package/packages/player-ui/src/timeUtils.ts +3 -3
- package/packages/player-ui/src/types.ts +3 -9
- package/packages/router/README.md +0 -1
- package/packages/router/src/Route.tsx +27 -61
- package/packages/router/src/Router.tsx +14 -63
- package/packages/router/src/history.ts +1 -8
- package/packages/router/src/index.ts +1 -1
- package/packages/router/src/utils.ts +4 -9
- package/packages/sass-utils/src/linear-gradient.scss +4 -9
- package/packages/sass-utils/src/scale.1080.scss +1 -3
- package/packages/sass-utils/src/scale.720.scss +1 -1
- package/packages/time/README.md +1 -4
- package/packages/time/src/Time.ts +13 -35
- package/packages/time/src/constants.ts +0 -1
- package/packages/toast/src/ToastService.tsx +5 -16
- package/packages/types-bigscreen-jsx/README.md +4 -5
- package/packages/types-bigscreen-jsx/index.d.ts +67 -72
- package/packages/utils/README.md +0 -27
- package/packages/utils/src/elementUtils.ts +0 -25
- package/packages/utils/src/index.ts +0 -8
- package/packages/utils/src/scaledImage.ts +3 -6
- package/packages/utils/src/textUtils.ts +14 -46
- package/packages/utils/src/wait.ts +1 -3
- package/packages/utils/src/xhr/xhrSend.ts +1 -3
- package/packages/utils/src/xhr/xhrSendRetry.ts +1 -3
- package/packages/zapping/src/ChannelZapping.ts +0 -9
- package/packages/zapping/src/Zapping.tsx +0 -10
- package/ci/is_ci_job_skippable.sh +0 -153
- package/packages/analytics/README.md +0 -8
- package/packages/analytics/src/A.ts +0 -1
- package/packages/analytics/src/Analytics.ts +0 -1
- package/packages/analytics/src/analyticsOnScroll.ts +0 -1
- package/packages/analytics/src/clients/ConsoleAnalytics/ConsoleAnalytics.ts +0 -1
- package/packages/analytics/src/clients/ConsoleAnalytics/index.ts +0 -1
- package/packages/analytics/src/clients/GoogleAnalytics/GoogleAnalytics.ts +0 -196
- package/packages/analytics/src/clients/GoogleAnalytics/constants.ts +0 -126
- package/packages/analytics/src/clients/GoogleAnalytics/getUrl.ts +0 -17
- package/packages/analytics/src/clients/GoogleAnalytics/index.ts +0 -2
- package/packages/analytics/src/clients/GoogleAnalytics/interface.ts +0 -82
- package/packages/analytics/src/clients/GoogleAnalytics/mapPayload.ts +0 -51
- package/packages/analytics/src/clients/GoogleAnalytics/prepareBody.ts +0 -14
- package/packages/analytics/src/clients/TealiumAnalytics/TealiumAnalytics.ts +0 -181
- package/packages/analytics/src/clients/TealiumAnalytics/constants.ts +0 -106
- package/packages/analytics/src/clients/TealiumAnalytics/findForLanguage.ts +0 -9
- package/packages/analytics/src/clients/TealiumAnalytics/index.ts +0 -4
- package/packages/analytics/src/clients/TealiumAnalytics/interface.ts +0 -35
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/__mocks__/mediaPayload.ts +0 -72
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/helper.ts +0 -36
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapAppError.ts +0 -13
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapAppOpen.ts +0 -13
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapFavoriteAdd.ts +0 -11
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapFavoriteRemove.ts +0 -11
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapPlayerClose.ts +0 -15
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapPlayerOpen.ts +0 -15
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSceneView.ts +0 -18
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearch.ts +0 -18
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearchFailed.ts +0 -8
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearchSuccess.ts +0 -8
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoPause.ts +0 -15
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoProgress.ts +0 -18
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoResume.ts +0 -15
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoStart.ts +0 -15
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoStop.ts +0 -15
- package/packages/analytics/src/clients/TealiumAnalytics/types.ts +0 -161
- package/packages/analytics/src/clients/TwentyFourIQ/TwentyFourIQClient.ts +0 -107
- package/packages/analytics/src/clients/TwentyFourIQ/constants.ts +0 -111
- package/packages/analytics/src/clients/TwentyFourIQ/helper.ts +0 -34
- package/packages/analytics/src/clients/TwentyFourIQ/index.ts +0 -2
- package/packages/analytics/src/clients/TwentyFourIQ/interface.ts +0 -34
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapAdEvent.ts +0 -20
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBase.ts +0 -24
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBuffering.ts +0 -15
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerClose.ts +0 -25
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerOpen.ts +0 -17
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapSceneView.ts +0 -15
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapScroll.ts +0 -17
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoComplete.ts +0 -22
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoPause.ts +0 -25
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoProgress.ts +0 -25
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoStart.ts +0 -34
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoStop.ts +0 -32
- package/packages/analytics/src/clients/TwentyFourIQ/types.ts +0 -132
- package/packages/analytics/src/constants.ts +0 -1
- package/packages/analytics/src/index.ts +0 -3
- package/packages/analytics/src/interface.ts +0 -1
- package/packages/analytics/src/utils/generateSessionId.ts +0 -8
- package/packages/device/src/driver/index.firetv.ts +0 -1
- package/packages/device/src/driver/index.smartcast.tv.ts +0 -1
- package/packages/driver-base/src/types/AdInfo.ts +0 -5
- package/packages/driver-base/src/types/InAppPurchase.ts +0 -25
- package/packages/driver-firetv/src/DeviceFireTV.ts +0 -91
- package/packages/driver-firetv/src/__mocks__/javaScriptBridge.ts +0 -45
- package/packages/driver-firetv/src/index.ts +0 -1
- package/packages/driver-firetv/src/types.ts +0 -1
- package/packages/driver-smartcast/src/DeviceSmartCast.ts +0 -394
- package/packages/driver-smartcast/src/__mocks__/api.ts +0 -79
- package/packages/driver-smartcast/src/index.ts +0 -1
- package/packages/driver-smartcast/src/keymap.ts +0 -9
- package/packages/driver-smartcast/src/types.ts +0 -111
- package/packages/focus/src/hasFocus.ts +0 -36
- package/packages/jsx/src/test-utils/keyup.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/arabic.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/burmese.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/dari.ts +0 -28
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/korean.ts +0 -26
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/pashto.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/persian.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/russian.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/spanish.ts +0 -26
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/tibetan.ts +0 -26
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/turkish.ts +0 -26
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/ukrainian.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/urdu.ts +0 -26
- package/packages/keyboard/src/utils/setInputSelectionRange.ts +0 -10
- package/packages/l10n/src/date/de.ts +0 -97
- package/packages/l10n/src/date/es.ts +0 -71
- package/packages/l10n/src/date/fr.ts +0 -94
- package/packages/l10n/src/date/he.ts +0 -101
- package/packages/time/src/adapters/24iMediaTimeApi.ts +0 -47
- package/packages/time/src/services/24iMediaTimeApi/24iMediaTimeApi.ts +0 -43
- package/packages/time/src/services/24iMediaTimeApi/index.ts +0 -6
- package/packages/utils/src/forceReflow.ts +0 -14
- package/packages/utils/src/keyPress/index.ts +0 -6
- package/packages/utils/src/keyPress/keyPressSimulator.ts +0 -74
- package/packages/utils/src/keyPress/simulateKeyPress.ts +0 -25
- package/utils/release/release.ts +0 -156
|
@@ -5,4 +5,123 @@ hide_title: true
|
|
|
5
5
|
sidebar_label: Performance Utils
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
# Performance Utils
|
|
9
|
+
Set of utilities that should increase a performance if they are used instead of a native way, mainly on older devices (e.g. Entone/Kamai set-top-boxes).
|
|
10
|
+
|
|
11
|
+
> **Please check the limitations of each performance utility You want to use in a code.**
|
|
12
|
+
|
|
13
|
+
## Available perf utils
|
|
14
|
+
- **[Array](#array-perf-utils)**
|
|
15
|
+
- [filter](#filter)
|
|
16
|
+
- [forEach](#foreach)
|
|
17
|
+
- [includes](#includes)
|
|
18
|
+
- [includesNaN](#includesnan)
|
|
19
|
+
- [map](#map)
|
|
20
|
+
|
|
21
|
+
## Array perf utils
|
|
22
|
+
|
|
23
|
+
> In general, each Array utility which requires a callback will iterate over all array items, even if array index hasn't been initialized yet (to understand the issue, see [An adventure in sparse arrays](https://remysharp.com/2018/06/26/an-adventure-in-sparse-arrays)).
|
|
24
|
+
|
|
25
|
+
### filter()
|
|
26
|
+
> The filter() method creates a new array with all elements that pass the test implemented by the provided function.
|
|
27
|
+
|
|
28
|
+
For more info, please see [native **filter** method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
|
|
29
|
+
|
|
30
|
+
#### Limitations against native implementation
|
|
31
|
+
- **`callback` is invoked for all indexes of the array** (not only for indexes with assigned values like [native filter implementation](http://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/filter#Description)).
|
|
32
|
+
- **Doesn't coerce returned value from a callback to `true` or `false`**, the callback has to return a boolean value directly.
|
|
33
|
+
- Doesn't accept the `scope` as last argument.
|
|
34
|
+
|
|
35
|
+
#### Usage
|
|
36
|
+
```javascript
|
|
37
|
+
import { filter } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
38
|
+
|
|
39
|
+
const array = ['spray', 'limit', 'elite', 'exuberant', 'destruction'];
|
|
40
|
+
//const result = array.filter(word => word.length > 6); // slower native solution
|
|
41
|
+
const result = filter(array, word => word.length > 6); // faster
|
|
42
|
+
|
|
43
|
+
console.log(result);
|
|
44
|
+
// expected output: Array ["exuberant", "destruction"]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### forEach()
|
|
48
|
+
> The forEach() method executes a provided function once for each array element.
|
|
49
|
+
|
|
50
|
+
For more info, please see [native **forEach** method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach).
|
|
51
|
+
|
|
52
|
+
#### Limitations against native implementation
|
|
53
|
+
- **`callback` is invoked for all indexes of the array** (not only for indexes with assigned values like [native forEach implementation](http://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Description)).
|
|
54
|
+
- Doesn't accept the `scope` as last argument.
|
|
55
|
+
|
|
56
|
+
#### Usage
|
|
57
|
+
```javascript
|
|
58
|
+
import { forEach } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
59
|
+
|
|
60
|
+
const array = ['a', 'b', 'c'];
|
|
61
|
+
// array.forEach(item => console.log(item)); // slower native solution
|
|
62
|
+
forEach(array, item => console.log(item)); // faster
|
|
63
|
+
|
|
64
|
+
// expected output: "a"
|
|
65
|
+
// expected output: "b"
|
|
66
|
+
// expected output: "c"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### includes()
|
|
70
|
+
> The includes() method determines whether an array includes a certain value among its entries, returning true or false as appropriate.
|
|
71
|
+
|
|
72
|
+
For more info, please see [native **includes** method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes).
|
|
73
|
+
|
|
74
|
+
#### Limitations against native implementation
|
|
75
|
+
- **Doesn't work for searching NaN value!** For that purpose, please use [includesNaN()](#includesnan).
|
|
76
|
+
- Doesn't support negative indexes for `fromIndex` param - the entire array will be processed.
|
|
77
|
+
|
|
78
|
+
#### Usage
|
|
79
|
+
```javascript
|
|
80
|
+
import { includes } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
81
|
+
|
|
82
|
+
const array = ['item0', 'item1', 'item2'];
|
|
83
|
+
|
|
84
|
+
//console.log(array.includes('item1')); // slower native solution
|
|
85
|
+
console.log(includes(array, 'item1')); // faster
|
|
86
|
+
// expected output: true
|
|
87
|
+
|
|
88
|
+
//console.log(array.includes('item1')); // slower native solution
|
|
89
|
+
console.log(includes(array, 'item1', 2)); // faster
|
|
90
|
+
// expected output: false
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### includesNaN()
|
|
94
|
+
> The includesNaN() method determines whether an array includes NaN value among its entries, returning true or false as appropriate.
|
|
95
|
+
|
|
96
|
+
#### Usage
|
|
97
|
+
```javascript
|
|
98
|
+
import { includesNaN } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
99
|
+
|
|
100
|
+
console.log(includesNaN([0, NaN, 1]));
|
|
101
|
+
// expected output: true
|
|
102
|
+
|
|
103
|
+
console.log(includesNaN([0, NaN, 1], 2));
|
|
104
|
+
// expected output: false
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### map()
|
|
108
|
+
> The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.
|
|
109
|
+
|
|
110
|
+
For more info, please see [native **map** method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
|
|
111
|
+
|
|
112
|
+
#### Limitations against native implementation
|
|
113
|
+
- **`callback` is invoked for all indexes of the array** (not only for indexes with assigned values like [native map implementation](http://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map#Description)).
|
|
114
|
+
- Doesn't accept the `scope` as last argument.
|
|
115
|
+
|
|
116
|
+
#### Usage
|
|
117
|
+
```javascript
|
|
118
|
+
import { map } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
119
|
+
|
|
120
|
+
const array = [1, 4, 9, 16];
|
|
121
|
+
|
|
122
|
+
// const mappedArray = array.map(x => x * 2); // slower native solution
|
|
123
|
+
const mappedArray = map(array, x => x * 2); // faster
|
|
124
|
+
|
|
125
|
+
console.log(mappedArray);
|
|
126
|
+
// expected output: Array [2, 8, 18, 32]
|
|
127
|
+
```
|
|
@@ -1 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Performance optimized version of `Array.prototype.filter` method.
|
|
3
|
+
*
|
|
4
|
+
* Creates a new array with all elements that pass the test implemented by the provided function.
|
|
5
|
+
* @see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
|
|
6
|
+
*
|
|
7
|
+
* **Limitations against native implementation**:
|
|
8
|
+
*
|
|
9
|
+
* - **`callback` is invoked for all indexes of the array**,
|
|
10
|
+
* (not only for indexes with assigned values like native filter implementation), see example.
|
|
11
|
+
* - **Doesn't coerce returned value from a callback to `true` or `false`**,
|
|
12
|
+
* the callback has to return a boolean value directly.
|
|
13
|
+
* - Doesn't accept the `scope` as last argument.
|
|
14
|
+
*
|
|
15
|
+
* @param {Array} array - Input array.
|
|
16
|
+
* @param {Function} callback - Predicate to test each element of the array.
|
|
17
|
+
* Return true to keep the element, false otherwise.
|
|
18
|
+
*
|
|
19
|
+
* @return {Array} with filtered results.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* import { filter } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
23
|
+
*
|
|
24
|
+
* const array = ['spray', 'limit', 'elite', 'exuberant', 'destruction'];
|
|
25
|
+
*
|
|
26
|
+
* //const result = array.filter(word => word.length > 6); // slower native solution
|
|
27
|
+
* const result = filter(array, word => word.length > 6); // faster
|
|
28
|
+
*
|
|
29
|
+
* console.log(result);
|
|
30
|
+
* // expected output: Array ["exuberant", "destruction"]
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* import { filter } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
34
|
+
*
|
|
35
|
+
* const nativeResult = [1, 2, , undefined].filter(() => true);
|
|
36
|
+
* console.log(nativeResult); // Array [1, 2, undefined]. Yes, empty value is missing here.
|
|
37
|
+
*
|
|
38
|
+
* const customResult = filter([1, 2, , undefined], () => true);
|
|
39
|
+
* console.log(customResult); // Array [1, 2, undefined, undefined]. With iteration over hole.
|
|
40
|
+
*/
|
|
41
|
+
export const filter = <T>(
|
|
42
|
+
array: T[],
|
|
43
|
+
callback: (value: T, index: number, array: T[]) => boolean,
|
|
44
|
+
): T[] => {
|
|
45
|
+
const output: T[] = [];
|
|
46
|
+
|
|
47
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
48
|
+
if (callback(array[i], i, array) === true) {
|
|
49
|
+
output.push(array[i]);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return output;
|
|
54
|
+
};
|
|
@@ -1 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Performance optimized version of `Array.prototype.find` method.
|
|
3
|
+
*
|
|
4
|
+
* Returns the first element that satisfies the testing function. Undefined if no item satisfies
|
|
5
|
+
* the testing function.
|
|
6
|
+
* @see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/find
|
|
7
|
+
*
|
|
8
|
+
* **Limitations against native implementation**:
|
|
9
|
+
*
|
|
10
|
+
* - **`callback` is invoked for all indexes of the array**,
|
|
11
|
+
* (not only for indexes with assigned values like native filter implementation), see example.
|
|
12
|
+
* - **Doesn't coerce returned value from a callback to `true` or `false`**,
|
|
13
|
+
* the callback has to return a boolean value directly.
|
|
14
|
+
* - Doesn't accept the `scope` as last argument.
|
|
15
|
+
*
|
|
16
|
+
* @param {Array<T>} array - Input array.
|
|
17
|
+
* @param {Function} callback - Predicate to test each element of the array.
|
|
18
|
+
* Return true to select the element, false otherwise.
|
|
19
|
+
*
|
|
20
|
+
* @return {T | undefined} The first element the satisfied the testing function. Or undefined.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* import { find } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
24
|
+
*
|
|
25
|
+
* const array = ['spray', 'limit', 'elite', 'exuberant', 'destruction'];
|
|
26
|
+
*
|
|
27
|
+
* //const result = array.find(word => word.length > 6); // slower native solution
|
|
28
|
+
* const result = find(array, word => word.length > 6); // faster
|
|
29
|
+
*
|
|
30
|
+
* console.log(result);
|
|
31
|
+
* // expected output: "exuberant"
|
|
32
|
+
*/
|
|
33
|
+
export const find = <T>(
|
|
34
|
+
array: T[],
|
|
35
|
+
callback: (value: T, index: number, array: T[]) => boolean,
|
|
36
|
+
): T | undefined => {
|
|
37
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
38
|
+
if (callback(array[i], i, array) === true) {
|
|
39
|
+
return array[i];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
};
|
|
@@ -1 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Performance optimized version of `Array.prototype.findIndex` method.
|
|
3
|
+
*
|
|
4
|
+
* Returns the index of the first element that satisfies the testing function.
|
|
5
|
+
* Returns -1 if no item satisfies the testing function.
|
|
6
|
+
* @see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex
|
|
7
|
+
*
|
|
8
|
+
* **Limitations against native implementation**:
|
|
9
|
+
*
|
|
10
|
+
* - **`callback` is invoked for all indexes of the array**,
|
|
11
|
+
* (not only for indexes with assigned values like native filter implementation), see example.
|
|
12
|
+
* - **Doesn't coerce returned value from a callback to `true` or `false`**,
|
|
13
|
+
* the callback has to return a boolean value directly.
|
|
14
|
+
* - Doesn't accept the `scope` as last argument.
|
|
15
|
+
*
|
|
16
|
+
* @param {Array<T>} array - Input array.
|
|
17
|
+
* @param {Function} callback - Predicate to test each element of the array.
|
|
18
|
+
* Return true to select the index of the element, false otherwise.
|
|
19
|
+
*
|
|
20
|
+
* @return {number} Index of the first element the satisfied the testing function. Or -1.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* import { findIndex } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
24
|
+
*
|
|
25
|
+
* const array = ['spray', 'limit', 'elite', 'exuberant', 'destruction'];
|
|
26
|
+
*
|
|
27
|
+
* //const result = array.findIndex(word => word.length > 6); // slower native solution
|
|
28
|
+
* const result = findIndex(array, word => word.length > 6); // faster
|
|
29
|
+
*
|
|
30
|
+
* console.log(result);
|
|
31
|
+
* // expected output: 3
|
|
32
|
+
*/
|
|
33
|
+
export const findIndex = <T>(
|
|
34
|
+
array: T[],
|
|
35
|
+
callback: (value: T, index: number, array: T[]) => boolean,
|
|
36
|
+
): number => {
|
|
37
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
38
|
+
if (callback(array[i], i, array) === true) {
|
|
39
|
+
return i;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return -1;
|
|
43
|
+
};
|
|
@@ -1 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Performance optimized version of `Array.prototype.forEach` method.
|
|
3
|
+
*
|
|
4
|
+
* Executes a provided function once for each array element.
|
|
5
|
+
* @see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
|
|
6
|
+
*
|
|
7
|
+
* **Limitations against native implementation**:
|
|
8
|
+
*
|
|
9
|
+
* - **`callback` is invoked for all indexes of the array**,
|
|
10
|
+
* (not only for indexes with assigned values like native filter implementation), see example.
|
|
11
|
+
* - Doesn't accept the scope as last argument.
|
|
12
|
+
*
|
|
13
|
+
* @param {Array} array - Input array.
|
|
14
|
+
* @param {Function} callback - Function to execute on each element.
|
|
15
|
+
*
|
|
16
|
+
* @return {void}
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* import { forEach } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
20
|
+
*
|
|
21
|
+
* const array = ['a', 'b', 'c'];
|
|
22
|
+
*
|
|
23
|
+
* // array.forEach(item => console.log(item)); // slower native solution
|
|
24
|
+
* forEach(array, item => console.log(item)); // faster
|
|
25
|
+
*
|
|
26
|
+
* // expected output: "a"
|
|
27
|
+
* // expected output: "b"
|
|
28
|
+
* // expected output: "c"
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* import { forEach } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
32
|
+
*
|
|
33
|
+
* const array = new Array(1000); // creates an empty array with length 1000
|
|
34
|
+
*
|
|
35
|
+
* let iNative = 0;
|
|
36
|
+
* array.forEach(() => iNative++);
|
|
37
|
+
* console.log(iNative); // 0 - the callback was never called
|
|
38
|
+
*
|
|
39
|
+
* let iCustom = 0;
|
|
40
|
+
* forEach(array, () => iCustom++);
|
|
41
|
+
* console.log(iCustom); // 1000 - the callback was called for each item (hole) in array
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
export const forEach = <T>(array: T[], callback: (value: T, index: number, array: T[]) => void) => {
|
|
45
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
46
|
+
callback(array[i], i, array);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -1 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Performance optimized version of `Array.prototype.includes` method
|
|
3
|
+
* (doesn't work for searching NaN value).
|
|
4
|
+
*
|
|
5
|
+
* Determines whether an array includes a certain value among its entries,
|
|
6
|
+
* returning true or false as appropriate.
|
|
7
|
+
|
|
8
|
+
* @see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
|
|
9
|
+
* @see includesNaN()
|
|
10
|
+
*
|
|
11
|
+
* **Limitations against native implementation**:
|
|
12
|
+
* - **Doesn't work for searching NaN value. For that purpose, please use includesNaN()**.
|
|
13
|
+
* - Doesn't accept the scope as last argument.
|
|
14
|
+
*
|
|
15
|
+
* @param {Array} array - Input array.
|
|
16
|
+
* @param {*} valueToFind - Value to find in array.
|
|
17
|
+
* @param {number} [fromIndex=0] - Index to start search from.
|
|
18
|
+
*
|
|
19
|
+
* @return {boolean}
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* import { includes } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
23
|
+
*
|
|
24
|
+
* const array = ['item0', 'item1', 'item2'];
|
|
25
|
+
*
|
|
26
|
+
* //console.log(array.includes('item1')); // slower native solution
|
|
27
|
+
* console.log(includes(array, 'item1')); // faster
|
|
28
|
+
* // expected output: true
|
|
29
|
+
*
|
|
30
|
+
* //console.log(array.includes('item1')); // slower native solution
|
|
31
|
+
* console.log(includes(array, 'item1', 2)); // faster
|
|
32
|
+
* // expected output: false
|
|
33
|
+
*/
|
|
34
|
+
export const includes = <T>(array: T[], valueToFind: T, fromIndex = 0): boolean => {
|
|
35
|
+
for (let i = fromIndex, len = array.length; i < len; i++) {
|
|
36
|
+
if (array[i] === valueToFind) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
};
|
|
@@ -1 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Performance optimized version of `Array.prototype.includes` method for testing `NaN` value.
|
|
3
|
+
*
|
|
4
|
+
* Determines whether an array includes NaN value among its entries,
|
|
5
|
+
* returning true or false as appropriate.
|
|
6
|
+
*
|
|
7
|
+
* @see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
|
|
8
|
+
*
|
|
9
|
+
* @param {Array} array - Input array.
|
|
10
|
+
* @param {number} [fromIndex=0] - Index to start search from.
|
|
11
|
+
*
|
|
12
|
+
* @return {boolean}
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* import { includesNaN } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
16
|
+
*
|
|
17
|
+
* // returns true
|
|
18
|
+
* includesNaN([0, NaN, 2]);
|
|
19
|
+
*
|
|
20
|
+
* // returns false
|
|
21
|
+
* includesNaN([0, NaN, 2], 2);
|
|
22
|
+
*/
|
|
23
|
+
export const includesNaN = (array: any[], fromIndex = 0): boolean => {
|
|
24
|
+
for (let i = fromIndex, len = array.length; i < len; i++) {
|
|
25
|
+
const iValue = array[i];
|
|
26
|
+
// eslint-disable-next-line no-self-compare
|
|
27
|
+
if (iValue !== iValue) { // true only for NaN value
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { filter } from './filter';
|
|
2
|
+
export { find } from './find';
|
|
3
|
+
export { findIndex } from './findIndex';
|
|
4
|
+
export { forEach } from './forEach';
|
|
5
|
+
export { includes } from './includes';
|
|
6
|
+
export { includesNaN } from './includesNaN';
|
|
7
|
+
export { map } from './map';
|
|
@@ -1 +1,52 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Performance optimized version of `Array.prototype.map` method.
|
|
3
|
+
*
|
|
4
|
+
* Creates a new array populated with the results of calling a provided function
|
|
5
|
+
* on every element in the calling array.
|
|
6
|
+
*
|
|
7
|
+
* @see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map
|
|
8
|
+
*
|
|
9
|
+
* **Limitations against native implementation**:
|
|
10
|
+
*
|
|
11
|
+
* - **`callback` is invoked for all indexes of the array**,
|
|
12
|
+
* (not only for indexes with assigned values like native filter implementation), see example.
|
|
13
|
+
* - Doesn't accept the `scope` as last argument.
|
|
14
|
+
*
|
|
15
|
+
* @param {Array} array - Input array.
|
|
16
|
+
* @param {Function} callback - Function that is called for every element of arr.
|
|
17
|
+
* Each time callback executes, the returned value is added to output array.
|
|
18
|
+
*
|
|
19
|
+
* @return {Array} with mapped results.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* import { map } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
23
|
+
*
|
|
24
|
+
* const array = [1, 4, 9, 16];
|
|
25
|
+
*
|
|
26
|
+
* // const mappedArray = array.map(x => x * 2); // slower native solution
|
|
27
|
+
* const mappedArray = map(array, x => x * 2); // faster
|
|
28
|
+
*
|
|
29
|
+
* console.log(mappedArray);
|
|
30
|
+
* // expected output: Array [2, 8, 18, 32]
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* import { map } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
34
|
+
*
|
|
35
|
+
* const array = [1, , 2].map(x => x * x) // [ 1, , 4 ]
|
|
36
|
+
*
|
|
37
|
+
* const nativeResult = array.map(x => x * x);
|
|
38
|
+
* console.log(nativeResult); // [ 1, , 4 ] // keeps hole in array
|
|
39
|
+
*
|
|
40
|
+
* const customResult = map(array, x => x * x);
|
|
41
|
+
* console.log(customResult); // [ 1, NaN , 4 ] NaN? -> undefined * undefined = NaN
|
|
42
|
+
*/
|
|
43
|
+
export const map = <T, M>(array: T[], callback: (item: T, index: number, array: T[]) => M): M[] => {
|
|
44
|
+
const len = array.length;
|
|
45
|
+
const output = new Array(len);
|
|
46
|
+
|
|
47
|
+
for (let i = 0; i < len; i++) {
|
|
48
|
+
output[i] = callback(array[i], i, array);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return output;
|
|
52
|
+
};
|
|
@@ -70,7 +70,7 @@ Displays the current remaining time.
|
|
|
70
70
|
- `longFormat` - long format of a displayed time (defaults to h:mm:ss)
|
|
71
71
|
- `shortFormat` - short format of a displayed time (defaults to m:ss)
|
|
72
72
|
|
|
73
|
-
###
|
|
73
|
+
### Current Time
|
|
74
74
|
Displays the duration.
|
|
75
75
|
#### Props
|
|
76
76
|
- `className` - optional className to add to default one
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, createRef, DeclareProps } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
-
import { ITimeUpdateEvent } from '@24i/
|
|
2
|
+
import { ITimeUpdateEvent } from '@24i/player-base';
|
|
3
3
|
import { PlayerTime } from './PlayerTime';
|
|
4
4
|
import { PlayerUICommonProps, PlayerUITimeProps } from './types';
|
|
5
5
|
|
|
@@ -26,7 +26,7 @@ export class CurrentTime extends Component<Props> {
|
|
|
26
26
|
const playerInstance = ui.getPlayer();
|
|
27
27
|
this.isLive = playerInstance.live;
|
|
28
28
|
playerInstance.addEventListener('timeupdate', this.onTimeUpdate);
|
|
29
|
-
const { programStart = 0 } = playerInstance.
|
|
29
|
+
const { programStart = 0 } = playerInstance.getMetadata() || {};
|
|
30
30
|
this.liveStartTime = programStart || Date.now();
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, createRef, DeclareProps } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
-
import { IDurationChangeEvent } from '@24i/
|
|
2
|
+
import { IDurationChangeEvent } from '@24i/player-base';
|
|
3
3
|
import { PlayerTime } from './PlayerTime';
|
|
4
4
|
import { PlayerUICommonProps, PlayerUITimeProps } from './types';
|
|
5
5
|
|
|
@@ -20,7 +20,7 @@ export class Duration extends Component<Props> {
|
|
|
20
20
|
componentDidMount() {
|
|
21
21
|
const { ui } = this.props;
|
|
22
22
|
const playerInstance = ui.getPlayer();
|
|
23
|
-
const { programStart = 0, programEnd = 0 } = playerInstance.
|
|
23
|
+
const { programStart = 0, programEnd = 0 } = playerInstance.getMetadata() || {};
|
|
24
24
|
const isLive = playerInstance.live;
|
|
25
25
|
if (isLive && programStart < programEnd) {
|
|
26
26
|
this.time.current!.updateTime(programEnd - programStart);
|
|
@@ -8,8 +8,6 @@ type Props = PlayerUICommonProps;
|
|
|
8
8
|
export class PauseButton extends Component<Props> implements IFocusable {
|
|
9
9
|
button = createRef<PlayerInteractable>();
|
|
10
10
|
|
|
11
|
-
isPaused = false;
|
|
12
|
-
|
|
13
11
|
static defaultProps = {
|
|
14
12
|
className: '',
|
|
15
13
|
};
|
|
@@ -33,16 +31,10 @@ export class PauseButton extends Component<Props> implements IFocusable {
|
|
|
33
31
|
|
|
34
32
|
onPlaying = () => {
|
|
35
33
|
this.button.current!.show();
|
|
36
|
-
if (this.isPaused) {
|
|
37
|
-
const { ui } = this.props;
|
|
38
|
-
ui.getPlayer().triggerEvent('unpause');
|
|
39
|
-
}
|
|
40
|
-
this.isPaused = false;
|
|
41
34
|
};
|
|
42
35
|
|
|
43
36
|
onPause = () => {
|
|
44
37
|
this.button.current!.hide();
|
|
45
|
-
this.isPaused = true;
|
|
46
38
|
};
|
|
47
39
|
|
|
48
40
|
focus(options?: FocusOptions) {
|
|
@@ -8,7 +8,6 @@ type Props = PlayerUITimeProps & {
|
|
|
8
8
|
longTreshold?: number,
|
|
9
9
|
shortFormat?: string,
|
|
10
10
|
longFormat?: string,
|
|
11
|
-
isHiddenForAria?: boolean,
|
|
12
11
|
};
|
|
13
12
|
|
|
14
13
|
export class PlayerTime extends Component<Props> {
|
|
@@ -43,12 +42,11 @@ export class PlayerTime extends Component<Props> {
|
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
render() {
|
|
46
|
-
const { className
|
|
45
|
+
const { className } = this.props;
|
|
47
46
|
return (
|
|
48
47
|
<div
|
|
49
48
|
ref={this.div}
|
|
50
49
|
className={`player-time ${className || ''}`}
|
|
51
|
-
{...isHiddenForAria && { 'aria-hidden': true }}
|
|
52
50
|
>
|
|
53
51
|
{this.formatTime()}
|
|
54
52
|
</div>
|