@npo/player 1.20.3 → 1.20.4

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.
@@ -1,3 +1,3 @@
1
1
  import { StreamObject } from 'types/interfaces';
2
2
  import { SourceConfig } from 'bitmovin-player';
3
- export declare function processSourceConfig(_sourceConfig: SourceConfig | undefined, _streamObject: StreamObject, drm?: string | null): SourceConfig;
3
+ export declare function processSourceConfig(_sourceConfig: SourceConfig | undefined, _streamObject: StreamObject, drm?: string | null): Promise<SourceConfig>;
@@ -1,7 +1,7 @@
1
1
  import { HttpResponseType } from 'bitmovin-player';
2
2
  import { npoCdnProviders } from '../../cdnproviders';
3
3
  import { replaceSpecialChars } from '../../utilities/utilities';
4
- function setDrm(sourceConfig, drm, _streamObject) {
4
+ async function setDrm(sourceConfig, drm, _streamObject) {
5
5
  const npoDrmGateway = 'https://npo-drm-gateway.samgcloud.nepworldwide.nl/authentication?custom_data=';
6
6
  switch (drm) {
7
7
  case 'fairplay':
@@ -36,9 +36,9 @@ function setDrm(sourceConfig, drm, _streamObject) {
36
36
  };
37
37
  break;
38
38
  case 'widevine':
39
- fetch('https://widevine.npoplayer.nl/widevine_player_cert.bin')
40
- .then(response => response.arrayBuffer())
41
- .then(certificate => {
39
+ try {
40
+ const response = await fetch('https://widevine.npoplayer.nl/widevine_player_cert.bin');
41
+ const certificate = await response.arrayBuffer();
42
42
  sourceConfig.drm = {
43
43
  widevine: {
44
44
  serverCertificate: certificate,
@@ -47,8 +47,10 @@ function setDrm(sourceConfig, drm, _streamObject) {
47
47
  videoRobustness: 'SW_SECURE_CRYPTO'
48
48
  }
49
49
  };
50
- })
51
- .catch(error => console.error('Error:', error));
50
+ }
51
+ catch (error) {
52
+ console.error('Error:', error);
53
+ }
52
54
  break;
53
55
  case 'playready':
54
56
  sourceConfig.drm = {
@@ -89,7 +91,7 @@ function setStreamProfile(sourceConfig, _sourceConfig, _streamObject) {
89
91
  }
90
92
  return sourceConfig;
91
93
  }
92
- export function processSourceConfig(_sourceConfig = {}, _streamObject, drm = null) {
94
+ export async function processSourceConfig(_sourceConfig = {}, _streamObject, drm = null) {
93
95
  let sourceConfig = {};
94
96
  sourceConfig.title =
95
97
  _sourceConfig.title ?? _streamObject.metadata.title ?? '';
@@ -123,7 +125,7 @@ export function processSourceConfig(_sourceConfig = {}, _streamObject, drm = nul
123
125
  : undefined;
124
126
  sourceConfig.options = _sourceConfig.options;
125
127
  sourceConfig = setStreamProfile(sourceConfig, _sourceConfig, _streamObject);
126
- sourceConfig = setDrm(sourceConfig, drm, _streamObject);
128
+ sourceConfig = await setDrm(sourceConfig, drm, _streamObject);
127
129
  const streamSource = _streamObject.stream.streamURL;
128
130
  let cdnString = streamSource;
129
131
  if (streamSource.startsWith('file:///')) {
package/lib/npoplayer.js CHANGED
@@ -129,7 +129,7 @@ export default class NpoPlayer {
129
129
  if (this.streamObject?.stream == undefined)
130
130
  return;
131
131
  const drmType = this.streamObject.stream.drmType ?? null;
132
- this.sourceConfig = playerAction.processSourceConfig(options.sourceConfig ?? {}, this.streamObject, drmType && drmType.length > 0 ? profile.drm : null);
132
+ this.sourceConfig = await playerAction.processSourceConfig(options.sourceConfig ?? {}, this.streamObject, drmType && drmType.length > 0 ? profile.drm : null);
133
133
  await drm.verifyDRM(this, this.player, payload);
134
134
  setupMediaSessionActionHandlers(this.player, this.sourceConfig, _streamObject);
135
135
  logEvent(this, 'load');
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npo/player",
3
- "version": "1.20.3",
3
+ "version": "1.20.4",
4
4
  "description": "NPO Player",
5
5
  "author": "Publieke Omroep <player@npo.nl>",
6
6
  "contributors": [
@@ -1,3 +1,3 @@
1
1
  import { StreamObject } from 'types/interfaces';
2
2
  import { SourceConfig } from 'bitmovin-player';
3
- export declare function processSourceConfig(_sourceConfig: SourceConfig | undefined, _streamObject: StreamObject, drm?: string | null): SourceConfig;
3
+ export declare function processSourceConfig(_sourceConfig: SourceConfig | undefined, _streamObject: StreamObject, drm?: string | null): Promise<SourceConfig>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npo/player",
3
- "version": "1.20.3",
3
+ "version": "1.20.4",
4
4
  "description": "NPO Player",
5
5
  "author": "Publieke Omroep <player@npo.nl>",
6
6
  "contributors": [