@npo/player 1.27.7 → 1.28.0
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 +4 -7
- package/lib/js/markers/updateLiveMarkers.d.ts +7 -2
- package/lib/js/markers/updateLiveMarkers.js +11 -4
- package/lib/js/markers/updateLiveMarkers.test.js +13 -3
- package/lib/js/playeractions/handlers/handleoffsets.test.js +1 -1
- package/lib/js/playeractions/handlers/mediasessionactions.d.ts +7 -2
- package/lib/js/playeractions/handlers/mediasessionactions.js +7 -7
- package/lib/js/playeractions/handlers/processplayerconfig.d.ts +1 -1
- package/lib/js/playeractions/handlers/processplayerconfig.js +1 -1
- package/lib/js/playeractions/handlers/processplayerconfig.test.js +1 -1
- package/lib/js/playeractions/handlers/processsourceconfig.d.ts +11 -2
- package/lib/js/playeractions/handlers/processsourceconfig.js +35 -18
- package/lib/js/playeractions/handlers/removereplayclass.d.ts +1 -1
- package/lib/js/playeractions/handlers/removereplayclass.js +1 -1
- package/lib/js/playeractions/handlers/removereplayclass.test.js +1 -1
- package/lib/js/settings/localization.d.ts +1 -0
- package/lib/js/utilities/utilities.jwt.d.ts +2 -0
- package/lib/js/utilities/utilities.jwt.js +22 -0
- package/lib/js/utilities/utilities.stream.js +11 -2
- package/lib/js/utilities/utilities.url.js +2 -2
- package/lib/js/utilities/utilities.version.js +1 -1
- package/lib/js/utilities/utilities.version.test.js +1 -1
- package/lib/lang/nl.json +2 -1
- package/lib/npoplayer.d.ts +6 -5
- package/lib/npoplayer.js +81 -28
- package/lib/package.json +7 -9
- package/lib/services/a11y/setup.test.js +2 -4
- package/lib/services/advertHandlers/handlePreRolls.js +3 -4
- package/lib/services/advertHandlers/handlePrerolls.test.js +2 -3
- package/lib/services/chapterHandlers/chapterHandler.d.ts +35 -0
- package/lib/services/chapterHandlers/chapterHandler.js +230 -0
- package/lib/services/errors/errorBackground.test.js +1 -1
- package/lib/services/errors/errorHandler.d.ts +4 -2
- package/lib/services/errors/errorHandler.js +27 -14
- package/lib/services/errors/errorHandler.test.js +148 -0
- package/lib/services/errors/errorRetryHandler.d.ts +2 -0
- package/lib/services/errors/errorRetryHandler.js +14 -0
- package/lib/services/errors/errorRetryHandler.test.d.ts +1 -0
- package/lib/services/errors/errorRetryHandler.test.js +62 -0
- package/lib/services/errors/errorText.js +8 -5
- package/lib/services/errors/errorText.test.js +3 -3
- package/lib/services/infoPanel/infoPanel.d.ts +3 -0
- package/lib/services/infoPanel/infoPanel.js +35 -0
- package/lib/services/infoPanel/infoPanel.test.d.ts +1 -0
- package/lib/services/infoPanel/infoPanel.test.js +70 -0
- package/lib/services/keyboardHandlers/resolvekeypress.js +11 -1
- package/lib/services/keyboardHandlers/resolvekeypress.test.js +6 -2
- package/lib/services/nicamHandlers/nicamhandler.d.ts +1 -0
- package/lib/services/nicamHandlers/nicamhandler.js +2 -1
- package/lib/services/nicamHandlers/nicamhandler.test.js +2 -2
- package/lib/services/npoPlayerAPI/npoPlayerAPI.d.ts +8 -2
- package/lib/services/npoPlayerAPI/npoPlayerAPI.js +25 -12
- package/lib/services/npoPlayerAPI/playerModules.d.ts +1 -0
- package/lib/services/npoPlayerAPI/playerModules.js +46 -0
- package/lib/services/preferences/handlePreferences.js +9 -4
- package/lib/services/preferences/handlePreferences.test.js +53 -17
- package/lib/services/segmentHandlers/addSegmentEventListeners.test.js +1 -1
- package/lib/services/segmentHandlers/isSegmentInBounds.d.ts +2 -0
- package/lib/services/segmentHandlers/isSegmentInBounds.js +5 -0
- package/lib/services/segmentHandlers/isSegmentInBounds.test.d.ts +1 -0
- package/lib/services/segmentHandlers/isSegmentInBounds.test.js +27 -0
- package/lib/services/services.d.ts +5 -2
- package/lib/services/services.js +15 -2
- package/lib/services/streamFetchHandler/fetchStream.js +5 -4
- package/lib/services/streamFetchHandler/fetchstream.test.js +25 -3
- package/lib/services/streamoptionsHandlers/streamOptionsHandler.js +11 -9
- package/lib/services/streamoptionsHandlers/streamOptionsHandler.test.js +14 -2
- package/lib/services/trackingHandlers/eventBinding.js +48 -33
- package/lib/services/trackingHandlers/eventBinding.test.js +57 -1
- package/lib/services/trackingHandlers/playerTrackerStart.js +1 -1
- package/lib/services/uiHandlers/uiVisiblityHandler.js +6 -0
- package/lib/services/verticalVideoHandlers/handleVerticalVideoSettings.test.js +0 -9
- package/lib/src/js/markers/updateLiveMarkers.d.ts +7 -2
- package/lib/src/js/playeractions/handlers/mediasessionactions.d.ts +7 -2
- package/lib/src/js/playeractions/handlers/processplayerconfig.d.ts +1 -1
- package/lib/src/js/playeractions/handlers/processsourceconfig.d.ts +11 -2
- package/lib/src/js/playeractions/handlers/removereplayclass.d.ts +1 -1
- package/lib/src/js/settings/localization.d.ts +1 -0
- package/lib/src/js/utilities/utilities.jwt.d.ts +2 -0
- package/lib/src/npoplayer.d.ts +6 -5
- package/lib/src/services/chapterHandlers/chapterHandler.d.ts +35 -0
- package/lib/src/services/errors/errorHandler.d.ts +4 -2
- package/lib/src/services/errors/errorRetryHandler.d.ts +2 -0
- package/lib/src/services/errors/errorRetryHandler.test.d.ts +1 -0
- package/lib/src/services/infoPanel/infoPanel.d.ts +3 -0
- package/lib/src/services/infoPanel/infoPanel.test.d.ts +1 -0
- package/lib/src/services/nicamHandlers/nicamhandler.d.ts +1 -0
- package/lib/src/services/npoPlayerAPI/npoPlayerAPI.d.ts +8 -2
- package/lib/src/services/npoPlayerAPI/playerModules.d.ts +1 -0
- package/lib/src/services/segmentHandlers/isSegmentInBounds.d.ts +2 -0
- package/lib/src/services/segmentHandlers/isSegmentInBounds.test.d.ts +1 -0
- package/lib/src/services/services.d.ts +5 -2
- package/lib/src/types/events.d.ts +1 -1
- package/lib/src/types/interfaces.d.ts +39 -43
- package/lib/src/ui/components/adbutton.d.ts +3 -6
- package/lib/src/ui/components/adlabel.d.ts +3 -6
- package/lib/src/ui/components/audio/controlbar.d.ts +2 -2
- package/lib/src/ui/components/buttons.d.ts +18 -11
- package/lib/src/ui/components/ctabar.d.ts +4 -10
- package/lib/src/ui/components/infopanel/infopanel.d.ts +3 -0
- package/lib/src/ui/components/infopanel/togglebutton.d.ts +3 -0
- package/lib/src/ui/components/playnext.d.ts +3 -9
- package/lib/src/ui/components/seekbar.d.ts +2 -3
- package/lib/src/ui/components/settingspanel.d.ts +2 -3
- package/lib/src/ui/components/titlebar.d.ts +2 -2
- package/lib/src/ui/handlers/domhandlers.d.ts +2 -2
- package/lib/src/ui/handlers/listboxhandlers.d.ts +18 -4
- package/lib/src/ui/handlers/playnextscreen.d.ts +6 -2
- package/lib/src/ui/uicontainer.d.ts +1 -2
- package/lib/tests/jest.setup-files-after-env.d.ts +0 -0
- package/lib/tests/jest.setup-files-after-env.js +6 -0
- package/lib/tests/jest.setup-tests.d.ts +1 -0
- package/lib/tests/jest.setup-tests.js +2 -0
- package/lib/tests/mocks/mockNpoplayer.js +27 -44
- package/lib/tests/mocks/mockPlayerAPI.d.ts +1 -1
- package/lib/tests/mocks/mockPlayerAPI.js +15 -1
- package/lib/tests/mocks/mockPlayerUi.d.ts +64 -0
- package/lib/tests/mocks/mockPlayerUi.js +251 -0
- package/lib/tests/mocks/playerContextMock.d.ts +3 -66
- package/lib/tests/mocks/playerContextMock.js +34 -7
- package/lib/types/events.d.ts +1 -1
- package/lib/types/events.js +1 -1
- package/lib/types/interfaces.d.ts +39 -43
- package/lib/types/interfaces.js +0 -27
- package/lib/ui/components/adbutton.d.ts +3 -6
- package/lib/ui/components/adbutton.js +2 -1
- package/lib/ui/components/adlabel.d.ts +3 -6
- package/lib/ui/components/adlabel.js +2 -1
- package/lib/ui/components/audio/controlbar.d.ts +2 -2
- package/lib/ui/components/audio/controlbar.js +6 -6
- package/lib/ui/components/buttons.d.ts +18 -11
- package/lib/ui/components/buttons.js +44 -26
- package/lib/ui/components/controlbar.js +13 -9
- package/lib/ui/components/ctabar.d.ts +4 -10
- package/lib/ui/components/ctabar.js +8 -7
- package/lib/ui/components/infopanel/infopanel.d.ts +3 -0
- package/lib/ui/components/infopanel/infopanel.js +40 -0
- package/lib/ui/components/infopanel/togglebutton.d.ts +3 -0
- package/lib/ui/components/infopanel/togglebutton.js +18 -0
- package/lib/ui/components/playnext.d.ts +3 -9
- package/lib/ui/components/playnext.js +3 -3
- package/lib/ui/components/seekbar.d.ts +2 -3
- package/lib/ui/components/seekbar.js +7 -3
- package/lib/ui/components/settingspanel.d.ts +2 -3
- package/lib/ui/components/settingspanel.js +79 -53
- package/lib/ui/components/titlebar.d.ts +2 -2
- package/lib/ui/components/titlebar.js +2 -1
- package/lib/ui/components/topbar.js +8 -5
- package/lib/ui/components/verticalvideo/controlbar.js +5 -2
- package/lib/ui/components/verticalvideo/settingspanel.js +9 -5
- package/lib/ui/handlers/accessibilityhandler.js +11 -22
- package/lib/ui/handlers/accessibilityhandler.test.js +25 -34
- package/lib/ui/handlers/domhandlers.d.ts +2 -2
- package/lib/ui/handlers/listboxhandlers.d.ts +18 -4
- package/lib/ui/handlers/listboxhandlers.js +5 -3
- package/lib/ui/handlers/playnextscreen.d.ts +6 -2
- package/lib/ui/handlers/playnextscreen.js +4 -4
- package/lib/ui/handlers/playnextscreen.test.js +15 -3
- package/lib/ui/uicontainer.d.ts +1 -2
- package/lib/ui/uicontainer.js +24 -8
- package/lib/ui/uicontainer.test.js +6 -5
- package/package.json +7 -9
- package/src/style/components/_advert.scss +0 -4
- package/src/style/components/_buffering.scss +18 -22
- package/src/style/components/_controlbars.scss +0 -4
- package/src/style/components/_icons.scss +18 -4
- package/src/style/components/_infopanel.scss +99 -0
- package/src/style/components/_nicam.scss +6 -2
- package/src/style/components/_seekbarthumbnail.scss +5 -0
- package/src/style/components/_settingspanel.scss +1 -1
- package/src/style/components/_subtitles.scss +0 -1
- package/src/style/components/_textbuttons.scss +30 -1
- package/src/style/components/_volumeslider.scss +0 -1
- package/src/style/components/audio/_bottombar.scss +6 -0
- package/src/style/components/audio/_metadata.scss +25 -9
- package/src/style/components/audio/_topbar.scss +6 -1
- package/src/style/npoplayer.css +166 -83
- package/src/style/npoplayer.scss +10 -2
- package/src/style/variants/_player-audio-only.scss +32 -0
- package/src/style/variants/_player-base.scss +5 -1
- package/src/style/variants/_player-large.scss +3 -3
- package/src/style/variants/_player-medium.scss +5 -1
- package/src/style/variants/_player-small.scss +6 -1
- package/src/style/vars/_colors.scss +1 -1
- package/src/style/vars/_icons.scss +5 -4
- package/src/style/vars/_z-index.scss +1 -1
- package/lib/npoplayer-bridge.test.js +0 -24
- package/lib/src/ui/components/nativemobile/buttons.d.ts +0 -30
- package/lib/src/ui/components/nativemobile/controlbar.d.ts +0 -3
- package/lib/src/ui/components/nativemobile/ctabar.d.ts +0 -11
- package/lib/src/ui/components/nativemobile/titlebar.d.ts +0 -2
- package/lib/src/ui/components/nativemobile/topbar.d.ts +0 -3
- package/lib/src/ui/nativemobileuicontainer.d.ts +0 -5
- package/lib/src/ui/nativemobileuifactory.d.ts +0 -3
- package/lib/src/ui/nativemobileuifactory.test.d.ts +0 -1
- package/lib/ui/components/nativemobile/buttons.d.ts +0 -30
- package/lib/ui/components/nativemobile/buttons.js +0 -233
- package/lib/ui/components/nativemobile/controlbar.d.ts +0 -3
- package/lib/ui/components/nativemobile/controlbar.js +0 -43
- package/lib/ui/components/nativemobile/ctabar.d.ts +0 -11
- package/lib/ui/components/nativemobile/ctabar.js +0 -10
- package/lib/ui/components/nativemobile/titlebar.d.ts +0 -2
- package/lib/ui/components/nativemobile/titlebar.js +0 -7
- package/lib/ui/components/nativemobile/topbar.d.ts +0 -3
- package/lib/ui/components/nativemobile/topbar.js +0 -23
- package/lib/ui/nativemobileuicontainer.d.ts +0 -5
- package/lib/ui/nativemobileuicontainer.js +0 -42
- package/lib/ui/nativemobileuifactory.d.ts +0 -3
- package/lib/ui/nativemobileuifactory.js +0 -112
- package/lib/ui/nativemobileuifactory.test.d.ts +0 -1
- package/lib/ui/nativemobileuifactory.test.js +0 -64
- package/src/style/variants/_player-native-mobile.scss +0 -13
- /package/lib/{npoplayer-bridge.test.d.ts → services/errors/errorHandler.test.d.ts} +0 -0
- /package/lib/src/{npoplayer-bridge.test.d.ts → services/errors/errorHandler.test.d.ts} +0 -0
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { ControlBar, Container, PlaybackTimeLabel, PlaybackTimeLabelMode, SeekBar, SeekBarLabel, Spacer } from 'bitmovin-player-ui';
|
|
2
|
-
import { createForwardButton, createRewindButton, createAirPlayToggleButton, createCastToggleButton, createFullscreenToggleButton, createPictureInPictureToggleButton, createPlaybackToggleButton, createSettingsButton, createVolumeToggleButton } from './buttons';
|
|
3
|
-
import { createSettingsPanel } from '../settingspanel';
|
|
4
|
-
export function createControlBar(player) {
|
|
5
|
-
const rewindButton = createRewindButton(player);
|
|
6
|
-
const forwardButton = createForwardButton(player);
|
|
7
|
-
const settingsPanel = createSettingsPanel(player);
|
|
8
|
-
return new ControlBar({
|
|
9
|
-
components: [
|
|
10
|
-
new Container({
|
|
11
|
-
components: [
|
|
12
|
-
new PlaybackTimeLabel({
|
|
13
|
-
timeLabelMode: PlaybackTimeLabelMode.CurrentTime,
|
|
14
|
-
hideInLivePlayback: true,
|
|
15
|
-
cssClasses: ['current-time']
|
|
16
|
-
}),
|
|
17
|
-
new SeekBar({ label: new SeekBarLabel() }),
|
|
18
|
-
new PlaybackTimeLabel({
|
|
19
|
-
timeLabelMode: PlaybackTimeLabelMode.TotalTime,
|
|
20
|
-
cssClasses: ['total-time']
|
|
21
|
-
})
|
|
22
|
-
],
|
|
23
|
-
cssClasses: ['controlbar-top']
|
|
24
|
-
}),
|
|
25
|
-
new Container({
|
|
26
|
-
components: [
|
|
27
|
-
createPlaybackToggleButton(),
|
|
28
|
-
createVolumeToggleButton(player),
|
|
29
|
-
rewindButton,
|
|
30
|
-
forwardButton,
|
|
31
|
-
new Spacer(),
|
|
32
|
-
createPictureInPictureToggleButton(player),
|
|
33
|
-
createAirPlayToggleButton(),
|
|
34
|
-
createCastToggleButton(),
|
|
35
|
-
createSettingsButton(settingsPanel),
|
|
36
|
-
settingsPanel,
|
|
37
|
-
createFullscreenToggleButton(player)
|
|
38
|
-
],
|
|
39
|
-
cssClasses: ['controlbar-bottom']
|
|
40
|
-
})
|
|
41
|
-
]
|
|
42
|
-
});
|
|
43
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Container } from 'bitmovin-player-ui';
|
|
2
|
-
import { type PlayerAPI } from 'bitmovin-player';
|
|
3
|
-
export declare function createCTABar(player: PlayerAPI): Container<{
|
|
4
|
-
components: import("bitmovin-player-ui").Button<{
|
|
5
|
-
cssClass: string;
|
|
6
|
-
text: string;
|
|
7
|
-
ariaLabel: string;
|
|
8
|
-
hidden: true;
|
|
9
|
-
}>[];
|
|
10
|
-
cssClasses: string[];
|
|
11
|
-
}>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Container } from 'bitmovin-player-ui';
|
|
2
|
-
import { createWatchFromStartButton, createGoBackLiveButton } from './buttons';
|
|
3
|
-
export function createCTABar(player) {
|
|
4
|
-
const goBackLiveButton = createGoBackLiveButton(player);
|
|
5
|
-
const watchFromStartButton = createWatchFromStartButton();
|
|
6
|
-
return new Container({
|
|
7
|
-
components: [watchFromStartButton, goBackLiveButton],
|
|
8
|
-
cssClasses: ['controlbar-textbuttons']
|
|
9
|
-
});
|
|
10
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Label, TitleBar } from 'bitmovin-player-ui';
|
|
2
|
-
export function createTitleBar() {
|
|
3
|
-
const nicam = new Label({ text: '', cssClass: 'nicam' });
|
|
4
|
-
const titleBar = new TitleBar({ cssClasses: ['metadata'] });
|
|
5
|
-
titleBar.addComponent(nicam);
|
|
6
|
-
return titleBar;
|
|
7
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Container, TitleBar } from 'bitmovin-player-ui';
|
|
2
|
-
import { createAirPlayToggleButton, createCastToggleButton, createFullscreenToggleButton, createPictureInPictureToggleButton, createSettingsButton, createVolumeToggleButton } from './buttons';
|
|
3
|
-
import { createSettingsPanel } from '../settingspanel';
|
|
4
|
-
export function createTopBar(player) {
|
|
5
|
-
const settingsPanel = createSettingsPanel(player);
|
|
6
|
-
return new TitleBar({
|
|
7
|
-
components: [
|
|
8
|
-
new Container({
|
|
9
|
-
components: [
|
|
10
|
-
createAirPlayToggleButton(),
|
|
11
|
-
createCastToggleButton(),
|
|
12
|
-
createSettingsButton(settingsPanel),
|
|
13
|
-
settingsPanel,
|
|
14
|
-
createPictureInPictureToggleButton(player),
|
|
15
|
-
createVolumeToggleButton(player),
|
|
16
|
-
createFullscreenToggleButton(player)
|
|
17
|
-
],
|
|
18
|
-
cssClasses: ['controlbar-top', 'controlbar-small']
|
|
19
|
-
})
|
|
20
|
-
],
|
|
21
|
-
cssClasses: ['titlebar-small']
|
|
22
|
-
});
|
|
23
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { UIContainer } from 'bitmovin-player-ui';
|
|
2
|
-
import { PlayerAPI } from 'bitmovin-player';
|
|
3
|
-
import { CustomMessageHandlerInterface, CustomMessages } from '../types/interfaces';
|
|
4
|
-
export declare function sendCustomMessage(message: CustomMessages, data?: CustomMessageHandlerInterface): CustomMessageHandlerInterface;
|
|
5
|
-
export declare function nativeMobileUIContainer(player: PlayerAPI): UIContainer;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { BufferingOverlay, CastStatusOverlay, ErrorMessageOverlay, PlaybackToggleOverlay, PlayerUtils, SubtitleOverlay, UIContainer } from 'bitmovin-player-ui';
|
|
2
|
-
import { createCTABar } from './components/nativemobile/ctabar';
|
|
3
|
-
import { createControlBar } from './components/nativemobile/controlbar';
|
|
4
|
-
import { createTopBar } from './components/nativemobile/topbar';
|
|
5
|
-
import { createMiddleButtons } from './components/nativemobile/buttons';
|
|
6
|
-
import { createTitleBar } from './components/nativemobile/titlebar';
|
|
7
|
-
const defaultData = {
|
|
8
|
-
defaultActionRequired: true
|
|
9
|
-
};
|
|
10
|
-
export function sendCustomMessage(message, data) {
|
|
11
|
-
try {
|
|
12
|
-
return data === undefined
|
|
13
|
-
? JSON.parse(window.bitmovin.customMessageHandler.sendSynchronous(message))
|
|
14
|
-
: JSON.parse(window.bitmovin.customMessageHandler.sendSynchronous(message, JSON.stringify(data)));
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
return defaultData;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export function nativeMobileUIContainer(player) {
|
|
21
|
-
const middleButtons = createMiddleButtons(player);
|
|
22
|
-
const ctaBar = createCTABar(player);
|
|
23
|
-
const topBar = createTopBar(player);
|
|
24
|
-
const controlBar = createControlBar(player);
|
|
25
|
-
const errorMessageOverlay = new ErrorMessageOverlay();
|
|
26
|
-
return new UIContainer({
|
|
27
|
-
components: [
|
|
28
|
-
new SubtitleOverlay(),
|
|
29
|
-
new BufferingOverlay(),
|
|
30
|
-
new PlaybackToggleOverlay(),
|
|
31
|
-
new CastStatusOverlay(),
|
|
32
|
-
middleButtons,
|
|
33
|
-
controlBar,
|
|
34
|
-
ctaBar,
|
|
35
|
-
topBar,
|
|
36
|
-
createTitleBar(),
|
|
37
|
-
errorMessageOverlay
|
|
38
|
-
],
|
|
39
|
-
cssClasses: ['npo-player', 'native-mobile'],
|
|
40
|
-
hidePlayerStateExceptions: [PlayerUtils.PlayerState.Paused, PlayerUtils.PlayerState.Finished]
|
|
41
|
-
});
|
|
42
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { PlayerEvent } from 'bitmovin-player';
|
|
2
|
-
import { UIManager } from 'bitmovin-player-ui';
|
|
3
|
-
import { customSpecificErrorMessageOverlayConfig } from '../services/errors/errorText';
|
|
4
|
-
import { localizationConfig } from '../js/settings/localization';
|
|
5
|
-
import { nativeMobileUIContainer, sendCustomMessage } from './nativemobileuicontainer';
|
|
6
|
-
import { CustomMessages } from '../types/interfaces';
|
|
7
|
-
import { getElementByQuery } from '../js/utilities/utilities.element';
|
|
8
|
-
import { handleLiveStreamNoDvr } from './handlers/domhandlers';
|
|
9
|
-
import { removeReplayClass } from '../js/playeractions/handlers/removereplayclass';
|
|
10
|
-
import { processNicam } from '../services/nicamHandlers/nicamhandler';
|
|
11
|
-
let adBreakActive = false;
|
|
12
|
-
export function nativeMobileUiFactory(player, config = {}) {
|
|
13
|
-
UIManager.setLocalizationConfig(localizationConfig);
|
|
14
|
-
const nicamClass = '.bmpui-nicam';
|
|
15
|
-
const uiConfig = {
|
|
16
|
-
...config,
|
|
17
|
-
errorMessages: customSpecificErrorMessageOverlayConfig,
|
|
18
|
-
disableAutoHideWhenHovered: true
|
|
19
|
-
};
|
|
20
|
-
const mobileUIManager = new UIManager(player, nativeMobileUIContainer(player), uiConfig);
|
|
21
|
-
let _webData = {};
|
|
22
|
-
const removeFinishedClass = () => {
|
|
23
|
-
player.off(PlayerEvent.Seek, removeFinishedClass);
|
|
24
|
-
removeReplayClass(player);
|
|
25
|
-
};
|
|
26
|
-
const updateUI = () => {
|
|
27
|
-
const seekbarTitleElement = getElementByQuery({
|
|
28
|
-
container: player.getContainer(),
|
|
29
|
-
query: '.bmpui-seekbar-label-title'
|
|
30
|
-
});
|
|
31
|
-
if (_webData.assets.preroll) {
|
|
32
|
-
adBreakActive = true;
|
|
33
|
-
player.on(PlayerEvent.AdBreakFinished, setAdBreakActiveToFalse);
|
|
34
|
-
player.on(PlayerEvent.AdError, setAdBreakActiveToFalse);
|
|
35
|
-
}
|
|
36
|
-
if (_webData.metadata?.ageRating || _webData.metadata?.nicam) {
|
|
37
|
-
const webDataPlayerContext = {
|
|
38
|
-
npoPlayer: {
|
|
39
|
-
streamObject: {
|
|
40
|
-
metadata: {
|
|
41
|
-
ageRating: _webData.metadata.ageRating,
|
|
42
|
-
nicam: _webData.metadata.nicam
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const nicamElement = getElementByQuery({ container: player.getContainer(), query: nicamClass });
|
|
48
|
-
processNicam(webDataPlayerContext, nicamElement);
|
|
49
|
-
}
|
|
50
|
-
if (seekbarTitleElement)
|
|
51
|
-
seekbarTitleElement.textContent = _webData.title || '';
|
|
52
|
-
handleLiveStreamNoDvr(player, _webData);
|
|
53
|
-
};
|
|
54
|
-
const setAdBreakActiveToFalse = () => {
|
|
55
|
-
adBreakActive = false;
|
|
56
|
-
player.off(PlayerEvent.AdBreakFinished, setAdBreakActiveToFalse);
|
|
57
|
-
player.off(PlayerEvent.AdError, setAdBreakActiveToFalse);
|
|
58
|
-
};
|
|
59
|
-
if (window.bitmovin?.customMessageHandler) {
|
|
60
|
-
const handleData = (data) => {
|
|
61
|
-
if (data) {
|
|
62
|
-
const newData = JSON.parse(data);
|
|
63
|
-
if (data !== _webData.toString()) {
|
|
64
|
-
_webData = newData;
|
|
65
|
-
updateUI();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
window.bitmovin.customMessageHandler.on(CustomMessages.SET_STREAM_LINK, handleData);
|
|
70
|
-
window.bitmovin.customMessageHandler.on(CustomMessages.SET_WEB_DATA, handleData);
|
|
71
|
-
window.bitmovin.customMessageHandler.on(CustomMessages.DO_ERROR, (data) => {
|
|
72
|
-
if (!data)
|
|
73
|
-
return;
|
|
74
|
-
const messageData = JSON.parse(data);
|
|
75
|
-
if (messageData.errorMessage) {
|
|
76
|
-
doError(messageData.errorMessage);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
const addEventListeners = () => {
|
|
81
|
-
player.off(PlayerEvent.Ready, addEventListeners);
|
|
82
|
-
sendCustomMessage(CustomMessages.JAVASCRIPT_READY);
|
|
83
|
-
};
|
|
84
|
-
const doError = (data) => {
|
|
85
|
-
window.bitmovin.customMessageHandler.off(CustomMessages.DO_ERROR, data.toString());
|
|
86
|
-
const input = data.input;
|
|
87
|
-
if (input) {
|
|
88
|
-
const uiComponents = mobileUIManager.activeUi.getUI().getComponents();
|
|
89
|
-
const errorMessageOverlay = uiComponents.find((component) => component.getConfig().cssClass === 'ui-errormessage-overlay');
|
|
90
|
-
if (!errorMessageOverlay)
|
|
91
|
-
return;
|
|
92
|
-
try {
|
|
93
|
-
errorMessageOverlay.display(input);
|
|
94
|
-
}
|
|
95
|
-
catch {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
const onPlayerError = (event) => {
|
|
101
|
-
player.off(PlayerEvent.Error, (event) => {
|
|
102
|
-
onPlayerError(event);
|
|
103
|
-
});
|
|
104
|
-
sendCustomMessage(CustomMessages.ERROR_TRIGGERED, { error: event });
|
|
105
|
-
};
|
|
106
|
-
player.on(PlayerEvent.Seek, removeFinishedClass);
|
|
107
|
-
player.on(PlayerEvent.Ready, addEventListeners);
|
|
108
|
-
player.on(PlayerEvent.Error, (event) => {
|
|
109
|
-
onPlayerError(event);
|
|
110
|
-
});
|
|
111
|
-
return mobileUIManager;
|
|
112
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { nativeMobileUiFactory } from './nativemobileuifactory';
|
|
2
|
-
import { CustomMessages } from '../types/interfaces';
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
4
|
-
const title = 'Test Stream';
|
|
5
|
-
let storedCallbacks = {};
|
|
6
|
-
jest.mock('bitmovin-player-ui', () => {
|
|
7
|
-
return jest.requireActual('../../tests/mocks/mockPlayerUi').mockPlayerUi;
|
|
8
|
-
});
|
|
9
|
-
describe('nativeMobileUiFactory', () => {
|
|
10
|
-
let mockPlayer;
|
|
11
|
-
let containerElement;
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
containerElement = document.createElement('div');
|
|
14
|
-
const wrapperElement = document.createElement('div');
|
|
15
|
-
wrapperElement.className = 'bmpui-npo-player';
|
|
16
|
-
containerElement.appendChild(wrapperElement);
|
|
17
|
-
const seekbarTitleElement = document.createElement('div');
|
|
18
|
-
seekbarTitleElement.className = 'bmpui-seekbar-label-title';
|
|
19
|
-
wrapperElement.appendChild(seekbarTitleElement);
|
|
20
|
-
const nicamElement = document.createElement('div');
|
|
21
|
-
nicamElement.className = 'bmpui-nicam';
|
|
22
|
-
wrapperElement.appendChild(nicamElement);
|
|
23
|
-
mockPlayer = {
|
|
24
|
-
on: jest.fn(),
|
|
25
|
-
off: jest.fn(),
|
|
26
|
-
getContainer: () => containerElement,
|
|
27
|
-
getVolume: jest.fn().mockReturnValue(50),
|
|
28
|
-
getAvailableVideoQualities: jest.fn()
|
|
29
|
-
};
|
|
30
|
-
storedCallbacks = {};
|
|
31
|
-
if (storedCallbacks) {
|
|
32
|
-
;
|
|
33
|
-
window.bitmovin = window.bitmovin || {};
|
|
34
|
-
window.bitmovin.customMessageHandler = {
|
|
35
|
-
on: jest.fn((messageType, callbackFn) => {
|
|
36
|
-
storedCallbacks[messageType] = callbackFn;
|
|
37
|
-
})
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
nativeMobileUiFactory(mockPlayer);
|
|
41
|
-
});
|
|
42
|
-
test('should update the DOM correctly when sendSynchronous is called with setstreamlink', () => {
|
|
43
|
-
const mockData = {
|
|
44
|
-
title: title,
|
|
45
|
-
stream: {
|
|
46
|
-
isLiveStream: true,
|
|
47
|
-
hasDvrWindow: false
|
|
48
|
-
},
|
|
49
|
-
assets: {
|
|
50
|
-
preroll: undefined
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
if (storedCallbacks[CustomMessages.SET_STREAM_LINK]) {
|
|
54
|
-
storedCallbacks[CustomMessages.SET_STREAM_LINK](JSON.stringify(mockData));
|
|
55
|
-
}
|
|
56
|
-
const container = mockPlayer.getContainer();
|
|
57
|
-
expect(container.querySelector('.bmpui-seekbar-label-title')?.textContent).toBe(title);
|
|
58
|
-
expect(container.querySelector('.bmpui-npo-player')?.classList.contains('livestream-no-dvr')).toBeTruthy();
|
|
59
|
-
});
|
|
60
|
-
afterEach(() => {
|
|
61
|
-
jest.clearAllMocks();
|
|
62
|
-
document.body.innerHTML = '';
|
|
63
|
-
});
|
|
64
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
.bmpui-npo-player.bmpui-native-mobile {
|
|
2
|
-
.bmpui-seekbar-playbackposition-marker {
|
|
3
|
-
margin-top: -1px;
|
|
4
|
-
}
|
|
5
|
-
.bmpui-overlay-playnext {
|
|
6
|
-
background-color: none;
|
|
7
|
-
bottom: 25%;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.bmpui-ui-subtitle-label span {
|
|
11
|
-
font-size: 1em !important;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
File without changes
|
|
File without changes
|