@npo/player 1.25.0 → 1.26.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 +1 -1
- package/lib/js/api/getstreamobject.d.ts +1 -1
- package/lib/js/api/getstreamobject.js +4 -4
- package/lib/js/api/getstreamobject.test.js +12 -12
- package/lib/js/playeractions/handlers/handleoffsets.js +9 -7
- package/lib/js/playeractions/handlers/handleoffsets.test.js +1 -1
- package/lib/js/playeractions/handlers/processplayerconfig.d.ts +1 -1
- package/lib/js/playeractions/handlers/processplayerconfig.js +4 -4
- package/lib/js/playeractions/handlers/processsourceconfig.d.ts +1 -0
- package/lib/js/playeractions/handlers/processsourceconfig.js +4 -5
- package/lib/js/playeractions/handlers/processsourceconfig.test.js +25 -0
- package/lib/js/tracking/handlers/playertrackerstart.js +1 -1
- package/lib/lang/nl.json +1 -1
- package/lib/lang/subtitleLabels/nl.json +14 -0
- package/lib/npoplayer.d.ts +2 -3
- package/lib/npoplayer.js +24 -32
- package/lib/npoplayer.test.js +1 -1
- package/lib/package.json +2 -2
- package/lib/services/a11y/setup.js +2 -5
- package/lib/services/a11y/setup.test.js +2 -19
- package/lib/services/advertHandlers/discardAdBreak.js +4 -4
- package/lib/services/advertHandlers/discardAdBreak.test.js +25 -13
- package/lib/services/advertHandlers/handlePreRolls.js +19 -19
- package/lib/services/advertHandlers/handlePrerolls.test.js +4 -4
- package/lib/services/drmHandlers/decideprofile.js +1 -1
- package/lib/services/drmHandlers/decideprofile.test.js +1 -1
- package/lib/services/drmHandlers/verifydrm.js +6 -6
- package/lib/services/drmHandlers/verifydrm.test.js +5 -5
- package/lib/services/eventListenerHandlers/removeEventListeners.js +2 -2
- package/lib/services/eventListenerHandlers/removeEventListeners.test.js +9 -9
- package/lib/services/keyboardHandlers/resolvekeypress.js +5 -5
- package/lib/services/keyboardHandlers/resolvekeypress.test.js +1 -1
- package/lib/services/liveStreamHandlers/handleLiveStreamControls.js +2 -2
- package/lib/services/liveStreamHandlers/handleLiveStreamControls.test.js +2 -2
- package/lib/services/localStorageHandlers/localStorageHandlers.js +2 -2
- package/lib/services/localStorageHandlers/localStorageHandlers.test.js +2 -5
- package/lib/services/nicamHandlers/nicamhandler.d.ts +1 -2
- package/lib/services/nicamHandlers/nicamhandler.js +17 -16
- package/lib/services/nicamHandlers/nicamhandler.test.js +72 -9
- package/lib/services/npoPlayerAPI/npoPlayerAPI.d.ts +2 -2
- package/lib/services/npoPlayerAPI/npoPlayerAPI.js +16 -23
- package/lib/services/preferences/handlePreferences.d.ts +2 -0
- package/lib/services/preferences/handlePreferences.js +42 -0
- package/lib/services/preferences/handlePreferences.test.js +102 -0
- package/lib/services/segmentHandlers/addSegmentEventListeners.js +2 -2
- package/lib/services/segmentHandlers/addSegmentEventListeners.test.js +1 -1
- package/lib/services/services.d.ts +6 -2
- package/lib/services/services.js +21 -2
- package/lib/services/streamoptionsHandlers/{steamOptionsHandler.js → streamOptionsHandler.js} +11 -11
- package/lib/services/streamoptionsHandlers/streamOptionsHandler.test.js +20 -20
- package/lib/services/uiHandlers/uiVisiblityHandler.d.ts +3 -0
- package/lib/services/uiHandlers/uiVisiblityHandler.js +26 -0
- package/lib/services/uiHandlers/uiVisiblityHandler.test.d.ts +1 -0
- package/lib/services/uiHandlers/uiVisiblityHandler.test.js +62 -0
- package/lib/src/js/api/getstreamobject.d.ts +1 -1
- package/lib/src/js/playeractions/handlers/processplayerconfig.d.ts +1 -1
- package/lib/src/js/playeractions/handlers/processsourceconfig.d.ts +1 -0
- package/lib/src/js/playeractions/handlers/processsourceconfig.test.d.ts +1 -0
- package/lib/src/npoplayer.d.ts +2 -3
- package/lib/src/services/nicamHandlers/nicamhandler.d.ts +1 -2
- package/lib/src/services/npoPlayerAPI/npoPlayerAPI.d.ts +2 -2
- package/lib/src/services/preferences/handlePreferences.d.ts +2 -0
- package/lib/src/services/preferences/handlePreferences.test.d.ts +1 -0
- package/lib/src/services/services.d.ts +6 -2
- package/lib/src/services/uiHandlers/uiVisiblityHandler.d.ts +3 -0
- package/lib/src/services/uiHandlers/uiVisiblityHandler.test.d.ts +1 -0
- package/lib/src/types/classes.d.ts +6 -0
- package/lib/src/types/interfaces.d.ts +24 -3
- package/lib/src/ui/components/adbutton.d.ts +1 -1
- package/lib/src/ui/components/adlabel.d.ts +1 -1
- package/lib/src/ui/components/buttons.d.ts +6 -16
- package/lib/src/ui/components/controlbar.d.ts +2 -2
- package/lib/src/ui/components/ctabar.d.ts +1 -1
- package/lib/src/ui/components/playnext.d.ts +1 -4
- package/lib/src/ui/components/seekbar.d.ts +1 -1
- package/lib/src/ui/components/titlebar.d.ts +1 -1
- package/lib/src/ui/handlers/playnextscreen.test.d.ts +1 -0
- package/lib/src/ui/uicontainer.test.d.ts +1 -0
- package/lib/tests/mocks/mockLogEmitter.d.ts +2 -0
- package/lib/tests/mocks/mockLogEmitter.js +20 -0
- package/lib/tests/mocks/mockNpoplayer.js +1 -2
- package/lib/tests/mocks/playerContextMock.d.ts +5 -3
- package/lib/tests/mocks/playerContextMock.js +7 -5
- package/lib/types/classes.d.ts +6 -0
- package/lib/types/classes.js +12 -0
- package/lib/types/interfaces.d.ts +24 -3
- package/lib/types/interfaces.js +1 -0
- package/lib/ui/components/adbutton.d.ts +1 -1
- package/lib/ui/components/adbutton.js +3 -3
- package/lib/ui/components/adlabel.d.ts +1 -1
- package/lib/ui/components/adlabel.js +3 -3
- package/lib/ui/components/buttons.d.ts +6 -16
- package/lib/ui/components/buttons.js +27 -10
- package/lib/ui/components/controlbar.d.ts +2 -2
- package/lib/ui/components/controlbar.js +20 -37
- package/lib/ui/components/ctabar.d.ts +1 -1
- package/lib/ui/components/ctabar.js +4 -4
- package/lib/ui/components/nativemobile/topbar.js +2 -2
- package/lib/ui/components/playnext.d.ts +1 -4
- package/lib/ui/components/playnext.js +3 -3
- package/lib/ui/components/seekbar.d.ts +1 -1
- package/lib/ui/components/seekbar.js +5 -3
- package/lib/ui/components/settingspanel.js +9 -9
- package/lib/ui/components/titlebar.d.ts +1 -1
- package/lib/ui/components/titlebar.js +2 -2
- package/lib/ui/components/topbar.js +6 -20
- package/lib/ui/components/verticalvideo/controlbar.js +1 -1
- package/lib/ui/handlers/playnextscreen.test.d.ts +1 -0
- package/lib/ui/nativemobileuifactory.js +1 -1
- package/lib/ui/nativemobileuifactory.test.js +2 -1
- package/lib/ui/uicontainer.js +11 -30
- package/lib/ui/uicontainer.test.d.ts +1 -0
- package/lib/ui/uicontainer.test.js +80 -0
- package/package.json +2 -2
- package/src/style/components/_advert.scss +0 -9
- package/src/style/components/_nicam.scss +5 -4
- package/src/style/components/_settingspanel.scss +48 -17
- package/src/style/components/vertical-video/_settingspanel.scss +1 -1
- package/src/style/npoplayer.css +25 -20
- package/src/style/variants/_player-base.scss +4 -0
- package/src/style/variants/_player-large.scss +5 -1
- package/src/style/variants/_player-small.scss +11 -8
- /package/lib/{src/ui/handlers/playnextstreen.test.d.ts → js/playeractions/handlers/processsourceconfig.test.d.ts} +0 -0
- /package/lib/{ui/handlers/playnextstreen.test.d.ts → services/preferences/handlePreferences.test.d.ts} +0 -0
- /package/lib/services/streamoptionsHandlers/{steamOptionsHandler.d.ts → streamOptionsHandler.d.ts} +0 -0
- /package/lib/src/services/streamoptionsHandlers/{steamOptionsHandler.d.ts → streamOptionsHandler.d.ts} +0 -0
- /package/lib/ui/handlers/{playnextstreen.test.js → playnextscreen.test.js} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { UIManager } from 'bitmovin-player-ui';
|
|
2
2
|
import { customSpecificErrorMessageOverlayConfig } from '../../js/playeractions/handlers/customerrors';
|
|
3
|
-
import { handleStreamOptions } from '../streamoptionsHandlers/steamOptionsHandler';
|
|
4
3
|
import { createUIContainer } from '../../ui/uicontainer';
|
|
5
4
|
import { playerEventMap } from '../../types/events';
|
|
6
5
|
import { VOLUME_MAX, VOLUME_MIN, VOLUME_STEP } from './contants';
|
|
@@ -46,23 +45,17 @@ export class NpoPlayerAPI {
|
|
|
46
45
|
return this.playerAPI.getViewMode();
|
|
47
46
|
}
|
|
48
47
|
areSubtitlesEnabled() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return subsEnabled;
|
|
48
|
+
return this.playerAPI.subtitles.list().some((subtitle) => subtitle.enabled);
|
|
49
|
+
}
|
|
50
|
+
getCurrentSubtitle() {
|
|
51
|
+
const currentSubtitle = this.playerAPI.subtitles.list().find((subtitle) => subtitle.enabled);
|
|
52
|
+
return currentSubtitle ? currentSubtitle.lang : undefined;
|
|
58
53
|
}
|
|
59
|
-
enableSubtitles() {
|
|
54
|
+
enableSubtitles(selectedLang = 'nl') {
|
|
60
55
|
const subtitleTracks = this.playerAPI.subtitles.list();
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
56
|
+
const subtitleToEnable = subtitleTracks.find((subtitle) => subtitle.lang === selectedLang);
|
|
57
|
+
if (subtitleToEnable && !subtitleToEnable.enabled) {
|
|
58
|
+
this.playerAPI.subtitles.enable(subtitleToEnable.id);
|
|
66
59
|
}
|
|
67
60
|
}
|
|
68
61
|
isPaused() {
|
|
@@ -138,22 +131,22 @@ export class NpoPlayerAPI {
|
|
|
138
131
|
getActiveAdBreak() {
|
|
139
132
|
return this.playerAPI.ads.getActiveAdBreak();
|
|
140
133
|
}
|
|
141
|
-
discardAdBreak(adBreakId) {
|
|
142
|
-
return this.playerAPI.ads.discardAdBreak(adBreakId);
|
|
143
|
-
}
|
|
144
134
|
getConfig(mergedConfig) {
|
|
145
135
|
return this.playerAPI.getConfig(mergedConfig);
|
|
146
136
|
}
|
|
147
137
|
async createUIManager(playerContext, variant) {
|
|
148
|
-
|
|
138
|
+
const { npoPlayerServices } = playerContext.npoPlayer;
|
|
139
|
+
npoPlayerServices.removeUivisiblityHandlers(playerContext);
|
|
140
|
+
if (playerContext.npoPlayer.uiManager === undefined || variant !== playerContext.npoPlayer.variant) {
|
|
149
141
|
const uiConfig = {
|
|
150
142
|
errorMessages: customSpecificErrorMessageOverlayConfig,
|
|
151
143
|
disableAutoHideWhenHovered: true,
|
|
152
144
|
seekbarSnappingEnabled: false
|
|
153
145
|
};
|
|
154
|
-
playerContext.
|
|
155
|
-
playerContext.
|
|
146
|
+
playerContext.npoPlayer.variant = variant;
|
|
147
|
+
const uiManager = new UIManager(this.playerAPI, createUIContainer(playerContext, this.playerAPI, variant), uiConfig);
|
|
148
|
+
playerContext.npoPlayer.uiManager = uiManager;
|
|
149
|
+
npoPlayerServices.addUivisiblityHandlers(playerContext);
|
|
156
150
|
}
|
|
157
|
-
handleStreamOptions(playerContext);
|
|
158
151
|
}
|
|
159
152
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { NpoPlayerEvent } from '../../types/events';
|
|
2
|
+
import { LocalStorageValues } from '../../types/interfaces';
|
|
3
|
+
export function handlePreferences(playerContext) {
|
|
4
|
+
const { player, npoPlayer } = playerContext;
|
|
5
|
+
const { npoPlayerServices } = npoPlayer;
|
|
6
|
+
const handleSourceLoaded = () => {
|
|
7
|
+
const storedUserPrefs = npoPlayerServices.getStoredUserPrefs();
|
|
8
|
+
const subtitlesEnabledInPrefs = storedUserPrefs?.subtitles_enabled === 'true';
|
|
9
|
+
const preferredSubtitleLang = storedUserPrefs?.subtitles_language?.toString();
|
|
10
|
+
const shouldEnableSubtitles = npoPlayer.streamOptions.enableSubtitles || subtitlesEnabledInPrefs;
|
|
11
|
+
if (shouldEnableSubtitles) {
|
|
12
|
+
player.enableSubtitles(preferredSubtitleLang);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const handleSubtitleEnabled = () => {
|
|
16
|
+
const currentSubtitleTrack = player.playerAPI.subtitles.list();
|
|
17
|
+
const enabledSubtitle = currentSubtitleTrack.find((subtitle) => subtitle.enabled);
|
|
18
|
+
if (enabledSubtitle) {
|
|
19
|
+
npoPlayerServices.setStoredUserPrefs(LocalStorageValues.SUBTITLES_LANGUAGE, enabledSubtitle.lang);
|
|
20
|
+
npoPlayerServices.setStoredUserPrefs(LocalStorageValues.SUBTITLES_ENABLED, 'true');
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const handleSubtitleDisabled = () => {
|
|
24
|
+
npoPlayerServices.setStoredUserPrefs(LocalStorageValues.SUBTITLES_ENABLED, 'false');
|
|
25
|
+
};
|
|
26
|
+
const handleVolumeChanged = () => {
|
|
27
|
+
const volume = player.getVolume();
|
|
28
|
+
npoPlayerServices.setStoredUserPrefs(LocalStorageValues.VOLUME, volume);
|
|
29
|
+
};
|
|
30
|
+
const handleMuted = () => {
|
|
31
|
+
npoPlayerServices.setStoredUserPrefs(LocalStorageValues.IS_MUTED, 'true');
|
|
32
|
+
};
|
|
33
|
+
const handleUnmuted = () => {
|
|
34
|
+
npoPlayerServices.setStoredUserPrefs(LocalStorageValues.IS_MUTED, 'false');
|
|
35
|
+
};
|
|
36
|
+
player.on(NpoPlayerEvent.SourceLoaded, handleSourceLoaded);
|
|
37
|
+
player.on(NpoPlayerEvent.SubtitleEnabled, handleSubtitleEnabled);
|
|
38
|
+
player.on(NpoPlayerEvent.SubtitleDisabled, handleSubtitleDisabled);
|
|
39
|
+
player.on(NpoPlayerEvent.VolumeChanged, handleVolumeChanged);
|
|
40
|
+
player.on(NpoPlayerEvent.Muted, handleMuted);
|
|
41
|
+
player.on(NpoPlayerEvent.Unmuted, handleUnmuted);
|
|
42
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import createPlayerContextMock, { createMockNpoPlayer, createMockNpoPlayerAPI } from '../../../tests/mocks/playerContextMock';
|
|
2
|
+
import { handlePreferences } from './handlePreferences';
|
|
3
|
+
import { NpoPlayerEvent } from '../../types/events';
|
|
4
|
+
import { LocalStorageValues } from '../../types/interfaces';
|
|
5
|
+
describe('handlePreferences', () => {
|
|
6
|
+
let mockPlayerAPI;
|
|
7
|
+
let mockNpoPlayer;
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
mockPlayerAPI = createMockNpoPlayerAPI({
|
|
10
|
+
getVolume: jest.fn().mockReturnValue(50),
|
|
11
|
+
on: jest.fn(),
|
|
12
|
+
enableSubtitles: jest.fn(),
|
|
13
|
+
playerAPI: {
|
|
14
|
+
subtitles: {
|
|
15
|
+
list: jest.fn()
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
mockNpoPlayer = createMockNpoPlayer({
|
|
20
|
+
streamOptions: {
|
|
21
|
+
enableSubtitles: false
|
|
22
|
+
},
|
|
23
|
+
npoPlayerServices: {
|
|
24
|
+
getStoredUserPrefs: jest.fn().mockReturnValue({
|
|
25
|
+
subtitles_enabled: 'false',
|
|
26
|
+
subtitles_language: 'nl'
|
|
27
|
+
}),
|
|
28
|
+
setStoredUserPrefs: jest.fn()
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const playerContextMock = createPlayerContextMock({
|
|
32
|
+
player: mockPlayerAPI,
|
|
33
|
+
npoPlayer: mockNpoPlayer
|
|
34
|
+
});
|
|
35
|
+
handlePreferences(playerContextMock);
|
|
36
|
+
});
|
|
37
|
+
test('should enable subtitles if streamOptions.enableSubtitles is true', () => {
|
|
38
|
+
mockNpoPlayer.streamOptions.enableSubtitles = true;
|
|
39
|
+
for (const [event, callback] of mockPlayerAPI.on.mock.calls) {
|
|
40
|
+
if (event === NpoPlayerEvent.SourceLoaded) {
|
|
41
|
+
callback(NpoPlayerEvent.SourceLoaded);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
expect(mockPlayerAPI.enableSubtitles).toHaveBeenCalledWith('nl');
|
|
45
|
+
});
|
|
46
|
+
test('should enable subtitles if subtitles_enabled in preferences is true', () => {
|
|
47
|
+
mockNpoPlayer.streamOptions.enableSubtitles = false;
|
|
48
|
+
mockNpoPlayer.npoPlayerServices.getStoredUserPrefs.mockReturnValueOnce({
|
|
49
|
+
subtitles_enabled: 'true',
|
|
50
|
+
subtitles_language: 'nl'
|
|
51
|
+
});
|
|
52
|
+
for (const [event, callback] of mockPlayerAPI.on.mock.calls) {
|
|
53
|
+
if (event === NpoPlayerEvent.SourceLoaded) {
|
|
54
|
+
callback(NpoPlayerEvent.SourceLoaded);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
expect(mockPlayerAPI.enableSubtitles).toHaveBeenCalledWith('nl');
|
|
58
|
+
});
|
|
59
|
+
test('should disable subtitles and set the preferences', () => {
|
|
60
|
+
;
|
|
61
|
+
mockPlayerAPI.playerAPI.subtitles.list.mockReturnValueOnce([{ lang: 'nl', enabled: true }]);
|
|
62
|
+
for (const [event, callback] of mockPlayerAPI.on.mock.calls) {
|
|
63
|
+
if (event === NpoPlayerEvent.SubtitleEnabled) {
|
|
64
|
+
callback(NpoPlayerEvent.SubtitleEnable);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
expect(mockNpoPlayer.npoPlayerServices.setStoredUserPrefs).toHaveBeenCalledWith(LocalStorageValues.SUBTITLES_LANGUAGE, 'nl');
|
|
68
|
+
expect(mockNpoPlayer.npoPlayerServices.setStoredUserPrefs).toHaveBeenCalledWith(LocalStorageValues.SUBTITLES_ENABLED, 'true');
|
|
69
|
+
});
|
|
70
|
+
test('should disable subtitles and set preferences to false', () => {
|
|
71
|
+
for (const [event, callback] of mockPlayerAPI.on.mock.calls) {
|
|
72
|
+
if (event === NpoPlayerEvent.SubtitleDisabled) {
|
|
73
|
+
callback(NpoPlayerEvent.SubtitleDisabled);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
expect(mockNpoPlayer.npoPlayerServices.setStoredUserPrefs).toHaveBeenCalledWith(LocalStorageValues.SUBTITLES_ENABLED, 'false');
|
|
77
|
+
});
|
|
78
|
+
test('should set volume preferences', () => {
|
|
79
|
+
for (const [event, callback] of mockPlayerAPI.on.mock.calls) {
|
|
80
|
+
if (event === NpoPlayerEvent.VolumeChanged) {
|
|
81
|
+
callback(NpoPlayerEvent.VolumeChanged);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
expect(mockNpoPlayer.npoPlayerServices.setStoredUserPrefs).toHaveBeenCalledWith(LocalStorageValues.VOLUME, 50);
|
|
85
|
+
});
|
|
86
|
+
test('should set muted preferences', () => {
|
|
87
|
+
for (const [event, callback] of mockPlayerAPI.on.mock.calls) {
|
|
88
|
+
if (event === NpoPlayerEvent.Muted) {
|
|
89
|
+
callback(NpoPlayerEvent.Muted);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
expect(mockNpoPlayer.npoPlayerServices.setStoredUserPrefs).toHaveBeenCalledWith(LocalStorageValues.IS_MUTED, 'true');
|
|
93
|
+
});
|
|
94
|
+
test('should set unmuted preferences', () => {
|
|
95
|
+
for (const [event, callback] of mockPlayerAPI.on.mock.calls) {
|
|
96
|
+
if (event === NpoPlayerEvent.Unmuted) {
|
|
97
|
+
callback(NpoPlayerEvent.Unmuted);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
expect(mockNpoPlayer.npoPlayerServices.setStoredUserPrefs).toHaveBeenCalledWith(LocalStorageValues.IS_MUTED, 'false');
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -4,10 +4,10 @@ import { handleSegmentSeek } from './handleSegmentSeek';
|
|
|
4
4
|
export const addSegmentEventListeners = (playerContext, segment) => {
|
|
5
5
|
const segmentHandleTimeChangedCallback = handleSegmentTimeChanged(playerContext, segment);
|
|
6
6
|
const segmentSeekFunctionCallback = handleSegmentSeek(playerContext, segment);
|
|
7
|
-
const { player,
|
|
7
|
+
const { player, npoPlayer } = playerContext;
|
|
8
8
|
player.on(NpoPlayerEvent.TimeChanged, segmentHandleTimeChangedCallback);
|
|
9
9
|
player.on(NpoPlayerEvent.Seek, segmentSeekFunctionCallback);
|
|
10
|
-
|
|
10
|
+
npoPlayer.eventListeners = {
|
|
11
11
|
segmentHandleTimeChangedCallback,
|
|
12
12
|
segmentSeekFunctionCallback
|
|
13
13
|
};
|
|
@@ -36,7 +36,7 @@ describe('addSegmentEventListeners', () => {
|
|
|
36
36
|
handleSegmentTimeChanged.mockReturnValue(segmentHandleTimeChangedCallback);
|
|
37
37
|
handleSegmentSeek.mockReturnValue(segmentSeekFunctionCallback);
|
|
38
38
|
addSegmentEventListeners(mockPlayerContext, segment);
|
|
39
|
-
expect(mockPlayerContext.
|
|
39
|
+
expect(mockPlayerContext.npoPlayer.eventListeners).toEqual({
|
|
40
40
|
segmentHandleTimeChangedCallback,
|
|
41
41
|
segmentSeekFunctionCallback
|
|
42
42
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ApiPayload, Fragment, PlayerContext, Profile, Segment, TimeLineMarker, LocalStorageData, LocalStorageValues, NpoPlayerUIVariants } from '../types/interfaces';
|
|
2
2
|
import { AVType } from '@npotag/tag/dist/types/src/streamTracker';
|
|
3
|
-
import { UIManager } from 'bitmovin-player-ui';
|
|
4
3
|
export declare class NpoPlayerServices {
|
|
5
4
|
getAVType(avType: string): AVType;
|
|
6
5
|
keyboardHandler(playerContext: PlayerContext, e: KeyboardEvent): void;
|
|
@@ -13,7 +12,12 @@ export declare class NpoPlayerServices {
|
|
|
13
12
|
handleUserPrefs(playerContext: PlayerContext): void;
|
|
14
13
|
setAccessibilityAttributes(playerContext: PlayerContext): void;
|
|
15
14
|
schedulePreRolls(playerContext: PlayerContext): Promise<void>;
|
|
15
|
+
discardAdBreak(playerContext: PlayerContext): void;
|
|
16
16
|
handleVerticalVideoControls(playerContext: PlayerContext, variant: NpoPlayerUIVariants): void;
|
|
17
|
-
showNicamAfterUiDelay(playerContext: PlayerContext | undefined
|
|
17
|
+
showNicamAfterUiDelay(playerContext: PlayerContext | undefined): void;
|
|
18
18
|
setupNicamKijkwijzerIcons(playerContext: PlayerContext): void;
|
|
19
|
+
handlePreferences(playerContext: PlayerContext): void;
|
|
20
|
+
addUivisiblityHandlers(playerContext: PlayerContext): void;
|
|
21
|
+
removeUivisiblityHandlers(playerContext: PlayerContext): void;
|
|
22
|
+
handleStreamOptions(playerContext: PlayerContext): void;
|
|
19
23
|
}
|
package/lib/services/services.js
CHANGED
|
@@ -8,6 +8,10 @@ import { getAVType } from './avTypeHandlers/getAVType';
|
|
|
8
8
|
import { handlePreRolls } from './advertHandlers/handlePreRolls';
|
|
9
9
|
import { handleVerticalVideoControls } from './verticalVideoHandlers/handleVerticalVideoControls';
|
|
10
10
|
import { setupNicamKijkwijzerIcons, showNicamAfterUiDelay } from './nicamHandlers/nicamhandler';
|
|
11
|
+
import { handlePreferences } from './preferences/handlePreferences';
|
|
12
|
+
import { addUivisiblityHandlers, removeUivisiblityHandlers } from './uiHandlers/uiVisiblityHandler';
|
|
13
|
+
import { discardAdBreak } from './advertHandlers/discardAdBreak';
|
|
14
|
+
import { handleStreamOptions } from './streamoptionsHandlers/streamOptionsHandler';
|
|
11
15
|
export class NpoPlayerServices {
|
|
12
16
|
getAVType(avType) {
|
|
13
17
|
return getAVType(avType);
|
|
@@ -50,13 +54,28 @@ export class NpoPlayerServices {
|
|
|
50
54
|
async schedulePreRolls(playerContext) {
|
|
51
55
|
await handlePreRolls(playerContext);
|
|
52
56
|
}
|
|
57
|
+
discardAdBreak(playerContext) {
|
|
58
|
+
discardAdBreak(playerContext);
|
|
59
|
+
}
|
|
53
60
|
handleVerticalVideoControls(playerContext, variant) {
|
|
54
61
|
return handleVerticalVideoControls(playerContext, variant);
|
|
55
62
|
}
|
|
56
|
-
showNicamAfterUiDelay(playerContext
|
|
57
|
-
return showNicamAfterUiDelay(playerContext
|
|
63
|
+
showNicamAfterUiDelay(playerContext) {
|
|
64
|
+
return showNicamAfterUiDelay(playerContext);
|
|
58
65
|
}
|
|
59
66
|
setupNicamKijkwijzerIcons(playerContext) {
|
|
60
67
|
return setupNicamKijkwijzerIcons(playerContext);
|
|
61
68
|
}
|
|
69
|
+
handlePreferences(playerContext) {
|
|
70
|
+
handlePreferences(playerContext);
|
|
71
|
+
}
|
|
72
|
+
addUivisiblityHandlers(playerContext) {
|
|
73
|
+
addUivisiblityHandlers(playerContext);
|
|
74
|
+
}
|
|
75
|
+
removeUivisiblityHandlers(playerContext) {
|
|
76
|
+
removeUivisiblityHandlers(playerContext);
|
|
77
|
+
}
|
|
78
|
+
handleStreamOptions(playerContext) {
|
|
79
|
+
handleStreamOptions(playerContext);
|
|
80
|
+
}
|
|
62
81
|
}
|
package/lib/services/streamoptionsHandlers/{steamOptionsHandler.js → streamOptionsHandler.js}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as playerAction from '../../js/playeractions/playeractions';
|
|
2
|
-
import { initSegment } from '
|
|
3
|
-
import { handleLiveStreamControls } from '
|
|
4
|
-
import { removeEventListeners } from '
|
|
2
|
+
import { initSegment } from '../segmentHandlers/initSegment';
|
|
3
|
+
import { handleLiveStreamControls } from '../liveStreamHandlers/handleLiveStreamControls';
|
|
4
|
+
import { removeEventListeners } from '../eventListenerHandlers/removeEventListeners';
|
|
5
5
|
import { NpoPlayerEvent } from '../../types/events';
|
|
6
6
|
import { updateClassFromElementByQuery } from '../../js/utilities/utilities.element';
|
|
7
7
|
export function handleStreamOptions(playerContext) {
|
|
8
|
-
const { streamObject, uiManager } = playerContext.
|
|
8
|
+
const { streamObject, uiManager } = playerContext.npoPlayer;
|
|
9
9
|
if (!streamObject || !uiManager)
|
|
10
10
|
return;
|
|
11
11
|
removeEventListeners(playerContext);
|
|
@@ -18,20 +18,20 @@ export function handleStreamOptions(playerContext) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
export function initializeFragment(playerContext) {
|
|
21
|
-
const { streamObject, streamOptions } = playerContext.
|
|
21
|
+
const { streamObject, streamOptions } = playerContext.npoPlayer;
|
|
22
22
|
initSegment(playerContext, {
|
|
23
23
|
segment: streamObject.segment,
|
|
24
24
|
fragment: streamOptions?.fragments
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
export function handleStartOffset(playerContext) {
|
|
28
|
-
const streamOptions = playerContext.
|
|
28
|
+
const streamOptions = playerContext.npoPlayer.streamOptions;
|
|
29
29
|
if (streamOptions?.startOffset) {
|
|
30
30
|
playerAction.handleStartOffset(playerContext, streamOptions.startOffset);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
export function updateStreamClasses(playerContext) {
|
|
34
|
-
const { streamObject, container } = playerContext.
|
|
34
|
+
const { streamObject, container } = playerContext.npoPlayer;
|
|
35
35
|
const containerClassString = '.bmpui-ui-uicontainer';
|
|
36
36
|
const playerContainer = container;
|
|
37
37
|
const queries = [
|
|
@@ -61,18 +61,18 @@ export function updateStreamClasses(playerContext) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
function getAutoplayStatus(playerContext) {
|
|
64
|
-
return (playerContext.
|
|
64
|
+
return (playerContext.npoPlayer.streamOptions?.autoplay ?? playerContext.player.getConfig()?.playback?.autoplay ?? false);
|
|
65
65
|
}
|
|
66
66
|
export function setupAutoplay(playerContext) {
|
|
67
|
-
const player = playerContext
|
|
67
|
+
const { player } = playerContext;
|
|
68
68
|
const handleAutoPlay = () => {
|
|
69
69
|
doAutoPlay().catch((error) => {
|
|
70
70
|
console.error('Error attempting to autoplay:', error);
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
73
|
const doAutoPlay = async () => {
|
|
74
|
-
player.off(NpoPlayerEvent.
|
|
74
|
+
player.off(NpoPlayerEvent.Ready, handleAutoPlay);
|
|
75
75
|
await player.play();
|
|
76
76
|
};
|
|
77
|
-
player.on(NpoPlayerEvent.
|
|
77
|
+
player.on(NpoPlayerEvent.Ready, handleAutoPlay);
|
|
78
78
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { handleStreamOptions, initializeFragment, handleStartOffset, updateStreamClasses, setupAutoplay } from './
|
|
1
|
+
import { handleStreamOptions, initializeFragment, handleStartOffset, updateStreamClasses, setupAutoplay } from './streamOptionsHandler';
|
|
2
2
|
import '@testing-library/jest-dom';
|
|
3
3
|
import { createMockNpoPlayer, createPlayerContextMock, createMockNpoPlayerAPI } from '../../../tests/mocks/playerContextMock';
|
|
4
4
|
import * as playerAction from '../../js/playeractions/playeractions';
|
|
@@ -25,7 +25,7 @@ describe('handleStreamOptions', () => {
|
|
|
25
25
|
on: jest.fn(),
|
|
26
26
|
off: jest.fn()
|
|
27
27
|
});
|
|
28
|
-
const
|
|
28
|
+
const npoPlayerMock = createMockNpoPlayer({
|
|
29
29
|
playerconfig: {
|
|
30
30
|
playback: {
|
|
31
31
|
muted: false,
|
|
@@ -40,7 +40,7 @@ describe('handleStreamOptions', () => {
|
|
|
40
40
|
});
|
|
41
41
|
const playerContextMock = createPlayerContextMock({
|
|
42
42
|
player: mockNpoPlayerAPI,
|
|
43
|
-
|
|
43
|
+
npoPlayer: npoPlayerMock
|
|
44
44
|
});
|
|
45
45
|
handleStreamOptions(playerContextMock);
|
|
46
46
|
expect(initializeFragment(playerContextMock)).toHaveBeenCalled;
|
|
@@ -49,27 +49,27 @@ describe('handleStreamOptions', () => {
|
|
|
49
49
|
expect(setupAutoplay(playerContextMock)).toHaveBeenCalled;
|
|
50
50
|
});
|
|
51
51
|
it('should return early if uiManager is missing', () => {
|
|
52
|
-
const
|
|
52
|
+
const npoPlayerMock = createMockNpoPlayer({
|
|
53
53
|
UIManager: null
|
|
54
54
|
});
|
|
55
55
|
const playerContextMock = createPlayerContextMock({
|
|
56
|
-
|
|
56
|
+
npoPlayer: npoPlayerMock
|
|
57
57
|
});
|
|
58
58
|
handleStreamOptions(playerContextMock);
|
|
59
59
|
expect(removeEventListeners).not.toHaveBeenCalled();
|
|
60
60
|
});
|
|
61
61
|
it('should return early if streamObject is missing', () => {
|
|
62
|
-
const
|
|
62
|
+
const npoPlayerMock = createMockNpoPlayer({
|
|
63
63
|
streamObject: null
|
|
64
64
|
});
|
|
65
65
|
const playerContextMock = createPlayerContextMock({
|
|
66
|
-
|
|
66
|
+
npoPlayer: npoPlayerMock
|
|
67
67
|
});
|
|
68
68
|
handleStreamOptions(playerContextMock);
|
|
69
69
|
expect(removeEventListeners).not.toHaveBeenCalled();
|
|
70
70
|
});
|
|
71
71
|
it('should return early if autoplay is false', () => {
|
|
72
|
-
const
|
|
72
|
+
const npoPlayerMock = createMockNpoPlayer({
|
|
73
73
|
playerconfig: {
|
|
74
74
|
playback: {
|
|
75
75
|
muted: false,
|
|
@@ -81,7 +81,7 @@ describe('handleStreamOptions', () => {
|
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
const playerContextMock = createPlayerContextMock({
|
|
84
|
-
|
|
84
|
+
npoPlayer: npoPlayerMock
|
|
85
85
|
});
|
|
86
86
|
const setupAutoplayMock = jest.fn();
|
|
87
87
|
handleStreamOptions(playerContextMock);
|
|
@@ -89,7 +89,7 @@ describe('handleStreamOptions', () => {
|
|
|
89
89
|
});
|
|
90
90
|
describe('updateStreamClasses', () => {
|
|
91
91
|
it('should add "livestream-no-dvr" class when isLiveStream is true and hasDvrWindow is false', () => {
|
|
92
|
-
const
|
|
92
|
+
const npoPlayerMock = createMockNpoPlayer({
|
|
93
93
|
streamObject: {
|
|
94
94
|
stream: {
|
|
95
95
|
isLiveStream: true,
|
|
@@ -98,7 +98,7 @@ describe('handleStreamOptions', () => {
|
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
const playerContextMock = createPlayerContextMock({
|
|
101
|
-
|
|
101
|
+
npoPlayer: npoPlayerMock
|
|
102
102
|
});
|
|
103
103
|
updateStreamClasses(playerContextMock);
|
|
104
104
|
expect(updateClassFromElementByQuery).toHaveBeenCalledWith(expect.objectContaining({
|
|
@@ -107,7 +107,7 @@ describe('handleStreamOptions', () => {
|
|
|
107
107
|
}));
|
|
108
108
|
});
|
|
109
109
|
it('should add "audio-only" class when avType is "aod" or "audio"', () => {
|
|
110
|
-
const
|
|
110
|
+
const npoPlayerMock = createMockNpoPlayer({
|
|
111
111
|
streamObject: {
|
|
112
112
|
stream: {
|
|
113
113
|
avType: 'aod'
|
|
@@ -115,7 +115,7 @@ describe('handleStreamOptions', () => {
|
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
const playerContextMock = createPlayerContextMock({
|
|
118
|
-
|
|
118
|
+
npoPlayer: npoPlayerMock
|
|
119
119
|
});
|
|
120
120
|
updateStreamClasses(playerContextMock);
|
|
121
121
|
expect(updateClassFromElementByQuery).toHaveBeenCalledWith(expect.objectContaining({
|
|
@@ -124,7 +124,7 @@ describe('handleStreamOptions', () => {
|
|
|
124
124
|
}));
|
|
125
125
|
});
|
|
126
126
|
it('should call handleLiveStreamControls when isLiveStream is true and hasDvrWindow is true', () => {
|
|
127
|
-
const
|
|
127
|
+
const npoPlayerMock = createMockNpoPlayer({
|
|
128
128
|
streamObject: {
|
|
129
129
|
stream: {
|
|
130
130
|
isLiveStream: true,
|
|
@@ -133,7 +133,7 @@ describe('handleStreamOptions', () => {
|
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
const playerContextMock = createPlayerContextMock({
|
|
136
|
-
|
|
136
|
+
npoPlayer: npoPlayerMock
|
|
137
137
|
});
|
|
138
138
|
updateStreamClasses(playerContextMock);
|
|
139
139
|
expect(handleLiveStreamControls).toHaveBeenCalledWith(playerContextMock);
|
|
@@ -141,12 +141,12 @@ describe('handleStreamOptions', () => {
|
|
|
141
141
|
});
|
|
142
142
|
describe('initializeFragment', () => {
|
|
143
143
|
it('should call initSegment with correct parameters', () => {
|
|
144
|
-
const
|
|
144
|
+
const npoPlayerMock = createMockNpoPlayer({
|
|
145
145
|
streamObject: { segment: 'segment' },
|
|
146
146
|
streamOptions: { fragments: { sections: [{ duration: 10, time: 0 }] } }
|
|
147
147
|
});
|
|
148
148
|
const playerContextMock = createPlayerContextMock({
|
|
149
|
-
|
|
149
|
+
npoPlayer: npoPlayerMock
|
|
150
150
|
});
|
|
151
151
|
initializeFragment(playerContextMock);
|
|
152
152
|
expect(initSegment).toHaveBeenCalledWith(playerContextMock, {
|
|
@@ -157,11 +157,11 @@ describe('handleStreamOptions', () => {
|
|
|
157
157
|
});
|
|
158
158
|
describe('handleStartOffset', () => {
|
|
159
159
|
it('should call handleStartOffset with correct parameters', () => {
|
|
160
|
-
const
|
|
160
|
+
const npoPlayerMock = createMockNpoPlayer({
|
|
161
161
|
streamOptions: { startOffset: 10 }
|
|
162
162
|
});
|
|
163
163
|
const playerContextMock = createPlayerContextMock({
|
|
164
|
-
|
|
164
|
+
npoPlayer: npoPlayerMock
|
|
165
165
|
});
|
|
166
166
|
handleStartOffset(playerContextMock);
|
|
167
167
|
expect(playerAction.handleStartOffset).toHaveBeenCalledWith(playerContextMock, 10);
|
|
@@ -178,7 +178,7 @@ describe('handleStreamOptions', () => {
|
|
|
178
178
|
player: mockNpoPlayerAPI
|
|
179
179
|
});
|
|
180
180
|
setupAutoplay(playerContextMock);
|
|
181
|
-
expect(playerContextMock.player.on).toHaveBeenCalledWith(NpoPlayerEvent.
|
|
181
|
+
expect(playerContextMock.player.on).toHaveBeenCalledWith(NpoPlayerEvent.Ready, expect.any(Function));
|
|
182
182
|
const handleAutoPlay = playerContextMock.player.on.mock.calls[0][1];
|
|
183
183
|
await handleAutoPlay();
|
|
184
184
|
expect(playerContextMock.player.play).toHaveBeenCalled();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NpoPlayerUIVariants } from '../../types/interfaces';
|
|
2
|
+
export function addUivisiblityHandlers(playerContext) {
|
|
3
|
+
const { uiManager, variant } = playerContext.npoPlayer;
|
|
4
|
+
if (!uiManager)
|
|
5
|
+
return;
|
|
6
|
+
if (variant === NpoPlayerUIVariants.DEFAULT) {
|
|
7
|
+
uiManager.activeUi.onControlsHide.subscribe(() => {
|
|
8
|
+
playerContext.npoPlayer.logEmitter.emit('logControlsVisibilityChange', false);
|
|
9
|
+
});
|
|
10
|
+
uiManager.activeUi.onControlsShow.subscribe(() => {
|
|
11
|
+
playerContext.npoPlayer.logEmitter.emit('logControlsVisibilityChange', true);
|
|
12
|
+
});
|
|
13
|
+
uiManager.activeUi.getUI().showUi();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function removeUivisiblityHandlers(playerContext) {
|
|
17
|
+
const { uiManager } = playerContext.npoPlayer;
|
|
18
|
+
if (!uiManager)
|
|
19
|
+
return;
|
|
20
|
+
uiManager.activeUi.onControlsHide.unsubscribe(() => {
|
|
21
|
+
playerContext.npoPlayer.logEmitter.emit('logControlsVisibilityChange', false);
|
|
22
|
+
});
|
|
23
|
+
uiManager.activeUi.onControlsShow.unsubscribe(() => {
|
|
24
|
+
playerContext.npoPlayer.logEmitter.emit('logControlsVisibilityChange', true);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import createPlayerContextMock from '../../../tests/mocks/playerContextMock';
|
|
2
|
+
import { addUivisiblityHandlers, removeUivisiblityHandlers } from './uiVisiblityHandler';
|
|
3
|
+
import { NpoPlayerUIVariants } from '../../types/interfaces';
|
|
4
|
+
import { createLogEmitterMock } from '../../../tests/mocks/mockLogEmitter';
|
|
5
|
+
describe('UI Visibility Handlers', () => {
|
|
6
|
+
let mockPlayerContext;
|
|
7
|
+
let mockLogEmitter;
|
|
8
|
+
let mockUIManager;
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
mockLogEmitter = createLogEmitterMock();
|
|
11
|
+
mockUIManager = {
|
|
12
|
+
activeUi: {
|
|
13
|
+
onControlsHide: { subscribe: jest.fn(), unsubscribe: jest.fn() },
|
|
14
|
+
onControlsShow: { subscribe: jest.fn(), unsubscribe: jest.fn() },
|
|
15
|
+
getUI: jest.fn().mockReturnValue({ showUi: jest.fn() })
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
mockPlayerContext = createPlayerContextMock();
|
|
19
|
+
mockPlayerContext.npoPlayer.logEmitter = mockLogEmitter;
|
|
20
|
+
mockPlayerContext.npoPlayer.uiManager = mockUIManager;
|
|
21
|
+
mockPlayerContext.npoPlayer.variant = NpoPlayerUIVariants.DEFAULT;
|
|
22
|
+
});
|
|
23
|
+
describe('addUivisiblityHandlers', () => {
|
|
24
|
+
it('should subscribe to visibility handlers and call showUi', () => {
|
|
25
|
+
addUivisiblityHandlers(mockPlayerContext);
|
|
26
|
+
expect(mockUIManager.activeUi.onControlsHide.subscribe).toHaveBeenCalled();
|
|
27
|
+
expect(mockUIManager.activeUi.onControlsShow.subscribe).toHaveBeenCalled();
|
|
28
|
+
expect(mockUIManager.activeUi.getUI().showUi).toHaveBeenCalled();
|
|
29
|
+
});
|
|
30
|
+
it('should emit logControlsVisibilityChange when controls are shown', () => {
|
|
31
|
+
addUivisiblityHandlers(mockPlayerContext);
|
|
32
|
+
const onControlsShowCallback = mockUIManager.activeUi.onControlsShow.subscribe.mock.calls[0][0];
|
|
33
|
+
onControlsShowCallback();
|
|
34
|
+
expect(mockLogEmitter.emit).toHaveBeenCalledWith('logControlsVisibilityChange', true);
|
|
35
|
+
});
|
|
36
|
+
it('should emit logControlsVisibilityChange when controls are hidden', () => {
|
|
37
|
+
addUivisiblityHandlers(mockPlayerContext);
|
|
38
|
+
const onControlsHideCallback = mockUIManager.activeUi.onControlsHide.subscribe.mock.calls[0][0];
|
|
39
|
+
onControlsHideCallback();
|
|
40
|
+
expect(mockLogEmitter.emit).toHaveBeenCalledWith('logControlsVisibilityChange', false);
|
|
41
|
+
});
|
|
42
|
+
it('should not do anything if uiManager is not defined', () => {
|
|
43
|
+
mockPlayerContext.npoPlayer.uiManager = undefined;
|
|
44
|
+
addUivisiblityHandlers(mockPlayerContext);
|
|
45
|
+
expect(mockLogEmitter.emit).not.toHaveBeenCalled();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe('removeUivisiblityHandlers', () => {
|
|
49
|
+
it('should unsubscribe from visibility handlers', () => {
|
|
50
|
+
addUivisiblityHandlers(mockPlayerContext);
|
|
51
|
+
removeUivisiblityHandlers(mockPlayerContext);
|
|
52
|
+
expect(mockUIManager.activeUi.onControlsHide.unsubscribe).toHaveBeenCalled();
|
|
53
|
+
expect(mockUIManager.activeUi.onControlsShow.unsubscribe).toHaveBeenCalled();
|
|
54
|
+
});
|
|
55
|
+
it('should not do anything if uiManager is not defined', () => {
|
|
56
|
+
mockPlayerContext.npoPlayer.uiManager = undefined;
|
|
57
|
+
removeUivisiblityHandlers(mockPlayerContext);
|
|
58
|
+
expect(mockUIManager.activeUi.onControlsHide.unsubscribe).not.toHaveBeenCalled();
|
|
59
|
+
expect(mockUIManager.activeUi.onControlsShow.unsubscribe).not.toHaveBeenCalled();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ApiPayload } from '../../types/interfaces';
|
|
2
2
|
import type NpoPlayer from '../../npoplayer';
|
|
3
|
-
export declare function getStreamObject(
|
|
3
|
+
export declare function getStreamObject(npoPlayer: NpoPlayer, payload: ApiPayload): Promise<any>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type PlayerConfig } from 'bitmovin-player';
|
|
2
2
|
import NpoPlayer from 'npoplayer';
|
|
3
|
-
export declare function processPlayerConfig(
|
|
3
|
+
export declare function processPlayerConfig(npoPlayer: NpoPlayer, playerConfig: PlayerConfig): PlayerConfig;
|
|
@@ -2,4 +2,5 @@ import { StreamObject, StreamOptions } from 'types/interfaces';
|
|
|
2
2
|
import { SourceConfig } from 'bitmovin-player';
|
|
3
3
|
import { NpoPlayerServices } from '../../../services/services';
|
|
4
4
|
import { NPOTag } from '@npotag/tag';
|
|
5
|
+
export declare const getSubtitleLabels: (data: any) => string;
|
|
5
6
|
export declare function processSourceConfig(npoPlayerServices: NpoPlayerServices, source: string, _sourceConfig: SourceConfig | undefined, _streamObject: StreamObject, drm: string | undefined, streamOptions: StreamOptions, version: string, npoTagInstance: NPOTag | undefined): Promise<SourceConfig>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|