@npo/player 1.9.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/CHANGELOG.md +3 -0
- package/LICENSE +15 -0
- package/README.md +281 -0
- package/lib/js/ads/ster.d.ts +4 -0
- package/lib/js/ads/ster.js +159 -0
- package/lib/js/ads/ster.js.map +1 -0
- package/lib/js/ads/ster.test.d.ts +1 -0
- package/lib/js/ads/ster.test.js +91 -0
- package/lib/js/ads/ster.test.js.map +1 -0
- package/lib/js/api/getstreamobject.d.ts +3 -0
- package/lib/js/api/getstreamobject.js +19 -0
- package/lib/js/api/getstreamobject.js.map +1 -0
- package/lib/js/cdnproviders.d.ts +1 -0
- package/lib/js/cdnproviders.js +13 -0
- package/lib/js/cdnproviders.js.map +1 -0
- package/lib/js/checks/safari.d.ts +1 -0
- package/lib/js/checks/safari.js +10 -0
- package/lib/js/checks/safari.js.map +1 -0
- package/lib/js/checks/safari.test.d.ts +1 -0
- package/lib/js/checks/safari.test.js +21 -0
- package/lib/js/checks/safari.test.js.map +1 -0
- package/lib/js/drm/verifydrm.d.ts +4 -0
- package/lib/js/drm/verifydrm.js +38 -0
- package/lib/js/drm/verifydrm.js.map +1 -0
- package/lib/js/drm/verifydrm.test.d.ts +1 -0
- package/lib/js/drm/verifydrm.test.js +18 -0
- package/lib/js/drm/verifydrm.test.js.map +1 -0
- package/lib/js/fragments/setfragments.d.ts +3 -0
- package/lib/js/fragments/setfragments.js +68 -0
- package/lib/js/fragments/setfragments.js.map +1 -0
- package/lib/js/playeractions/customerrors.test.d.ts +1 -0
- package/lib/js/playeractions/customerrors.test.js +52 -0
- package/lib/js/playeractions/customerrors.test.js.map +1 -0
- package/lib/js/playeractions/handlers/customerrors.d.ts +50 -0
- package/lib/js/playeractions/handlers/customerrors.js +154 -0
- package/lib/js/playeractions/handlers/customerrors.js.map +1 -0
- package/lib/js/playeractions/handlers/error.d.ts +3 -0
- package/lib/js/playeractions/handlers/error.js +23 -0
- package/lib/js/playeractions/handlers/error.js.map +1 -0
- package/lib/js/playeractions/handlers/error.test.d.ts +1 -0
- package/lib/js/playeractions/handlers/error.test.js +45 -0
- package/lib/js/playeractions/handlers/error.test.js.map +1 -0
- package/lib/js/playeractions/handlers/handleoffsets.d.ts +6 -0
- package/lib/js/playeractions/handlers/handleoffsets.js +71 -0
- package/lib/js/playeractions/handlers/handleoffsets.js.map +1 -0
- package/lib/js/playeractions/handlers/handleoffsets.test.d.ts +1 -0
- package/lib/js/playeractions/handlers/handleoffsets.test.js +50 -0
- package/lib/js/playeractions/handlers/handleoffsets.test.js.map +1 -0
- package/lib/js/playeractions/handlers/resolvekeypress.d.ts +3 -0
- package/lib/js/playeractions/handlers/resolvekeypress.js +55 -0
- package/lib/js/playeractions/handlers/resolvekeypress.js.map +1 -0
- package/lib/js/playeractions/playeractions.d.ts +3 -0
- package/lib/js/playeractions/playeractions.js +4 -0
- package/lib/js/playeractions/playeractions.js.map +1 -0
- package/lib/js/tracking/handlers/eventbinding.d.ts +10 -0
- package/lib/js/tracking/handlers/eventbinding.js +86 -0
- package/lib/js/tracking/handlers/eventbinding.js.map +1 -0
- package/lib/js/tracking/handlers/eventlogging.d.ts +11 -0
- package/lib/js/tracking/handlers/eventlogging.js +42 -0
- package/lib/js/tracking/handlers/eventlogging.js.map +1 -0
- package/lib/js/tracking/handlers/playertrackerinit.d.ts +13 -0
- package/lib/js/tracking/handlers/playertrackerinit.js +29 -0
- package/lib/js/tracking/handlers/playertrackerinit.js.map +1 -0
- package/lib/js/tracking/handlers/playertrackerstart.d.ts +8 -0
- package/lib/js/tracking/handlers/playertrackerstart.js +29 -0
- package/lib/js/tracking/handlers/playertrackerstart.js.map +1 -0
- package/lib/js/tracking/playertracker.d.ts +4 -0
- package/lib/js/tracking/playertracker.js +10 -0
- package/lib/js/tracking/playertracker.js.map +1 -0
- package/lib/js/ui/components/adbutton.d.ts +7 -0
- package/lib/js/ui/components/adbutton.js +21 -0
- package/lib/js/ui/components/adbutton.js.map +1 -0
- package/lib/js/ui/components/adlabel.d.ts +7 -0
- package/lib/js/ui/components/adlabel.js +17 -0
- package/lib/js/ui/components/adlabel.js.map +1 -0
- package/lib/js/ui/components/buttons.d.ts +30 -0
- package/lib/js/ui/components/buttons.js +89 -0
- package/lib/js/ui/components/buttons.js.map +1 -0
- package/lib/js/ui/components/controlbar.d.ts +3 -0
- package/lib/js/ui/components/controlbar.js +47 -0
- package/lib/js/ui/components/controlbar.js.map +1 -0
- package/lib/js/ui/components/ctabar.d.ts +9 -0
- package/lib/js/ui/components/ctabar.js +41 -0
- package/lib/js/ui/components/ctabar.js.map +1 -0
- package/lib/js/ui/components/nativemobile/buttons.d.ts +13 -0
- package/lib/js/ui/components/nativemobile/buttons.js +43 -0
- package/lib/js/ui/components/nativemobile/buttons.js.map +1 -0
- package/lib/js/ui/components/nativemobile/controlbar.d.ts +2 -0
- package/lib/js/ui/components/nativemobile/controlbar.js +23 -0
- package/lib/js/ui/components/nativemobile/controlbar.js.map +1 -0
- package/lib/js/ui/components/nativemobile/ctabar.d.ts +10 -0
- package/lib/js/ui/components/nativemobile/ctabar.js +12 -0
- package/lib/js/ui/components/nativemobile/ctabar.js.map +1 -0
- package/lib/js/ui/components/nativemobile/playnext.d.ts +10 -0
- package/lib/js/ui/components/nativemobile/playnext.js +16 -0
- package/lib/js/ui/components/nativemobile/playnext.js.map +1 -0
- package/lib/js/ui/components/nativemobile/topbar.d.ts +3 -0
- package/lib/js/ui/components/nativemobile/topbar.js +21 -0
- package/lib/js/ui/components/nativemobile/topbar.js.map +1 -0
- package/lib/js/ui/components/playnext.d.ts +11 -0
- package/lib/js/ui/components/playnext.js +11 -0
- package/lib/js/ui/components/playnext.js.map +1 -0
- package/lib/js/ui/components/settingspanel.d.ts +4 -0
- package/lib/js/ui/components/settingspanel.js +130 -0
- package/lib/js/ui/components/settingspanel.js.map +1 -0
- package/lib/js/ui/components/shared/playnextscreen.d.ts +2 -0
- package/lib/js/ui/components/shared/playnextscreen.js +18 -0
- package/lib/js/ui/components/shared/playnextscreen.js.map +1 -0
- package/lib/js/ui/components/titlebar.d.ts +3 -0
- package/lib/js/ui/components/titlebar.js +9 -0
- package/lib/js/ui/components/titlebar.js.map +1 -0
- package/lib/js/ui/components/topbar.d.ts +2 -0
- package/lib/js/ui/components/topbar.js +19 -0
- package/lib/js/ui/components/topbar.js.map +1 -0
- package/lib/js/ui/handlers/listboxhandlers.d.ts +5 -0
- package/lib/js/ui/handlers/listboxhandlers.js +41 -0
- package/lib/js/ui/handlers/listboxhandlers.js.map +1 -0
- package/lib/js/ui/handlers/nicamhandler.d.ts +2 -0
- package/lib/js/ui/handlers/nicamhandler.js +32 -0
- package/lib/js/ui/handlers/nicamhandler.js.map +1 -0
- package/lib/js/ui/handlers/nicamhandler.test.d.ts +1 -0
- package/lib/js/ui/handlers/nicamhandler.test.js +34 -0
- package/lib/js/ui/handlers/nicamhandler.test.js.map +1 -0
- package/lib/js/ui/handlers/playnexthandlers.d.ts +0 -0
- package/lib/js/ui/handlers/playnexthandlers.js +2 -0
- package/lib/js/ui/handlers/playnexthandlers.js.map +1 -0
- package/lib/js/ui/handlers/timecontrolhandlers.d.ts +3 -0
- package/lib/js/ui/handlers/timecontrolhandlers.js +23 -0
- package/lib/js/ui/handlers/timecontrolhandlers.js.map +1 -0
- package/lib/js/ui/nativemobileui.d.ts +6 -0
- package/lib/js/ui/nativemobileui.js +49 -0
- package/lib/js/ui/nativemobileui.js.map +1 -0
- package/lib/js/ui/uicontainer.d.ts +3 -0
- package/lib/js/ui/uicontainer.js +61 -0
- package/lib/js/ui/uicontainer.js.map +1 -0
- package/lib/js/utilities/localizationconfig.d.ts +6 -0
- package/lib/js/utilities/localizationconfig.js +8 -0
- package/lib/js/utilities/localizationconfig.js.map +1 -0
- package/lib/js/utilities/printversion.d.ts +1 -0
- package/lib/js/utilities/printversion.js +28 -0
- package/lib/js/utilities/printversion.js.map +1 -0
- package/lib/js/utilities/utilities.d.ts +60 -0
- package/lib/js/utilities/utilities.js +110 -0
- package/lib/js/utilities/utilities.js.map +1 -0
- package/lib/lang/nl.json +72 -0
- package/lib/npoplayer.d.ts +45 -0
- package/lib/npoplayer.js +518 -0
- package/lib/npoplayer.js.map +1 -0
- package/lib/npoplayer.test.d.ts +1 -0
- package/lib/npoplayer.test.js +12 -0
- package/lib/npoplayer.test.js.map +1 -0
- package/lib/package.json +88 -0
- package/lib/src/js/ads/ster.d.ts +4 -0
- package/lib/src/js/ads/ster.test.d.ts +1 -0
- package/lib/src/js/api/getstreamobject.d.ts +3 -0
- package/lib/src/js/cdnproviders.d.ts +1 -0
- package/lib/src/js/checks/safari.d.ts +1 -0
- package/lib/src/js/checks/safari.test.d.ts +1 -0
- package/lib/src/js/drm/verifydrm.d.ts +4 -0
- package/lib/src/js/drm/verifydrm.test.d.ts +1 -0
- package/lib/src/js/fragments/setfragments.d.ts +3 -0
- package/lib/src/js/playeractions/customerrors.test.d.ts +1 -0
- package/lib/src/js/playeractions/handlers/customerrors.d.ts +50 -0
- package/lib/src/js/playeractions/handlers/error.d.ts +3 -0
- package/lib/src/js/playeractions/handlers/error.test.d.ts +1 -0
- package/lib/src/js/playeractions/handlers/handleoffsets.d.ts +6 -0
- package/lib/src/js/playeractions/handlers/handleoffsets.test.d.ts +1 -0
- package/lib/src/js/playeractions/handlers/resolvekeypress.d.ts +3 -0
- package/lib/src/js/playeractions/playeractions.d.ts +3 -0
- package/lib/src/js/tracking/handlers/eventbinding.d.ts +10 -0
- package/lib/src/js/tracking/handlers/eventlogging.d.ts +11 -0
- package/lib/src/js/tracking/handlers/playertrackerinit.d.ts +13 -0
- package/lib/src/js/tracking/handlers/playertrackerstart.d.ts +8 -0
- package/lib/src/js/tracking/playertracker.d.ts +4 -0
- package/lib/src/js/ui/components/adbutton.d.ts +7 -0
- package/lib/src/js/ui/components/adlabel.d.ts +7 -0
- package/lib/src/js/ui/components/buttons.d.ts +30 -0
- package/lib/src/js/ui/components/controlbar.d.ts +3 -0
- package/lib/src/js/ui/components/ctabar.d.ts +9 -0
- package/lib/src/js/ui/components/nativemobile/buttons.d.ts +13 -0
- package/lib/src/js/ui/components/nativemobile/controlbar.d.ts +2 -0
- package/lib/src/js/ui/components/nativemobile/ctabar.d.ts +10 -0
- package/lib/src/js/ui/components/nativemobile/playnext.d.ts +10 -0
- package/lib/src/js/ui/components/nativemobile/topbar.d.ts +3 -0
- package/lib/src/js/ui/components/playnext.d.ts +11 -0
- package/lib/src/js/ui/components/settingspanel.d.ts +4 -0
- package/lib/src/js/ui/components/shared/playnextscreen.d.ts +2 -0
- package/lib/src/js/ui/components/titlebar.d.ts +3 -0
- package/lib/src/js/ui/components/topbar.d.ts +2 -0
- package/lib/src/js/ui/handlers/listboxhandlers.d.ts +5 -0
- package/lib/src/js/ui/handlers/nicamhandler.d.ts +2 -0
- package/lib/src/js/ui/handlers/nicamhandler.test.d.ts +1 -0
- package/lib/src/js/ui/handlers/playnexthandlers.d.ts +0 -0
- package/lib/src/js/ui/handlers/timecontrolhandlers.d.ts +3 -0
- package/lib/src/js/ui/nativemobileui.d.ts +6 -0
- package/lib/src/js/ui/uicontainer.d.ts +3 -0
- package/lib/src/js/utilities/localizationconfig.d.ts +6 -0
- package/lib/src/js/utilities/printversion.d.ts +1 -0
- package/lib/src/js/utilities/utilities.d.ts +60 -0
- package/lib/src/npoplayer.d.ts +45 -0
- package/lib/src/npoplayer.test.d.ts +1 -0
- package/lib/src/types/classes.d.ts +4 -0
- package/lib/src/types/interfaces.d.ts +105 -0
- package/lib/types/classes.d.ts +4 -0
- package/lib/types/classes.js +4 -0
- package/lib/types/classes.js.map +1 -0
- package/lib/types/interfaces.d.ts +105 -0
- package/lib/types/interfaces.js +6 -0
- package/lib/types/interfaces.js.map +1 -0
- package/package.json +88 -0
- package/src/scss/components/_advert.scss +74 -0
- package/src/scss/components/_buffering.scss +6 -0
- package/src/scss/components/_container.scss +8 -0
- package/src/scss/components/_controlbars.scss +36 -0
- package/src/scss/components/_error.scss +26 -0
- package/src/scss/components/_fonts.scss +19 -0
- package/src/scss/components/_icons.scss +241 -0
- package/src/scss/components/_nicam.scss +61 -0
- package/src/scss/components/_playnext.scss +52 -0
- package/src/scss/components/_seekbar.scss +116 -0
- package/src/scss/components/_settingspanel.scss +196 -0
- package/src/scss/components/_subtitles.scss +32 -0
- package/src/scss/components/_textbuttons.scss +42 -0
- package/src/scss/components/_volumeslider.scss +23 -0
- package/src/scss/npoplayer.css +1238 -0
- package/src/scss/npoplayer.scss +37 -0
- package/src/scss/variants/_player-base.scss +64 -0
- package/src/scss/variants/_player-large.scss +56 -0
- package/src/scss/variants/_player-medium.scss +57 -0
- package/src/scss/variants/_player-small.scss +234 -0
- package/src/scss/vars/_colors.scss +24 -0
- package/src/scss/vars/_fonts.scss +20 -0
- package/src/scss/vars/_icons.scss +37 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safari.test.js","sourceRoot":"","sources":["../../../../src/js/checks/safari.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACrC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAE3E,MAAM,sBAAsB,GAAG,KAAK,CAAC;QAErC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACrD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAE3E,MAAM,sBAAsB,GAAG,IAAI,CAAC;QAEpC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QACzD,IAAI;aACC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC;aAC3C,eAAe,CAAC,8CAA8C,CAAC,CAAC;QAErE,MAAM,sBAAsB,GAAG,KAAK,CAAC;QAErC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file contains the DRM verification logic.
|
|
3
|
+
* It checks if the DRM token is expired and if so, it will request a new token.
|
|
4
|
+
* If there is no DRM token present, the function will skip the verification flow entirely.
|
|
5
|
+
* If the token is still valid, it will load the stream as normal.
|
|
6
|
+
* @function verifyDRM
|
|
7
|
+
* @param {NpoPlayer} npoplayer - The NpoPlayer instance
|
|
8
|
+
* @param {PlayerAPI} player - The Bitmovin player instance
|
|
9
|
+
* @param {ApiPayload} payload - The payload object
|
|
10
|
+
* @returns {void}
|
|
11
|
+
*/
|
|
12
|
+
import { jwtToBase64, base64ToObject } from '../utilities/utilities';
|
|
13
|
+
import { getStreamObject } from '../api/getstreamobject';
|
|
14
|
+
export async function verifyDRM(npoplayer, player, payload) {
|
|
15
|
+
if (npoplayer.streamObject.stream.drmToken != null) {
|
|
16
|
+
const drmBase64 = jwtToBase64(npoplayer.streamObject.stream.drmToken);
|
|
17
|
+
const drmJsonTimestamp = base64ToObject(drmBase64).iat;
|
|
18
|
+
const currentTime = (Date.now() / 1000) | 0;
|
|
19
|
+
if (drmJsonTimestamp >= currentTime) {
|
|
20
|
+
void player?.load(npoplayer.sourceConfig);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
// Token is expired, entering fallback flow
|
|
24
|
+
console.error('Er ging iets mis. Item wordt herladen.');
|
|
25
|
+
const backupStreamObject = await getStreamObject(npoplayer, payload);
|
|
26
|
+
const newDrmToken = backupStreamObject.stream.drmToken;
|
|
27
|
+
// Cloning the streamObject and parsing it so we can manipulate the JSON
|
|
28
|
+
const clonedStreamObject = JSON.parse(JSON.stringify(npoplayer.streamObject));
|
|
29
|
+
clonedStreamObject.stream.drmToken = newDrmToken;
|
|
30
|
+
npoplayer.streamObject = clonedStreamObject;
|
|
31
|
+
void player?.load(npoplayer.sourceConfig);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
void player?.load(npoplayer.sourceConfig);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=verifydrm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifydrm.js","sourceRoot":"","sources":["../../../../src/js/drm/verifydrm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAKxD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAE,SAAoB,EAAE,MAAiB,EAAE,OAAmB;IACzF,IAAI,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,EAAE;QAChD,MAAM,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QACrE,MAAM,gBAAgB,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,GAAG,CAAA;QACtD,MAAM,WAAW,GAAW,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;QAEnD,IAAI,gBAAgB,IAAI,WAAW,EAAE;YACjC,KAAK,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;SAC5C;aAAM;YACH,2CAA2C;YAC3C,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAA;YAEvD,MAAM,kBAAkB,GAAG,MAAM,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;YACpE,MAAM,WAAW,GAAG,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAA;YAEtD,wEAAwE;YACxE,MAAM,kBAAkB,GAAG,IAAI,CAAC,KAAK,CACjC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,CACzC,CAAA;YACD,kBAAkB,CAAC,MAAM,CAAC,QAAQ,GAAG,WAAW,CAAA;YAEhD,SAAS,CAAC,YAAY,GAAG,kBAAkB,CAAA;YAC3C,KAAK,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;SAC5C;KACJ;SAAM;QACH,KAAK,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;KAC5C;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { verifyDRM } from "./verifydrm";
|
|
2
|
+
const load = jest.fn();
|
|
3
|
+
const npoplayer = {
|
|
4
|
+
streamObject: { stream: { drmToken: undefined } },
|
|
5
|
+
};
|
|
6
|
+
const player = { load };
|
|
7
|
+
const payload = {
|
|
8
|
+
baseURL: "url",
|
|
9
|
+
jwt: "jwt",
|
|
10
|
+
data: { data: "data" },
|
|
11
|
+
};
|
|
12
|
+
describe("Test DRM verification", () => {
|
|
13
|
+
it("should call player.load when the drmToken is null", async () => {
|
|
14
|
+
await verifyDRM(npoplayer, player, payload);
|
|
15
|
+
expect(load).toBeCalled();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=verifydrm.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifydrm.test.js","sourceRoot":"","sources":["../../../../src/js/drm/verifydrm.test.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAEvB,MAAM,SAAS,GAAG;IACd,YAAY,EAAE,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE;CACvC,CAAC;AAEf,MAAM,MAAM,GAAG,EAAE,IAAI,EAA0B,CAAC;AAEhD,MAAM,OAAO,GAAe;IACxB,OAAO,EAAE,KAAK;IACd,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;CACzB,CAAC;AAEF,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,mDAAmD,EAAE,KAAK,IAAI,EAAE;QAC/D,MAAM,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAE5C,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;IAC9B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { PlayerEvent } from 'bitmovin-player';
|
|
2
|
+
export async function setFragments(npoplayer, fragments) {
|
|
3
|
+
const uiManager = npoplayer.uiManager;
|
|
4
|
+
const player = npoplayer.player;
|
|
5
|
+
const fragment = fragments.sections[0];
|
|
6
|
+
const playFragmentFromStart = () => {
|
|
7
|
+
player?.seek(fragment.start);
|
|
8
|
+
if (player?.isPaused())
|
|
9
|
+
void player?.play();
|
|
10
|
+
};
|
|
11
|
+
const addMarkers = () => {
|
|
12
|
+
const timelineMarkers = [
|
|
13
|
+
{
|
|
14
|
+
time: 0,
|
|
15
|
+
duration: fragment.start,
|
|
16
|
+
title: 'Niet beschikbaar',
|
|
17
|
+
cssClasses: ['seekbar-marker-unplayable']
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
time: fragment.start,
|
|
21
|
+
duration: fragment.end - fragment.start,
|
|
22
|
+
title: npoplayer.sourceConfig.title,
|
|
23
|
+
cssClasses: ['seekbar-marker-interval']
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
time: fragment.end,
|
|
27
|
+
duration: 10000000,
|
|
28
|
+
title: 'Niet beschikbaar',
|
|
29
|
+
cssClasses: ['seekbar-marker-unplayable']
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
timelineMarkers.forEach(function (marker) {
|
|
33
|
+
uiManager?.addTimelineMarker(marker);
|
|
34
|
+
});
|
|
35
|
+
playFragmentFromStart();
|
|
36
|
+
};
|
|
37
|
+
const removeMarkers = () => {
|
|
38
|
+
uiManager?.getTimelineMarkers().forEach(marker => {
|
|
39
|
+
uiManager?.removeTimelineMarker(marker);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const checkFunction = (e) => {
|
|
43
|
+
if (fragment == null)
|
|
44
|
+
return;
|
|
45
|
+
if (e.time > fragment.end) {
|
|
46
|
+
player?.seek(Math.max(fragment.start, fragment.end));
|
|
47
|
+
player?.pause();
|
|
48
|
+
}
|
|
49
|
+
else if (e.time < fragment.start) {
|
|
50
|
+
player?.seek(fragment.start);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const seekFunction = (e) => {
|
|
54
|
+
if (fragment == null)
|
|
55
|
+
return;
|
|
56
|
+
const seekEvent = e;
|
|
57
|
+
if (seekEvent.seekTarget > fragment.end || seekEvent.seekTarget < fragment.start) {
|
|
58
|
+
player?.seek(Math.max(fragment.start, Math.min(fragment.end, seekEvent.seekTarget)));
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
player?.off(PlayerEvent.TimeChanged, checkFunction);
|
|
62
|
+
player?.off(PlayerEvent.Seek, seekFunction);
|
|
63
|
+
player?.on(PlayerEvent.TimeChanged, checkFunction);
|
|
64
|
+
player?.on(PlayerEvent.Seek, seekFunction);
|
|
65
|
+
removeMarkers();
|
|
66
|
+
addMarkers();
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=setfragments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setfragments.js","sourceRoot":"","sources":["../../../../src/js/fragments/setfragments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,iBAAiB,CAAA;AAI7D,MAAM,CAAC,KAAK,UAAU,YAAY,CAAE,SAAoB,EAAE,SAAoB;IAC1E,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAA;IACrC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAA;IAC/B,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAEtC,MAAM,qBAAqB,GAAG,GAAG,EAAE;QAC/B,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC5B,IAAI,MAAM,EAAE,QAAQ,EAAE;YAAE,KAAK,MAAM,EAAE,IAAI,EAAE,CAAA;IAC/C,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,GAAG,EAAE;QACpB,MAAM,eAAe,GAAG;YACpB;gBACI,IAAI,EAAE,CAAC;gBACP,QAAQ,EAAE,QAAQ,CAAC,KAAK;gBACxB,KAAK,EAAE,kBAAkB;gBACzB,UAAU,EAAE,CAAC,2BAA2B,CAAC;aAC5C;YACD;gBACI,IAAI,EAAE,QAAQ,CAAC,KAAK;gBACpB,QAAQ,EAAE,QAAQ,CAAC,GAAG,GAAG,QAAQ,CAAC,KAAK;gBACvC,KAAK,EAAE,SAAS,CAAC,YAAY,CAAC,KAAK;gBACnC,UAAU,EAAE,CAAC,yBAAyB,CAAC;aAC1C;YACD;gBACI,IAAI,EAAE,QAAQ,CAAC,GAAG;gBAClB,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,kBAAkB;gBACzB,UAAU,EAAE,CAAC,2BAA2B,CAAC;aAC5C;SACJ,CAAC;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;IACL,CAAC,CAAA;IAED,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,WAAW,EAAE,aAAa,CAAC,CAAA;IACnD,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;IAE3C,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,WAAW,EAAE,aAAa,CAAC,CAAA;IAClD,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;IAE1C,aAAa,EAAE,CAAA;IACf,UAAU,EAAE,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { customSpecificErrorMessageOverlayConfig } from "./handlers/customerrors";
|
|
2
|
+
describe("Test custom error messages", () => {
|
|
3
|
+
it("should return a 1000 error message", () => {
|
|
4
|
+
expect(customSpecificErrorMessageOverlayConfig[1000]).toBe("Oeps, er gaat iets mis");
|
|
5
|
+
});
|
|
6
|
+
it("should return a 1001 error message", () => {
|
|
7
|
+
expect(customSpecificErrorMessageOverlayConfig[1001]).toBe("Oeps, er gaat iets mis");
|
|
8
|
+
});
|
|
9
|
+
it("should return a 1101 error message", () => {
|
|
10
|
+
expect(customSpecificErrorMessageOverlayConfig[1101]).toBe("De player is niet aangemaakt");
|
|
11
|
+
});
|
|
12
|
+
it("should return a 1102 error message", () => {
|
|
13
|
+
expect(customSpecificErrorMessageOverlayConfig[1102]).toBe("Er ging iets mis met de configuratie");
|
|
14
|
+
});
|
|
15
|
+
it("should return a 1103 error message", () => {
|
|
16
|
+
expect(customSpecificErrorMessageOverlayConfig[1103]).toBe("Er is iets mis met de licentie (access key)");
|
|
17
|
+
});
|
|
18
|
+
it("should return a 1104 error message", () => {
|
|
19
|
+
expect(customSpecificErrorMessageOverlayConfig[1104]).toBe("De video kan niet worden afgespeeld op dit domein");
|
|
20
|
+
});
|
|
21
|
+
it("should return a 1105 error message", () => {
|
|
22
|
+
expect(customSpecificErrorMessageOverlayConfig[1105]).toBe("De video kan niet op dit web-adres worden afgespeeld");
|
|
23
|
+
});
|
|
24
|
+
it("should return a 1113 error message", () => {
|
|
25
|
+
expect(customSpecificErrorMessageOverlayConfig[1113]).toBe("De video kan niet worden afgespeeld zonder web server");
|
|
26
|
+
});
|
|
27
|
+
it("should return a 1201 error message", () => {
|
|
28
|
+
expect(customSpecificErrorMessageOverlayConfig[1201]).toBe("Er is iets mis met de source configuratie");
|
|
29
|
+
});
|
|
30
|
+
it("should return a 1202 error message", () => {
|
|
31
|
+
expect(customSpecificErrorMessageOverlayConfig[1202]({ code: 1202 })).toBe("The downloaded manifest is invalid");
|
|
32
|
+
});
|
|
33
|
+
it("should return a 1203 error message", () => {
|
|
34
|
+
expect(customSpecificErrorMessageOverlayConfig[1203]).toBe("Helaas, deze video is niet beschikbaar.");
|
|
35
|
+
});
|
|
36
|
+
it("should return a 1208 error message", () => {
|
|
37
|
+
const errorMessage = customSpecificErrorMessageOverlayConfig[1208]({
|
|
38
|
+
data: { statusCode: 1 },
|
|
39
|
+
});
|
|
40
|
+
expect(errorMessage).toBe("Manifest laden mislukt met HTTP fout 1");
|
|
41
|
+
});
|
|
42
|
+
it("should return a 1400 error message", () => {
|
|
43
|
+
expect(customSpecificErrorMessageOverlayConfig[1400]).toBe("Er is iets mis met uw internet-verbinding");
|
|
44
|
+
});
|
|
45
|
+
it("should return a 2003 error message", () => {
|
|
46
|
+
expect(customSpecificErrorMessageOverlayConfig[2003]).toBe("Oeps, er is iets mis met het opvragen van de DRM");
|
|
47
|
+
});
|
|
48
|
+
it("should return a 2006 error message", () => {
|
|
49
|
+
expect(customSpecificErrorMessageOverlayConfig[2006]).toBe("Oeps, er is iets mis met de DRM");
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=customerrors.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customerrors.test.js","sourceRoot":"","sources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AkD,CACrD,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC1C,MAAM,CAAC,uCAAuC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CACtD,iCAAiC,CACpC,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare const customSpecificErrorMessageOverlayConfig: {
|
|
2
|
+
1000: string;
|
|
3
|
+
1001: string;
|
|
4
|
+
1101: string;
|
|
5
|
+
1102: string;
|
|
6
|
+
1103: string;
|
|
7
|
+
1104: string;
|
|
8
|
+
1105: string;
|
|
9
|
+
1106: string;
|
|
10
|
+
1107: string;
|
|
11
|
+
1108: string;
|
|
12
|
+
1113: string;
|
|
13
|
+
1201: string;
|
|
14
|
+
1202: (error: any) => string | import("bitmovin-player-ui/dist/js/framework/components/errormessageoverlay").ErrorMessageTranslator;
|
|
15
|
+
1203: string;
|
|
16
|
+
1204: string;
|
|
17
|
+
1205: string;
|
|
18
|
+
1206: string;
|
|
19
|
+
1207: string;
|
|
20
|
+
1208: (error: any) => string;
|
|
21
|
+
1209: string;
|
|
22
|
+
1210: string;
|
|
23
|
+
1211: string;
|
|
24
|
+
1301: string;
|
|
25
|
+
1304: string;
|
|
26
|
+
1400: string;
|
|
27
|
+
1401: string;
|
|
28
|
+
1402: string;
|
|
29
|
+
1403: string;
|
|
30
|
+
1404: string;
|
|
31
|
+
2001: string;
|
|
32
|
+
2002: string;
|
|
33
|
+
2003: string;
|
|
34
|
+
2005: string;
|
|
35
|
+
2006: string;
|
|
36
|
+
2007: string;
|
|
37
|
+
2008: string;
|
|
38
|
+
2009: string;
|
|
39
|
+
2010: string;
|
|
40
|
+
2011: string;
|
|
41
|
+
2012: string;
|
|
42
|
+
2013: string;
|
|
43
|
+
2015: string;
|
|
44
|
+
2101: string;
|
|
45
|
+
3001: string;
|
|
46
|
+
3002: string;
|
|
47
|
+
3003: string;
|
|
48
|
+
3004: string;
|
|
49
|
+
4000: string;
|
|
50
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { ErrorUtils } from "bitmovin-player-ui";
|
|
2
|
+
// Reference: https://bitmovin.com/docs/player/api-reference/web/web-sdk-api-reference-v8#/player/web/8/docs/enums/core_deficiency.errorcode.html#network_error
|
|
3
|
+
export const customSpecificErrorMessageOverlayConfig = {
|
|
4
|
+
// Overwrite error 1000 'Error is unknown'
|
|
5
|
+
1000: "Oeps, er gaat iets mis",
|
|
6
|
+
// API_NOT_AVAILABLE
|
|
7
|
+
// The player API was accessed after the player instance has been destroyed by either calling PlayerAPI.destroy or after an PlayerEvent.Error event has been thrown.
|
|
8
|
+
1001: "Oeps, er gaat iets mis",
|
|
9
|
+
// SETUP_NO_HTML_ELEMENT
|
|
10
|
+
// An attempt was made to create a player instance with a container element that is not an instance of HTMLElement.
|
|
11
|
+
1101: "De player is niet aangemaakt",
|
|
12
|
+
// SETUP_MISSING_CONFIGURATION
|
|
13
|
+
// No PlayerConfig was provided when attempting to create a player instance.
|
|
14
|
+
1102: "Er ging iets mis met de configuratie",
|
|
15
|
+
// SETUP_LICENSE_ERROR
|
|
16
|
+
// The player license server did not grant playback for the given player key as specified in the PlayerConfig.
|
|
17
|
+
1103: "Er is iets mis met de licentie (access key)",
|
|
18
|
+
// SETUP_MISSING_DOMAIN_LICENSE_ALLOWLIST
|
|
19
|
+
// The player build is domain-locked and not authorized to play content on the current domain.
|
|
20
|
+
1104: "De video kan niet worden afgespeeld op dit domein",
|
|
21
|
+
// SETUP_MISSING_LICENSE_ALLOWLIST
|
|
22
|
+
// The player is not allowed to play back content on the current domain.
|
|
23
|
+
1105: "De video kan niet op dit web-adres worden afgespeeld",
|
|
24
|
+
// SETUP_INVALID_LICENSE_SERVER
|
|
25
|
+
// The license server URL provided in TweaksConfig.licenseServer does not match any of the available license server URLs.
|
|
26
|
+
1106: "",
|
|
27
|
+
// SETUP_INVALID_IMPRESSION_SERVER
|
|
28
|
+
// The impression server URL provided in TweaksConfig.impressionServer does not match any of the available impression server URLs.
|
|
29
|
+
1107: "",
|
|
30
|
+
// SETUP_NO_RENDERING_ENGINE
|
|
31
|
+
// Could not initialize the rendering engine. This error occurs when the platform does not support the PlayerType and StreamType for the provided SourceConfig on the current platform, and is therefore unable to instantiate a suitable rendering engine.
|
|
32
|
+
1108: "",
|
|
33
|
+
// SETUP_UNSUPPORTED_PROTOCOL`
|
|
34
|
+
// This site has been loaded using "file" protocol which is not supported. Please host the page using a web server (using http or https).
|
|
35
|
+
1113: "De video kan niet worden afgespeeld zonder web server",
|
|
36
|
+
// SOURCE_INVALID
|
|
37
|
+
// The SourceConfig provided to the PlayerAPI.load method is invalid. Ensure that the SourceConfig contains at least one valid source URL for any of the supported stream types on the current platform.
|
|
38
|
+
1201: "Er is iets mis met de source configuratie",
|
|
39
|
+
// Transform error 1202 'Unsupported manifest format' to uppercase
|
|
40
|
+
1202: (error) => {
|
|
41
|
+
return ErrorUtils.defaultErrorMessages[error.code];
|
|
42
|
+
},
|
|
43
|
+
// Overwrite error 1203 = SOURCE_NO_SUPPORTED_TECHNOLOGY
|
|
44
|
+
// The platform does not support any of the technologies needed to play back the provided source.
|
|
45
|
+
1203: "Helaas, deze video is niet beschikbaar.",
|
|
46
|
+
// SOURCE_STREAM_TYPE_NOT_SUPPORTED
|
|
47
|
+
// The stream type is not supported.
|
|
48
|
+
// This error happens when the SourceConfig does not contain a valid stream type, i.e. dash, hls, progressive or smooth.
|
|
49
|
+
1204: "",
|
|
50
|
+
// SOURCE_FORCED_TECHNOLOGY_NOT_SUPPORTED
|
|
51
|
+
// The Technology selected through the forceTechnology parameter, that was passed to the PlayerAPI.load method, is not supported on the current platform.
|
|
52
|
+
1205: "",
|
|
53
|
+
// SOURCE_NO_STREAM_FOUND_FOR_SUPPORTED_TECHNOLOGY
|
|
54
|
+
// The current platform doesn't support any of the technologies needed to play back any of the sources provided in the SourceConfig.
|
|
55
|
+
1206: "",
|
|
56
|
+
// SOURCE_EMPTY_SEGMENT
|
|
57
|
+
// The downloaded segment is empty.
|
|
58
|
+
1207: "",
|
|
59
|
+
// SOURCE_COULD_NOT_LOAD_MANIFEST
|
|
60
|
+
// The manifest could not be loaded.
|
|
61
|
+
// The manifest network request failed, please check the network request's response for the failure reason.
|
|
62
|
+
1208: (error) => {
|
|
63
|
+
const statusCode = error.data.statusCode;
|
|
64
|
+
return "Manifest laden mislukt met HTTP fout " + statusCode;
|
|
65
|
+
},
|
|
66
|
+
// SOURCE_PROGRESSIVE_STREAM_ERROR
|
|
67
|
+
// The specified progressive stream type is not supported, or the SourceElement used to load the source has reported an error.
|
|
68
|
+
1209: "",
|
|
69
|
+
// SOURCE_HLS_STREAM_ERROR
|
|
70
|
+
// An error was encountered while playing, or trying to play back an HLS stream.
|
|
71
|
+
1210: "",
|
|
72
|
+
// SOURCE_ENCRYPTION_METHOD_NOT_SUPPORTED
|
|
73
|
+
// The encryption method used by the source is not supported.
|
|
74
|
+
1211: "",
|
|
75
|
+
// PLAYBACK_VIDEO_DECODING_ERROR
|
|
76
|
+
// An error occurred while trying to demux or decode the content.
|
|
77
|
+
// This error can occur when the browser or device is unable to either demux or decode the content.
|
|
78
|
+
1301: "",
|
|
79
|
+
// PLAYBACK_HLS_COULD_NOT_LOAD_TRANSMUXER
|
|
80
|
+
// The transmuxer could not be initialized.
|
|
81
|
+
// This error can occur when an error is encountered during transmuxer initialization.
|
|
82
|
+
1304: "",
|
|
83
|
+
// NETWORK_ERROR
|
|
84
|
+
// A general network error has occurred while downloading resource E.g.: the manifest or a segment of the stream.
|
|
85
|
+
1400: "Er is iets mis met uw internet-verbinding",
|
|
86
|
+
// NETWORK_MANIFEST_DOWNLOAD_TIMEOUT
|
|
87
|
+
// The manifest download request timed out.
|
|
88
|
+
1401: "",
|
|
89
|
+
// NETWORK_SEGMENT_DOWNLOAD_TIMEOUT
|
|
90
|
+
// The segment download timed out.
|
|
91
|
+
1402: "",
|
|
92
|
+
// NETWORK_PROGRESSIVE_STREAM_DOWNLOAD_TIMEOUT
|
|
93
|
+
// The progressive stream download timed out.
|
|
94
|
+
1403: "",
|
|
95
|
+
// NETWORK_FAILED_CERTIFICATE_REQUEST
|
|
96
|
+
// The Fairplay DRM certificate request failed.
|
|
97
|
+
1404: "",
|
|
98
|
+
// DRM_MISSING_CONFIGURATION
|
|
99
|
+
// An attempt was made to play back a Fairplay protected stream, but no DRM configuration was provided in the SourceConfig.drm.
|
|
100
|
+
2001: "",
|
|
101
|
+
// DRM_NO_LICENSE_SERVER_URL_PROVIDED
|
|
102
|
+
// The Fairplay licensing server URL is missing in the provided AppleFairplayDRMConfig.
|
|
103
|
+
2002: "",
|
|
104
|
+
// DRM_FAILED_LICENSE_REQUEST
|
|
105
|
+
// The DRM license request failed.
|
|
106
|
+
2003: "Oeps, er is iets mis met het opvragen van de DRM",
|
|
107
|
+
2005: "",
|
|
108
|
+
// DRM_NO_KEY_SYSTEM
|
|
109
|
+
// The current platform doesn't support any of the key systems specified in the SourceConfig that are required to play back the content.
|
|
110
|
+
2006: "Oeps, er is iets mis met de DRM",
|
|
111
|
+
// DRM_KEY_SESSION_INITIALIZATION_FAILED
|
|
112
|
+
// Unable to create or initialize a DRM key session.
|
|
113
|
+
2007: "",
|
|
114
|
+
// DRM_MEDIA_KEY_INITIALIZATION_FAILED
|
|
115
|
+
// The DRM Media Keys object could not be created or initialized.
|
|
116
|
+
2008: "",
|
|
117
|
+
// DRM_KEY_ERROR
|
|
118
|
+
// The video element or an associated DRM Key Session has thrown a DRM key error.
|
|
119
|
+
2009: "",
|
|
120
|
+
// DRM_KEY_SYSTEM_NOT_SUPPORTED
|
|
121
|
+
// No supported Fairplay Key System is available.
|
|
122
|
+
2010: "",
|
|
123
|
+
// DRM_CERTIFICATE_ERROR
|
|
124
|
+
// The DRM certificate specified in the DRMConfig is not valid, the player was unable to parse the provided certificate or the network request for the certificate failed.
|
|
125
|
+
2011: "",
|
|
126
|
+
// DRM_PLAYREADY_INVALID_HEADER_KEY_VALUE_PAIR
|
|
127
|
+
// Invalid header key/value pair encountered while parsing a PlayReady license request.
|
|
128
|
+
2012: "",
|
|
129
|
+
// DRM_RESTRICTED_OUTPUT
|
|
130
|
+
// The DRM protected content cannot be played back due to the device not being able to securely present the content.
|
|
131
|
+
2013: "",
|
|
132
|
+
// DRM_INIT_DATA_MISSING
|
|
133
|
+
// No init data was found for the used key system in the manifest or the segments.
|
|
134
|
+
2015: "",
|
|
135
|
+
// VR_INCOMPATIBLE_PLAYER_TECHNOLOGY
|
|
136
|
+
// The video element or an associated DRM Key Session has thrown a DRM key error.
|
|
137
|
+
2101: "",
|
|
138
|
+
// MODULE_INVALID_DEFINITION
|
|
139
|
+
// The definition of the module is invalid
|
|
140
|
+
3001: "",
|
|
141
|
+
// MODULE_INVALID_DEFINITION_DEPENDENCY
|
|
142
|
+
// The module definition specifies dependencies but the module is not provided via a function for deferred loading.
|
|
143
|
+
3002: "",
|
|
144
|
+
// MODULE_MISSING
|
|
145
|
+
// A module cannot be loaded because it has not been added to the player core.
|
|
146
|
+
3003: "",
|
|
147
|
+
// MODULE_DEPENDENCY_MISSING
|
|
148
|
+
// A module cannot be loaded because one or more dependencies are missing.
|
|
149
|
+
3004: "",
|
|
150
|
+
// SEGMENT_PSSH_DATA_MISSING
|
|
151
|
+
// No relevant PSSH block data was found for the used key system. This issue is known to happen on Tizen 2016.
|
|
152
|
+
4000: "",
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=customerrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customerrors.js","sourceRoot":"","sources":["../../../../../src/js/playeractions/handlers/customerrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,+JAA+J;AAC/J,MAAM,CAAC,MAAM,uCAAuC,GAAG;IACnD,0CAA0C;IAC1C,IAAI,EAAE,wBAAwB;IAE9B,oBAAoB;I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ACjF,IAAI,EAAE,EAAE;IAER,4BAA4B;IAC5B,0CAA0C;IAC1C,IAAI,EAAE,EAAE;IAER,uCAAuC;IACvC,mHAAmH;IACnH,IAAI,EAAE,EAAE;IAER,iBAAiB;IACjB,8EAA8E;IAC9E,IAAI,EAAE,EAAE;IAER,4BAA4B;IAC5B,0EAA0E;IAC1E,IAAI,EAAE,EAAE;IAER,4BAA4B;IAC5B,8GAA8G;IAC9G,IAAI,EAAE,EAAE;CACX,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This function handles the error flow.
|
|
3
|
+
* @function handlePlayerError
|
|
4
|
+
* @param {PlayerAPI} player - The Bitmovin player instance
|
|
5
|
+
* @param {UIComponents} uiComponents - The UIComponents object
|
|
6
|
+
* @param {any} input - The input to parse to the error message
|
|
7
|
+
* @returns {void}
|
|
8
|
+
*/
|
|
9
|
+
export function handlePlayerError(player, uiComponents, input) {
|
|
10
|
+
let message = '';
|
|
11
|
+
if (typeof input === 'string') {
|
|
12
|
+
message = input;
|
|
13
|
+
}
|
|
14
|
+
console.error('Er is iets mis met het ophalen van de stream.', input);
|
|
15
|
+
player?.unload();
|
|
16
|
+
if (uiComponents.controlbar)
|
|
17
|
+
uiComponents.controlbar.hide();
|
|
18
|
+
if (uiComponents.errorMessageOverlay == null)
|
|
19
|
+
return;
|
|
20
|
+
uiComponents.errorMessageOverlay.show();
|
|
21
|
+
uiComponents.errorMessageOverlay.errorLabel.setText(message ?? 'De video kan niet worden geladen');
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../../src/js/playeractions/handlers/error.ts"],"names":[],"mappings":"AAGA;;;;;;;EAOE;AAEF,MAAM,UAAU,iBAAiB,CAC7B,MAAiB,EACjB,YAA0B,EAC1B,KAAU;IAEV,IAAI,OAAO,GAAG,EAAE,CAAC;IAEjB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,OAAO,GAAG,KAAK,CAAC;KACnB;IACD,OAAO,CAAC,KAAK,CAAC,+CAA+C,EAAE,KAAK,CAAC,CAAC;IAEtE,MAAM,EAAE,MAAM,EAAE,CAAC;IAEjB,IAAI,YAAY,CAAC,UAAU;QAAE,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IAE5D,IAAI,YAAY,CAAC,mBAAmB,IAAI,IAAI;QAAE,OAAO;IACrD,YAAY,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC;IACvC,YAAY,CAAC,mBAA2B,CAAC,UAAU,CAAC,OAAO,CACxD,OAAO,IAAI,kCAAkC,CAChD,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { handlePlayerError } from "./error";
|
|
2
|
+
const hide = jest.fn();
|
|
3
|
+
const unload = jest.fn();
|
|
4
|
+
const setText = jest.fn();
|
|
5
|
+
const show = jest.fn();
|
|
6
|
+
const input = "string";
|
|
7
|
+
const player = { unload };
|
|
8
|
+
const uiComponents = {
|
|
9
|
+
controlbar: { hide },
|
|
10
|
+
errorMessageOverlay: {
|
|
11
|
+
errorLabel: { setText },
|
|
12
|
+
show,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
describe("Test DRM verification", () => {
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
jest.resetAllMocks();
|
|
18
|
+
});
|
|
19
|
+
it("should call player.unload", () => {
|
|
20
|
+
handlePlayerError(player, uiComponents, input);
|
|
21
|
+
expect(unload).toBeCalled();
|
|
22
|
+
});
|
|
23
|
+
it("should hide the controlbar", () => {
|
|
24
|
+
handlePlayerError(player, uiComponents, input);
|
|
25
|
+
expect(hide).toBeCalled();
|
|
26
|
+
});
|
|
27
|
+
it("should not hide the controlbar", () => {
|
|
28
|
+
const components = {
|
|
29
|
+
...uiComponents,
|
|
30
|
+
controlbar: undefined,
|
|
31
|
+
};
|
|
32
|
+
handlePlayerError(player, components, input);
|
|
33
|
+
expect(hide).not.toBeCalled();
|
|
34
|
+
});
|
|
35
|
+
it("should show the message overlay", () => {
|
|
36
|
+
handlePlayerError(player, uiComponents, input);
|
|
37
|
+
expect(show).toBeCalled();
|
|
38
|
+
expect(setText).toBeCalled();
|
|
39
|
+
});
|
|
40
|
+
it("should not show the message overlay", () => {
|
|
41
|
+
handlePlayerError(player, { ...uiComponents, errorMessageOverlay: undefined }, input);
|
|
42
|
+
expect(show).not.toBeCalled();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=error.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.test.js","sourceRoot":"","sources":["../../../../../src/js/playeractions/handlers/error.test.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AACvB,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AACzB,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAEvB,MAAM,KAAK,GAAG,QAAQ,CAAC;AACvB,MAAM,MAAM,GAAG,EAAE,MAAM,EAA0B,CAAC;AAElD,MAAM,YAAY,GAAiB;IAC/B,UAAU,EAAE,EAAE,IAAI,EAA2B;IAC7C,mBAAmB,EAAE;QACjB,UAAU,EAAE,EAAE,OAAO,EAAE;QACvB,IAAI;KAC2B;CACtC,CAAC;AAEF,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACnC,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACjC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} from 'types/interfaces';
|
|
4
|
+
export declare function handleStartOffset(player: PlayerAPI, offset?: number): void;
|
|
5
|
+
export declare function shiftToProgramStart(player: PlayerAPI | null, timestamp?: number): void;
|
|
6
|
+
export declare function handleLiveOffsetLogic(npoplayer: NpoPlayer, player: PlayerAPI | null, options: StreamOptions): void;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { PlayerEvent } from 'bitmovin-player';
|
|
2
|
+
/*
|
|
3
|
+
* This function seeks the player to the specified offset on a VOD,
|
|
4
|
+
* if the player is playing live content it will do nothing and parse a warn to the console.
|
|
5
|
+
* @function handleStartOffset
|
|
6
|
+
* @param {PlayerAPI} player - The Bitmovin player instance
|
|
7
|
+
* @param {number} offset - The offset to seek to in seconds
|
|
8
|
+
* @returns {void}
|
|
9
|
+
*/
|
|
10
|
+
export function handleStartOffset(player, offset) {
|
|
11
|
+
if (offset == null || player.isLive()) {
|
|
12
|
+
if (player.isLive()) {
|
|
13
|
+
console.warn('handleStartOffset was called but the player is playing live content.');
|
|
14
|
+
}
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
player.on(PlayerEvent.SourceLoaded, () => {
|
|
18
|
+
player.seek(offset);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/*
|
|
22
|
+
* This function rewinds a livestream to the specified unix timestamp,
|
|
23
|
+
* if the player is playing VOD content it will do nothing and parse a warn to the console.
|
|
24
|
+
* @function shiftToProgramStart
|
|
25
|
+
* @param {PlayerAPI} player - The Bitmovin player instance
|
|
26
|
+
* @param {number} timestamp - The unix timestamp to rewind to
|
|
27
|
+
* @returns {void}
|
|
28
|
+
*/
|
|
29
|
+
export function shiftToProgramStart(player, timestamp) {
|
|
30
|
+
if (player == null)
|
|
31
|
+
return;
|
|
32
|
+
if (timestamp == null || !player.isLive()) {
|
|
33
|
+
if (!player.isLive()) {
|
|
34
|
+
console.warn('shiftToProgramStart was called but the player is playing VOD content.');
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
player.timeShift(timestamp);
|
|
39
|
+
}
|
|
40
|
+
/*
|
|
41
|
+
* This functions handles the logic flow for showing the Watch from start button.
|
|
42
|
+
* If liveOffset is set to true, it will hide the button and rewind the player to the start of the program on load.
|
|
43
|
+
* @function handleLiveOffsetLogic
|
|
44
|
+
* @param {NpoPlayer} npoplayer - The NpoPlayer instance
|
|
45
|
+
* @param {PlayerAPI} player - The Bitmovin player instance
|
|
46
|
+
* @param {StreamOptions} options - The stream options object
|
|
47
|
+
* @returns {void}
|
|
48
|
+
*/
|
|
49
|
+
export function handleLiveOffsetLogic(npoplayer, player, options) {
|
|
50
|
+
if (player == null)
|
|
51
|
+
return;
|
|
52
|
+
if (npoplayer.uiComponents.watchFromStartButton == null)
|
|
53
|
+
return;
|
|
54
|
+
if (options?.liveProgramTime == null) {
|
|
55
|
+
npoplayer.uiComponents.watchFromStartButton.hide();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
// set the value present in streamoptions on the npoplayer instance to supplement the button click handler
|
|
59
|
+
npoplayer.streamOptions.liveProgramTime = options.liveProgramTime;
|
|
60
|
+
if (player.isLive() && options.liveProgramTime > 0) {
|
|
61
|
+
npoplayer.uiComponents.watchFromStartButton.show();
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
npoplayer.uiComponents.watchFromStartButton.hide();
|
|
65
|
+
}
|
|
66
|
+
if (options.liveOffset !== null && options.liveOffset !== false && options.liveProgramTime > 0) {
|
|
67
|
+
npoplayer.uiComponents.watchFromStartButton.hide();
|
|
68
|
+
shiftToProgramStart(player, options.liveProgramTime);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=handleoffsets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleoffsets.js","sourceRoot":"","sources":["../../../../../src/js/playeractions/handlers/handleoffsets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAA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