@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
|
@@ -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
|
|
|
@@ -1,42 +1,33 @@
|
|
|
1
1
|
import { Component, createRef } from '@24i/bigscreen-sdk/jsx';
|
|
2
2
|
import { IFocusable } from '@24i/bigscreen-sdk/focus';
|
|
3
3
|
import { stopEvent } from '@24i/bigscreen-sdk/utils/stopEvent';
|
|
4
|
-
import { ITimeUpdateEvent, IDurationChangeEvent } from '@24i/
|
|
4
|
+
import { ITimeUpdateEvent, IDurationChangeEvent } from '@24i/player-base';
|
|
5
5
|
import { createTimeout } from '@24i/bigscreen-sdk/utils/timers';
|
|
6
6
|
import { switchByKey } from '@24i/bigscreen-sdk/device/keymap';
|
|
7
|
-
import { getDisplayToggler } from '@24i/bigscreen-sdk/utils/displayToggler';
|
|
8
7
|
import { PlayerTime } from './PlayerTime';
|
|
9
8
|
import { getLiveProgressBasedOnCurrentTime } from './timeUtils';
|
|
10
|
-
import {
|
|
9
|
+
import { PlayerUICommonProps } from './types';
|
|
11
10
|
|
|
12
11
|
const CONSECUTIVE_TIMEOUT = 500;
|
|
13
12
|
const FAST_TRESHOLD = 5;
|
|
14
13
|
const SLOW_TIME = 10000;
|
|
15
|
-
const FAST_TIME =
|
|
16
|
-
const SAFE_END_MARGIN = 10000;
|
|
14
|
+
const FAST_TIME = 20000;
|
|
17
15
|
const TO_PERCENT = 100;
|
|
18
16
|
|
|
19
|
-
type Props =
|
|
20
|
-
ui: IPlayerUIWithSeeking;
|
|
21
|
-
children?: JSX.Element;
|
|
22
|
-
} & PlayerUICommonProps;
|
|
17
|
+
type Props = PlayerUICommonProps;
|
|
23
18
|
|
|
24
19
|
export class Seekbar extends Component<Props> implements IFocusable {
|
|
25
20
|
wrap = createRef<HTMLDivElement>();
|
|
26
21
|
|
|
27
|
-
seekBarWrap = createRef<HTMLDivElement>();
|
|
28
|
-
|
|
29
22
|
seekBar = createRef<HTMLDivElement>();
|
|
30
23
|
|
|
31
24
|
seekPoint = createRef<HTMLDivElement>();
|
|
32
25
|
|
|
33
26
|
seekTime = createRef<PlayerTime>();
|
|
34
27
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
leftConsecutiveness = 0;
|
|
28
|
+
leftConsecutives = 0;
|
|
38
29
|
|
|
39
|
-
|
|
30
|
+
rightConsecutives = 0;
|
|
40
31
|
|
|
41
32
|
leftConsecutiveTimeout = createTimeout();
|
|
42
33
|
|
|
@@ -46,10 +37,6 @@ export class Seekbar extends Component<Props> implements IFocusable {
|
|
|
46
37
|
|
|
47
38
|
duration = 0;
|
|
48
39
|
|
|
49
|
-
isMouseDownPressed = false;
|
|
50
|
-
|
|
51
|
-
seekingDisabled = false;
|
|
52
|
-
|
|
53
40
|
static defaultProps = {
|
|
54
41
|
className: '',
|
|
55
42
|
};
|
|
@@ -58,59 +45,18 @@ export class Seekbar extends Component<Props> implements IFocusable {
|
|
|
58
45
|
const { ui } = this.props;
|
|
59
46
|
const playerInstance = ui.getPlayer();
|
|
60
47
|
this.duration = playerInstance.duration;
|
|
61
|
-
document.addEventListener('mouseup', this.onMouseUp);
|
|
62
|
-
document.addEventListener('mousemove', this.onMouseMove);
|
|
63
48
|
ui.seeking.addEventListener('seektimeupdate', this.onSeekTimeUpdate);
|
|
64
|
-
ui.seeking.addEventListener('stopautomaticseek', this.onStopAutomaticSeek);
|
|
65
49
|
ui.getPlayer().addEventListener('timeupdate', this.onTimeUpdate);
|
|
66
50
|
ui.getPlayer().addEventListener('durationchange', this.onDurationUpdate);
|
|
67
51
|
}
|
|
68
52
|
|
|
69
53
|
componentWillUnmount() {
|
|
70
54
|
const { ui } = this.props;
|
|
71
|
-
document.removeEventListener('mouseup', this.onMouseUp);
|
|
72
|
-
document.removeEventListener('mousemove', this.onMouseMove);
|
|
73
55
|
ui.seeking.removeEventListener('seektimeupdate', this.onSeekTimeUpdate);
|
|
74
|
-
ui.seeking.removeEventListener('stopautomaticseek', this.onStopAutomaticSeek);
|
|
75
56
|
ui.getPlayer().removeEventListener('timeupdate', this.onTimeUpdate);
|
|
76
57
|
ui.getPlayer().removeEventListener('durationchange', this.onDurationUpdate);
|
|
77
58
|
}
|
|
78
59
|
|
|
79
|
-
onMouseMove = (event: MouseEvent) => {
|
|
80
|
-
if (!this.isMouseDownPressed || this.seekingDisabled) return;
|
|
81
|
-
const { ui: { seeking } } = this.props;
|
|
82
|
-
const wrapRect = this.wrap.current!.getBoundingClientRect();
|
|
83
|
-
const clientX = event.clientX - wrapRect.left;
|
|
84
|
-
const wrapRight = wrapRect.right - wrapRect.left;
|
|
85
|
-
let percentage = (TO_PERCENT * clientX) / wrapRight;
|
|
86
|
-
percentage = Math.max(0, Math.min(TO_PERCENT, percentage));
|
|
87
|
-
const seekTo = Math.round((this.duration / TO_PERCENT) * percentage);
|
|
88
|
-
seeking.setSeekTime(seekTo);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
onMouseClick = (event: MouseEvent) => {
|
|
92
|
-
if (this.seekingDisabled) return;
|
|
93
|
-
const { ui: { seeking } } = this.props;
|
|
94
|
-
const wrapWidth = this.wrap.current!.offsetWidth;
|
|
95
|
-
const percentage = (TO_PERCENT * event.offsetX) / wrapWidth;
|
|
96
|
-
const seekTo = Math.round((this.duration / TO_PERCENT) * percentage);
|
|
97
|
-
seeking.setSeekTime(seekTo);
|
|
98
|
-
seeking.confirmSeek();
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
onMouseDown = () => {
|
|
102
|
-
const { ui } = this.props;
|
|
103
|
-
this.isMouseDownPressed = true;
|
|
104
|
-
ui.disableHiding();
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
onMouseUp = () => {
|
|
108
|
-
const { ui } = this.props;
|
|
109
|
-
this.isMouseDownPressed = false;
|
|
110
|
-
ui.seeking.confirmSeek();
|
|
111
|
-
ui.enableHiding();
|
|
112
|
-
};
|
|
113
|
-
|
|
114
60
|
onKeyDown = (event: KeyboardEvent) => {
|
|
115
61
|
const processed = switchByKey(event, {
|
|
116
62
|
LEFT: this.onLeft,
|
|
@@ -126,50 +72,34 @@ export class Seekbar extends Component<Props> implements IFocusable {
|
|
|
126
72
|
};
|
|
127
73
|
|
|
128
74
|
onLeft = () => {
|
|
129
|
-
if (this.seekingDisabled) return true;
|
|
130
75
|
const { ui } = this.props;
|
|
131
|
-
this.
|
|
76
|
+
this.leftConsecutives += 1;
|
|
132
77
|
if (ui.seeking.isAutomaticallySeeking()) {
|
|
133
78
|
ui.seeking.stopAutomaticSeek();
|
|
134
79
|
}
|
|
135
|
-
ui.seeking.seekBackward(this.
|
|
80
|
+
ui.seeking.seekBackward(this.leftConsecutives >= FAST_TRESHOLD ? FAST_TIME : SLOW_TIME);
|
|
136
81
|
this.leftConsecutiveTimeout.set(() => {
|
|
137
|
-
this.
|
|
82
|
+
this.leftConsecutives = 0;
|
|
138
83
|
}, CONSECUTIVE_TIMEOUT);
|
|
139
84
|
return true;
|
|
140
85
|
};
|
|
141
86
|
|
|
142
87
|
onRight = () => {
|
|
143
|
-
if (this.seekingDisabled) return true;
|
|
144
88
|
const { ui } = this.props;
|
|
145
|
-
|
|
146
|
-
if (seekTime == null && this.currentTime + SLOW_TIME >= this.duration) return true;
|
|
147
|
-
this.rightConsecutiveness += 1;
|
|
89
|
+
this.rightConsecutives += 1;
|
|
148
90
|
if (ui.seeking.isAutomaticallySeeking()) {
|
|
149
91
|
ui.seeking.stopAutomaticSeek();
|
|
150
92
|
}
|
|
151
|
-
|
|
152
|
-
if (
|
|
153
|
-
(seekTime != null
|
|
154
|
-
&& (seekTime + SLOW_TIME >= this.duration - SAFE_END_MARGIN
|
|
155
|
-
|| (isFastSeeking && seekTime + FAST_TIME >= this.duration - SAFE_END_MARGIN)))
|
|
156
|
-
|| (seekTime == null && this.currentTime >= this.duration - SAFE_END_MARGIN)
|
|
157
|
-
) {
|
|
158
|
-
ui.seeking.setSeekTime(this.duration - SAFE_END_MARGIN);
|
|
159
|
-
} else {
|
|
160
|
-
ui.seeking.seekForward(isFastSeeking ? FAST_TIME : SLOW_TIME);
|
|
161
|
-
}
|
|
93
|
+
ui.seeking.seekForward(this.rightConsecutives >= FAST_TRESHOLD ? FAST_TIME : SLOW_TIME);
|
|
162
94
|
this.rightConsecutiveTimeout.set(() => {
|
|
163
|
-
this.
|
|
95
|
+
this.rightConsecutives = 0;
|
|
164
96
|
}, CONSECUTIVE_TIMEOUT);
|
|
165
97
|
return true;
|
|
166
98
|
};
|
|
167
99
|
|
|
168
100
|
onEnter = () => {
|
|
169
|
-
const { ui
|
|
170
|
-
|
|
171
|
-
if (!player.playing) player.play();
|
|
172
|
-
return seeking.confirmSeek();
|
|
101
|
+
const { ui } = this.props;
|
|
102
|
+
return ui.seeking.confirmSeek();
|
|
173
103
|
};
|
|
174
104
|
|
|
175
105
|
onSeekTimeUpdate = (seekTime: number) => {
|
|
@@ -178,11 +108,6 @@ export class Seekbar extends Component<Props> implements IFocusable {
|
|
|
178
108
|
this.updateSeekBar();
|
|
179
109
|
};
|
|
180
110
|
|
|
181
|
-
onStopAutomaticSeek = () => {
|
|
182
|
-
const { ui } = this.props;
|
|
183
|
-
ui.enableHiding();
|
|
184
|
-
};
|
|
185
|
-
|
|
186
111
|
onTimeUpdate = ({ currentTime }: ITimeUpdateEvent) => {
|
|
187
112
|
const { ui } = this.props;
|
|
188
113
|
this.currentTime = currentTime;
|
|
@@ -196,7 +121,7 @@ export class Seekbar extends Component<Props> implements IFocusable {
|
|
|
196
121
|
const { ui } = this.props;
|
|
197
122
|
const player = ui.getPlayer();
|
|
198
123
|
if (player.live) {
|
|
199
|
-
const { programStart = 0, programEnd = 0 } = player.
|
|
124
|
+
const { programStart = 0, programEnd = 0 } = player.getMetadata();
|
|
200
125
|
this.duration = programEnd - programStart || Date.now();
|
|
201
126
|
} else {
|
|
202
127
|
this.duration = duration;
|
|
@@ -208,7 +133,7 @@ export class Seekbar extends Component<Props> implements IFocusable {
|
|
|
208
133
|
const { ui } = this.props;
|
|
209
134
|
const player = ui.getPlayer();
|
|
210
135
|
if (player.live) {
|
|
211
|
-
const { programStart = 0, programEnd = 0 } = player.
|
|
136
|
+
const { programStart = 0, programEnd = 0 } = player.getMetadata();
|
|
212
137
|
const { start, end } = player.seekableRange;
|
|
213
138
|
return getLiveProgressBasedOnCurrentTime(
|
|
214
139
|
programStart,
|
|
@@ -235,34 +160,17 @@ export class Seekbar extends Component<Props> implements IFocusable {
|
|
|
235
160
|
this.seekPoint.current!.style.left = `${percentTime}%`;
|
|
236
161
|
}
|
|
237
162
|
|
|
238
|
-
disableSeeking() {
|
|
239
|
-
this.seekingDisabled = true;
|
|
240
|
-
this.displaySeekPoint.hide();
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
enableSeeking() {
|
|
244
|
-
this.seekingDisabled = false;
|
|
245
|
-
this.displaySeekPoint.show();
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
isSeekingDisabled() {
|
|
249
|
-
return this.seekingDisabled;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
163
|
render() {
|
|
253
|
-
const {
|
|
164
|
+
const { className } = this.props;
|
|
254
165
|
return (
|
|
255
166
|
<div
|
|
256
167
|
className={`seek-bar ${className}`}
|
|
257
168
|
ref={this.wrap}
|
|
258
169
|
tabIndex={0}
|
|
259
170
|
onKeyDown={this.onKeyDown}
|
|
260
|
-
onMouseDown={this.onMouseDown}
|
|
261
|
-
onClick={this.onMouseClick}
|
|
262
171
|
onBlur={this.onBlur}
|
|
263
172
|
>
|
|
264
|
-
|
|
265
|
-
<div className="bar" ref={this.seekBarWrap}>
|
|
173
|
+
<div className="bar">
|
|
266
174
|
<div className="bg" ref={this.seekBar} />
|
|
267
175
|
</div>
|
|
268
176
|
<div className="point" ref={this.seekPoint}>
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { IEvents, EventMapType, EventsManager } from '@24i/bigscreen-sdk/events-manager';
|
|
2
|
-
import { createInterval
|
|
3
|
-
import { PlayerBase } from '@24i/
|
|
2
|
+
import { createInterval } from '@24i/bigscreen-sdk/utils/timers';
|
|
3
|
+
import { PlayerBase } from '@24i/player-base';
|
|
4
4
|
|
|
5
|
-
const DEFAULT_SEEK_TIME =
|
|
6
|
-
const FAST_SEEK_TIME = 30000;
|
|
5
|
+
const DEFAULT_SEEK_TIME = 20000;
|
|
7
6
|
const AUTOMATIC_SEEK_INTERVAL = 300;
|
|
8
|
-
const FAST_THRESHOLD = 5;
|
|
9
|
-
const CONSECUTIVE_TIMEOUT = 500;
|
|
10
7
|
|
|
11
8
|
interface SeekingEventsMap extends EventMapType {
|
|
12
9
|
'seektimeupdate': (payload: number) => void,
|
|
@@ -26,21 +23,13 @@ export class Seeking implements IEvents<SeekingEventsMap> {
|
|
|
26
23
|
|
|
27
24
|
automaticSeekInterval = createInterval();
|
|
28
25
|
|
|
29
|
-
player: PlayerBase | null;
|
|
26
|
+
player: PlayerBase<any> | null;
|
|
30
27
|
|
|
31
28
|
isAutomaticallySeekingForward = false;
|
|
32
29
|
|
|
33
30
|
isAutomaticallySeekingBackward = false;
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
rewConsecutiveness = 0;
|
|
38
|
-
|
|
39
|
-
ffConsecutiveTimeout = createTimeout();
|
|
40
|
-
|
|
41
|
-
rewConsecutiveTimeout = createTimeout();
|
|
42
|
-
|
|
43
|
-
constructor(player: PlayerBase | null = null) {
|
|
32
|
+
constructor(player: PlayerBase<any> | null = null) {
|
|
44
33
|
this.player = player;
|
|
45
34
|
}
|
|
46
35
|
|
|
@@ -52,7 +41,7 @@ export class Seeking implements IEvents<SeekingEventsMap> {
|
|
|
52
41
|
this.player!.removeEventListener('seeked', this.nullSeekTime);
|
|
53
42
|
}
|
|
54
43
|
|
|
55
|
-
setPlayer(player: PlayerBase) {
|
|
44
|
+
setPlayer(player: PlayerBase<any>) {
|
|
56
45
|
this.player = player;
|
|
57
46
|
}
|
|
58
47
|
|
|
@@ -87,53 +76,28 @@ export class Seeking implements IEvents<SeekingEventsMap> {
|
|
|
87
76
|
this.triggerEvent('seektimeupdate', this.seekTime!);
|
|
88
77
|
}
|
|
89
78
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
this.ffConsecutiveTimeout.set(() => {
|
|
93
|
-
this.ffConsecutiveness = 0;
|
|
94
|
-
}, CONSECUTIVE_TIMEOUT);
|
|
95
|
-
this.ffConsecutiveness += 1;
|
|
96
|
-
if (this.ffConsecutiveness === FAST_THRESHOLD) {
|
|
97
|
-
this.automaticSeekInterval.set(
|
|
98
|
-
() => this.seekForward(FAST_SEEK_TIME),
|
|
99
|
-
AUTOMATIC_SEEK_INTERVAL,
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
79
|
+
startAutomaticSeekForward() {
|
|
80
|
+
this.stopAutomaticSeek();
|
|
104
81
|
this.isAutomaticallySeekingForward = true;
|
|
105
|
-
this.ffConsecutiveness += 1;
|
|
106
82
|
this.seekForward();
|
|
107
|
-
this.automaticSeekInterval.set(() =>
|
|
83
|
+
this.automaticSeekInterval.set(() => {
|
|
84
|
+
this.seekForward();
|
|
85
|
+
}, AUTOMATIC_SEEK_INTERVAL);
|
|
108
86
|
}
|
|
109
87
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.rewConsecutiveTimeout.set(() => {
|
|
113
|
-
this.rewConsecutiveness = 0;
|
|
114
|
-
}, CONSECUTIVE_TIMEOUT);
|
|
115
|
-
this.rewConsecutiveness += 1;
|
|
116
|
-
if (this.rewConsecutiveness === FAST_THRESHOLD) {
|
|
117
|
-
this.automaticSeekInterval.set(
|
|
118
|
-
() => this.seekBackward(FAST_SEEK_TIME),
|
|
119
|
-
AUTOMATIC_SEEK_INTERVAL,
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
88
|
+
startAutomaticSeekBackward() {
|
|
89
|
+
this.stopAutomaticSeek();
|
|
124
90
|
this.isAutomaticallySeekingBackward = true;
|
|
125
|
-
this.rewConsecutiveness += 1;
|
|
126
91
|
this.seekBackward();
|
|
127
|
-
this.automaticSeekInterval.set(() =>
|
|
92
|
+
this.automaticSeekInterval.set(() => {
|
|
93
|
+
this.seekBackward();
|
|
94
|
+
}, AUTOMATIC_SEEK_INTERVAL);
|
|
128
95
|
}
|
|
129
96
|
|
|
130
97
|
stopAutomaticSeek() {
|
|
131
|
-
if (this.isAutomaticallySeeking()) this.triggerEvent('stopautomaticseek');
|
|
132
98
|
this.automaticSeekInterval.clear();
|
|
133
99
|
this.isAutomaticallySeekingForward = false;
|
|
134
100
|
this.isAutomaticallySeekingBackward = false;
|
|
135
|
-
this.ffConsecutiveness = 0;
|
|
136
|
-
this.rewConsecutiveness = 0;
|
|
137
101
|
}
|
|
138
102
|
|
|
139
103
|
cancelSeek() {
|
|
@@ -146,11 +110,6 @@ export class Seeking implements IEvents<SeekingEventsMap> {
|
|
|
146
110
|
this.triggerEvent('seektimeupdate', this.seekTime!);
|
|
147
111
|
};
|
|
148
112
|
|
|
149
|
-
setSeekTime = (seekTime: number) => {
|
|
150
|
-
this.seekTime = seekTime;
|
|
151
|
-
this.triggerEvent('seektimeupdate', this.seekTime!);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
113
|
confirmSeek() {
|
|
155
114
|
if (!this.player) return false;
|
|
156
115
|
this.stopAutomaticSeek();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { PlayerBase, ITimeUpdateEvent } from '@24i/
|
|
1
|
+
import { PlayerBase, ITimeUpdateEvent } from '@24i/player-base';
|
|
2
2
|
import { Component, createRef, DeclareProps, setText } from '@24i/bigscreen-sdk/jsx';
|
|
3
3
|
import { getDisplayToggler } from '@24i/bigscreen-sdk/utils';
|
|
4
4
|
import { SubtitlesType } from '@24i/smartapps-datalayer/src/models';
|
|
5
5
|
import { timeToMs } from './timeUtils';
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
8
|
-
player: PlayerBase
|
|
8
|
+
player: PlayerBase<any>,
|
|
9
9
|
className?: string,
|
|
10
10
|
};
|
|
11
11
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { PlayerUI } from './PlayerUI';
|
|
2
2
|
export type { PlayerUIState } from './PlayerUI';
|
|
3
|
-
export type { IPlayerUIWithSeeking } from './types';
|
|
4
3
|
export { BackwardButton } from './BackwardButton';
|
|
5
4
|
export { CurrentTime } from './CurrentTime';
|
|
6
5
|
export { Duration } from './Duration';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlayerBase, PlayerBaseMock } from '@24i/player-base';
|
|
2
2
|
import { EventsManager } from '@24i/bigscreen-sdk/events-manager';
|
|
3
|
-
import {
|
|
3
|
+
import { IPlayerUI } from './types';
|
|
4
4
|
|
|
5
|
-
const getSeekingMock = (): jest.Mocked<
|
|
5
|
+
const getSeekingMock = (): jest.Mocked<IPlayerUI['seeking']> => ({
|
|
6
6
|
events: {} as EventsManager<{}>,
|
|
7
7
|
addEventListener: jest.fn(),
|
|
8
8
|
removeEventListener: jest.fn(),
|
|
@@ -13,16 +13,12 @@ const getSeekingMock = (): jest.Mocked<IPlayerUIWithSeeking['seeking']> => ({
|
|
|
13
13
|
isAutomaticallySeeking: jest.fn(),
|
|
14
14
|
isAutomaticallySeekingForward: false,
|
|
15
15
|
isAutomaticallySeekingBackward: false,
|
|
16
|
-
ffConsecutiveness: 0,
|
|
17
|
-
rewConsecutiveness: 0,
|
|
18
|
-
ffConsecutiveTimeout: null!,
|
|
19
|
-
rewConsecutiveTimeout: null!,
|
|
20
16
|
isSeeking: jest.fn(),
|
|
21
17
|
startSeeking: jest.fn(),
|
|
22
18
|
seekForward: jest.fn(),
|
|
23
19
|
seekBackward: jest.fn(),
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
startAutomaticSeekForward: jest.fn(),
|
|
21
|
+
startAutomaticSeekBackward: jest.fn(),
|
|
26
22
|
stopAutomaticSeek: jest.fn(),
|
|
27
23
|
cancelSeek: jest.fn(),
|
|
28
24
|
confirmSeek: jest.fn(),
|
|
@@ -30,36 +26,16 @@ const getSeekingMock = (): jest.Mocked<IPlayerUIWithSeeking['seeking']> => ({
|
|
|
30
26
|
unsubscribeEvents: jest.fn(),
|
|
31
27
|
setPlayer: jest.fn(),
|
|
32
28
|
nullSeekTime: jest.fn(),
|
|
33
|
-
setSeekTime: jest.fn(),
|
|
34
29
|
});
|
|
35
30
|
|
|
36
|
-
const
|
|
31
|
+
export const getPlayerMock = (): PlayerBase<any> => new PlayerBaseMock();
|
|
37
32
|
|
|
38
|
-
export const
|
|
39
|
-
const initialConfig: IPlayerProperties = {
|
|
40
|
-
source: {
|
|
41
|
-
url: '',
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
const parentElement = document.createElement('div');
|
|
45
|
-
|
|
46
|
-
const playerMock = new PlayerBaseMock(initialConfig, parentElement);
|
|
47
|
-
playerMock.source = initialConfig.source;
|
|
48
|
-
jest.spyOn(playerMock, 'duration', 'get').mockReturnValue(PLAYER_MOCK_DURATION);
|
|
49
|
-
|
|
50
|
-
return playerMock;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const getUiMock = (): { ui: jest.Mocked<IPlayerUIWithSeeking> } => ({
|
|
33
|
+
export const getUiMock = (): { ui: jest.Mocked<IPlayerUI> } => ({
|
|
54
34
|
ui: {
|
|
55
|
-
getPlayer: jest.fn((): PlayerBase => getPlayerMock()),
|
|
35
|
+
getPlayer: jest.fn((): PlayerBase<any> => getPlayerMock()),
|
|
56
36
|
heartbeat: jest.fn(),
|
|
57
37
|
trigger: jest.fn(),
|
|
58
38
|
isPlaying: jest.fn(),
|
|
59
|
-
enableHiding: jest.fn(),
|
|
60
|
-
disableHiding: jest.fn(),
|
|
61
|
-
enableSeeking: jest.fn(),
|
|
62
|
-
disableSeeking: jest.fn(),
|
|
63
39
|
seeking: getSeekingMock(),
|
|
64
40
|
},
|
|
65
41
|
});
|