@24i/bigscreen-sdk 1.1.0 → 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 +1 -1
- 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 +3 -34
- package/packages/developer-tools/src/TechnicalInfo/__mocks__/Device.ts +0 -4
- package/packages/developer-tools/src/TechnicalInfo/translations.ts +0 -4
- 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 -54
- package/packages/driver-androidtv/src/__mocks__/javaScriptBridge.ts +5 -29
- package/packages/driver-androidtv/src/keymap.ts +0 -18
- package/packages/driver-androidtv/src/types.ts +16 -102
- package/packages/driver-base/src/DeviceBase.ts +2 -61
- 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__/keyMap.ts +0 -1
- 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/keymap.ts +0 -8
- package/packages/driver-entone/src/keymap.ts +0 -1
- package/packages/driver-tizen/src/TizenKeys.ts +0 -2
- package/packages/driver-vidaa/src/DeviceVidaa.ts +2 -3
- 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 -8
- package/packages/driver-webos/src/keymap.ts +1 -2
- 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/icon/src/Icon.tsx +5 -27
- package/packages/input/README.md +1 -4
- package/packages/input/src/Input.tsx +29 -65
- package/packages/input/src/handleOverflow.ts +29 -0
- 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 -11
- package/packages/keyboard/src/WhitelabelKeyboard/types.ts +0 -1
- 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/CenteredList/controller.ts +1 -0
- package/packages/list/src/EdgeOffsetList/EdgeOffsetList.tsx +3 -3
- package/packages/list/src/UnifiedListController/UnifiedListController.ts +2 -6
- package/packages/logger/src/loggers/SentryLogger/Sentry.ts +0 -1
- package/packages/logger/src/loggers/SentryLogger/SentryLogger.ts +2 -2
- 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/src/Route.tsx +27 -61
- package/packages/router/src/Router.tsx +13 -59
- 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/.vscode/settings.json +0 -6
- 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 -200
- package/packages/analytics/src/clients/GoogleAnalytics/constants.ts +0 -118
- 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 -77
- package/packages/analytics/src/clients/GoogleAnalytics/mapPayload.ts +0 -50
- package/packages/analytics/src/clients/GoogleAnalytics/prepareBody.ts +0 -14
- package/packages/analytics/src/clients/TealiumAnalytics/TealiumAnalytics.ts +0 -169
- package/packages/analytics/src/clients/TealiumAnalytics/constants.ts +0 -102
- package/packages/analytics/src/clients/TealiumAnalytics/findIdForLanguage.ts +0 -9
- package/packages/analytics/src/clients/TealiumAnalytics/index.ts +0 -4
- package/packages/analytics/src/clients/TealiumAnalytics/interface.ts +0 -33
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/__mocks__/mediaPayload.ts +0 -70
- 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/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 -156
- package/packages/analytics/src/clients/TwentyFourIQ/TwentyFourIQClient.ts +0 -116
- package/packages/analytics/src/clients/TwentyFourIQ/constants.ts +0 -99
- 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 -31
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapAdLoaded.ts +0 -13
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapAdSkipped.ts +0 -16
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBase.ts +0 -21
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBuffering.ts +0 -15
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerClose.ts +0 -24
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerOpen.ts +0 -18
- 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 -21
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoPause.ts +0 -24
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoProgress.ts +0 -24
- 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 -115
- 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/create-package/dist/createPackage.js +0 -66
- package/packages/create-package/dist/createPackage.js.map +0 -1
- package/packages/create-package/dist/index.js +0 -5
- package/packages/create-package/dist/index.js.map +0 -1
- package/packages/create-package/dist/questionnaire/questions.js +0 -35
- package/packages/create-package/dist/questionnaire/questions.js.map +0 -1
- package/packages/create-package/dist/settings/Settings.js +0 -10
- package/packages/create-package/dist/settings/Settings.js.map +0 -1
- package/packages/create-package/dist/types.js +0 -3
- package/packages/create-package/dist/types.js.map +0 -1
- package/packages/device/src/driver/index.firetv.ts +0 -1
- package/packages/device/src/driver/index.smartcast.tv.ts +0 -1
- package/packages/driver-firetv/src/DeviceFireTV.ts +0 -18
- package/packages/driver-firetv/src/__mocks__/javaScriptBridge.ts +0 -36
- package/packages/driver-firetv/src/index.ts +0 -1
- package/packages/driver-smartcast/src/DeviceSmartCast.ts +0 -317
- package/packages/driver-smartcast/src/__mocks__/api.ts +0 -49
- 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 -65
- package/packages/focus/src/hasFocus.ts +0 -36
- package/packages/input/src/utils.ts +0 -71
- 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/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/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 -154
|
@@ -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>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, createRef, DeclareProps } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
-
import { PlayerBase } from '@24i/
|
|
3
|
-
import {
|
|
2
|
+
import { PlayerBase } from '@24i/player-base';
|
|
3
|
+
import { switchByKey } from '@24i/bigscreen-sdk/device/keymap';
|
|
4
4
|
import { stopEvent } from '@24i/bigscreen-sdk/utils/stopEvent';
|
|
5
5
|
import {
|
|
6
6
|
IDisplayToggler, getDisplayToggler, DISPLAY_NONE,
|
|
@@ -16,15 +16,12 @@ export type PlayerUIState = {
|
|
|
16
16
|
|
|
17
17
|
type Props = {
|
|
18
18
|
children: (state: PlayerUIState) => JSX.Element | JSX.Element[] | string | null | null[],
|
|
19
|
-
player: PlayerBase
|
|
19
|
+
player: PlayerBase<any>,
|
|
20
20
|
timeout?: number,
|
|
21
21
|
className?: string,
|
|
22
22
|
hidden?: boolean,
|
|
23
|
-
disallowSeeking?: boolean,
|
|
24
23
|
onClose?: () => void,
|
|
25
24
|
onHide?: () => void,
|
|
26
|
-
isPauseAllowed?: () => boolean,
|
|
27
|
-
showSubtitlesPicker?: () => void,
|
|
28
25
|
};
|
|
29
26
|
|
|
30
27
|
export class PlayerUI extends Component<Props>
|
|
@@ -35,47 +32,41 @@ export class PlayerUI extends Component<Props>
|
|
|
35
32
|
|
|
36
33
|
isHidingDisabled = false;
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
seeking: Seeking | undefined;
|
|
35
|
+
seeking: Seeking;
|
|
41
36
|
|
|
42
37
|
div = createRef<HTMLDivElement>();
|
|
43
38
|
|
|
44
39
|
// eslint-disable-next-line react/destructuring-assignment
|
|
45
40
|
divDisplay: IDisplayToggler = getDisplayToggler(this.div, this.props.hidden);
|
|
46
41
|
|
|
47
|
-
player: PlayerBase | null = null;
|
|
42
|
+
player: PlayerBase<any> | null = null;
|
|
48
43
|
|
|
49
44
|
static defaultProps = {
|
|
50
45
|
timeout: 5000,
|
|
51
46
|
className: '',
|
|
52
47
|
hidden: false,
|
|
53
|
-
disallowSeeking: false,
|
|
54
48
|
onClose: noop,
|
|
55
49
|
onHide: noop,
|
|
56
|
-
isPauseAllowed: () => true,
|
|
57
50
|
};
|
|
58
51
|
|
|
59
52
|
declare props: DeclareProps<Props, typeof PlayerUI.defaultProps>;
|
|
60
53
|
|
|
61
54
|
constructor(props: Props) {
|
|
62
55
|
super(props);
|
|
63
|
-
const { hidden, player
|
|
56
|
+
const { hidden, player } = this.props;
|
|
64
57
|
this.player = player;
|
|
65
|
-
|
|
66
|
-
this.seeking = new Seeking(player);
|
|
67
|
-
}
|
|
58
|
+
this.seeking = new Seeking(player);
|
|
68
59
|
this.isHidden = hidden;
|
|
69
60
|
}
|
|
70
61
|
|
|
71
62
|
componentDidMount() {
|
|
72
63
|
if (!this.isHidden) this.heartbeat();
|
|
73
|
-
|
|
64
|
+
this.seeking.subscribeEvents();
|
|
74
65
|
}
|
|
75
66
|
|
|
76
67
|
componentWillUnmount() {
|
|
77
68
|
this.stopHeartbeat();
|
|
78
|
-
|
|
69
|
+
this.seeking.unsubscribeEvents();
|
|
79
70
|
}
|
|
80
71
|
|
|
81
72
|
onKeyDown = (event: KeyboardEvent) => {
|
|
@@ -91,23 +82,13 @@ export class PlayerUI extends Component<Props>
|
|
|
91
82
|
STOP: this.onKeyStop,
|
|
92
83
|
FF: this.onKeyForward,
|
|
93
84
|
REW: this.onKeyRewind,
|
|
94
|
-
SUBTITLES: this.onKeySubtitles,
|
|
95
85
|
});
|
|
96
|
-
if (processed
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
onKeySubtitles = () => {
|
|
100
|
-
const { showSubtitlesPicker } = this.props;
|
|
101
|
-
if (showSubtitlesPicker) {
|
|
102
|
-
showSubtitlesPicker();
|
|
103
|
-
}
|
|
104
|
-
return true;
|
|
86
|
+
if (processed) stopEvent(event);
|
|
105
87
|
};
|
|
106
88
|
|
|
107
89
|
onKeyPlay = () => {
|
|
108
|
-
if (this.seeking
|
|
90
|
+
if (this.seeking.isSeeking()) {
|
|
109
91
|
this.seeking.confirmSeek();
|
|
110
|
-
if (!this.isPlaying()) this.trigger(PlayerAction.PLAY);
|
|
111
92
|
return true;
|
|
112
93
|
}
|
|
113
94
|
if (!this.isPlaying()) {
|
|
@@ -119,11 +100,8 @@ export class PlayerUI extends Component<Props>
|
|
|
119
100
|
};
|
|
120
101
|
|
|
121
102
|
onKeyPause = () => {
|
|
122
|
-
|
|
123
|
-
if (!isPauseAllowed()) return false;
|
|
124
|
-
if (this.seeking?.isAutomaticallySeeking()) {
|
|
103
|
+
if (this.seeking.isAutomaticallySeeking()) {
|
|
125
104
|
this.seeking.stopAutomaticSeek();
|
|
126
|
-
if (this.isPlaying()) this.trigger(PlayerAction.PAUSE);
|
|
127
105
|
return true;
|
|
128
106
|
}
|
|
129
107
|
if (this.isPlaying()) {
|
|
@@ -135,13 +113,6 @@ export class PlayerUI extends Component<Props>
|
|
|
135
113
|
};
|
|
136
114
|
|
|
137
115
|
onKeyPlayPause = () => {
|
|
138
|
-
const { isPauseAllowed } = this.props;
|
|
139
|
-
if (!isPauseAllowed()) return false;
|
|
140
|
-
if (this.seeking?.isSeeking()) {
|
|
141
|
-
this.seeking.confirmSeek();
|
|
142
|
-
if (!this.isPlaying()) this.trigger(PlayerAction.PLAY);
|
|
143
|
-
return true;
|
|
144
|
-
}
|
|
145
116
|
this.show();
|
|
146
117
|
if (this.isPlaying()) this.trigger(PlayerAction.PAUSE);
|
|
147
118
|
else this.trigger(PlayerAction.PLAY);
|
|
@@ -155,29 +126,36 @@ export class PlayerUI extends Component<Props>
|
|
|
155
126
|
};
|
|
156
127
|
|
|
157
128
|
onKeyForward = () => {
|
|
158
|
-
if (
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
this.seeking.
|
|
163
|
-
|
|
129
|
+
if (this.seeking.isAutomaticallySeekingBackward) {
|
|
130
|
+
this.seeking.stopAutomaticSeek();
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
if (!this.seeking.isAutomaticallySeekingForward) {
|
|
134
|
+
this.seeking.startAutomaticSeekForward();
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
return false;
|
|
164
138
|
};
|
|
165
139
|
|
|
166
140
|
onKeyRewind = () => {
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
this.seeking.
|
|
172
|
-
|
|
173
|
-
|
|
141
|
+
if (this.seeking.isAutomaticallySeekingForward) {
|
|
142
|
+
this.seeking.stopAutomaticSeek();
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
if (!this.seeking.isAutomaticallySeekingBackward) {
|
|
146
|
+
this.seeking.startAutomaticSeekBackward();
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
return false;
|
|
174
150
|
};
|
|
175
151
|
|
|
176
|
-
getPlayer
|
|
152
|
+
getPlayer() {
|
|
153
|
+
return this.player!;
|
|
154
|
+
}
|
|
177
155
|
|
|
178
|
-
setPlayer(player: PlayerBase) {
|
|
156
|
+
setPlayer(player: PlayerBase<any>) {
|
|
179
157
|
this.player = player;
|
|
180
|
-
|
|
158
|
+
this.seeking.setPlayer(player);
|
|
181
159
|
}
|
|
182
160
|
|
|
183
161
|
trigger(action: PlayerAction, payload?: any) {
|
|
@@ -241,17 +219,6 @@ export class PlayerUI extends Component<Props>
|
|
|
241
219
|
this.isHidingDisabled = false;
|
|
242
220
|
}
|
|
243
221
|
|
|
244
|
-
disableSeeking() {
|
|
245
|
-
if (this.seeking?.isSeeking() || this.seeking?.isAutomaticallySeeking()) {
|
|
246
|
-
this.seeking.cancelSeek();
|
|
247
|
-
}
|
|
248
|
-
this.isSeekingDisabled = true;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
enableSeeking() {
|
|
252
|
-
this.isSeekingDisabled = false;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
222
|
render() {
|
|
256
223
|
const { children, hidden, className } = this.props;
|
|
257
224
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, createRef, DeclareProps } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
-
import { IDurationChangeEvent, ITimeUpdateEvent } from '@24i/
|
|
2
|
+
import { IDurationChangeEvent, ITimeUpdateEvent } from '@24i/player-base';
|
|
3
3
|
import { PlayerTime } from './PlayerTime';
|
|
4
4
|
import { PlayerUICommonProps, PlayerUITimeProps } from './types';
|
|
5
5
|
|
|
@@ -32,7 +32,7 @@ export class RemainingTime extends Component<Props> {
|
|
|
32
32
|
this.duration = playerInstance.duration;
|
|
33
33
|
playerInstance.addEventListener('timeupdate', this.onTimeUpdate);
|
|
34
34
|
playerInstance.addEventListener('durationchange', this.onDurationChange);
|
|
35
|
-
const { programEnd = 0 } = playerInstance.
|
|
35
|
+
const { programEnd = 0 } = playerInstance.getMetadata() || {};
|
|
36
36
|
this.liveEndTime = programEnd || Date.now();
|
|
37
37
|
}
|
|
38
38
|
|