@npo/player 1.18.4 → 1.20.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.
Files changed (67) hide show
  1. package/README.md +4 -1
  2. package/lib/js/ads/ster.js +2 -0
  3. package/lib/js/drm/handlers/decideprofile.js +17 -17
  4. package/lib/js/drm/handlers/decideprofile.test.d.ts +1 -0
  5. package/lib/js/drm/handlers/decideprofile.test.js +33 -0
  6. package/lib/js/fragments/removefragments.d.ts +1 -2
  7. package/lib/js/fragments/removefragments.js +1 -5
  8. package/lib/js/fragments/removefragments.test.d.ts +1 -0
  9. package/lib/js/fragments/removefragments.test.js +26 -0
  10. package/lib/js/fragments/setfragments.d.ts +1 -1
  11. package/lib/js/fragments/setfragments.js +19 -13
  12. package/lib/js/fragments/setfragments.test.d.ts +1 -0
  13. package/lib/js/fragments/setfragments.test.js +72 -0
  14. package/lib/js/playeractions/handlers/handleoffsets.js +8 -5
  15. package/lib/js/playeractions/handlers/processsourceconfig.js +13 -7
  16. package/lib/js/playeractions/handlers/removereplayclass.d.ts +2 -0
  17. package/lib/js/playeractions/handlers/removereplayclass.js +11 -0
  18. package/lib/js/playeractions/handlers/removereplayclass.test.d.ts +1 -0
  19. package/lib/js/playeractions/handlers/removereplayclass.test.js +28 -0
  20. package/lib/js/playeractions/handlers/resolvekeypress.test.d.ts +1 -0
  21. package/lib/js/playeractions/handlers/resolvekeypress.test.js +80 -0
  22. package/lib/js/tracking/handlers/eventlogging.test.d.ts +1 -0
  23. package/lib/js/tracking/handlers/eventlogging.test.js +46 -0
  24. package/lib/js/ui/components/controlbar.js +2 -1
  25. package/lib/js/ui/components/nativemobile/buttons.js +0 -1
  26. package/lib/js/ui/components/settingspanel.js +4 -0
  27. package/lib/js/ui/handlers/listboxhandlers.js +1 -0
  28. package/lib/js/ui/handlers/nicamhandler.d.ts +3 -0
  29. package/lib/js/ui/handlers/nicamhandler.js +16 -0
  30. package/lib/js/ui/handlers/streamhandler.js +1 -1
  31. package/lib/js/ui/nativemobileuicontainer.js +2 -2
  32. package/lib/js/ui/nativemobileuifactory.js +18 -26
  33. package/lib/js/ui/uicontainer.d.ts +1 -0
  34. package/lib/js/ui/uicontainer.js +8 -0
  35. package/lib/js/utilities/utilities.js +3 -4
  36. package/lib/npoplayer.d.ts +4 -2
  37. package/lib/npoplayer.js +117 -36
  38. package/lib/package.json +7 -7
  39. package/lib/src/js/drm/handlers/decideprofile.test.d.ts +1 -0
  40. package/lib/src/js/fragments/removefragments.d.ts +1 -2
  41. package/lib/src/js/fragments/removefragments.test.d.ts +1 -0
  42. package/lib/src/js/fragments/setfragments.d.ts +1 -1
  43. package/lib/src/js/fragments/setfragments.test.d.ts +1 -0
  44. package/lib/src/js/playeractions/handlers/removereplayclass.d.ts +2 -0
  45. package/lib/src/js/playeractions/handlers/removereplayclass.test.d.ts +1 -0
  46. package/lib/src/js/playeractions/handlers/resolvekeypress.test.d.ts +1 -0
  47. package/lib/src/js/tracking/handlers/eventlogging.test.d.ts +1 -0
  48. package/lib/src/js/ui/handlers/nicamhandler.d.ts +3 -0
  49. package/lib/src/js/ui/uicontainer.d.ts +1 -0
  50. package/lib/src/npoplayer.d.ts +4 -2
  51. package/lib/src/types/interfaces.d.ts +10 -0
  52. package/lib/tests/mocks/mockNpoplayer.d.ts +2 -0
  53. package/lib/tests/mocks/mockNpoplayer.js +115 -0
  54. package/lib/types/interfaces.d.ts +10 -0
  55. package/package.json +7 -7
  56. package/src/scss/components/_advert.scss +5 -5
  57. package/src/scss/components/_hugeplaybacktogglebutton.scss +1 -0
  58. package/src/scss/components/_metadata.scss +17 -0
  59. package/src/scss/components/_nicam.scss +20 -0
  60. package/src/scss/components/_replay.scss +2 -2
  61. package/src/scss/components/_seekbarthumbnail.scss +0 -1
  62. package/src/scss/components/_subtitles.scss +1 -1
  63. package/src/scss/npoplayer.css +39 -34
  64. package/src/scss/variants/_player-base.scss +7 -2
  65. package/lib/js/ui/handlers/playnexthandlers.d.ts +0 -0
  66. package/lib/js/ui/handlers/playnexthandlers.js +0 -1
  67. package/lib/src/js/ui/handlers/playnexthandlers.d.ts +0 -0
@@ -0,0 +1,115 @@
1
+ export const mockNpoPlayer = {
2
+ playerConfig: {
3
+ key: jest.fn().mockReturnValue('mock-key'),
4
+ source: {
5
+ dash: jest.fn().mockReturnValue('mock-dash'),
6
+ hls: jest.fn().mockReturnValue('mock-hls'),
7
+ progressive: jest.fn().mockReturnValue('mock-progressive'),
8
+ poster: jest.fn().mockReturnValue('mock-poster')
9
+ },
10
+ playback: {
11
+ autoplay: jest.fn().mockReturnValue(true),
12
+ muted: jest.fn().mockReturnValue(false)
13
+ },
14
+ style: {
15
+ width: jest.fn().mockReturnValue('100%'),
16
+ aspectratio: jest.fn().mockReturnValue('16:9')
17
+ }
18
+ },
19
+ sourceConfig: {},
20
+ streamObject: {},
21
+ uiManager: null,
22
+ canceledPlayNextScreen: false,
23
+ npoTag: undefined,
24
+ fragment: null,
25
+ logEmitter: {},
26
+ uiComponents: {
27
+ settingsPanel: {
28
+ isShown: jest.fn().mockReturnValue(true),
29
+ hide: jest.fn(),
30
+ activePage: jest.fn(),
31
+ navigationStack: jest.fn(),
32
+ settingsPanelEvents: jest.fn(),
33
+ hideTimeout: jest.fn(),
34
+ },
35
+ },
36
+ container: document.createElement('div'),
37
+ initPlayer: jest.fn(),
38
+ loadStream: jest.fn(),
39
+ createUIManager: jest.fn(),
40
+ doError: jest.fn(),
41
+ player: {
42
+ getCurrentTime: jest.fn().mockReturnValue(10),
43
+ },
44
+ streamTracker: {
45
+ start: jest.fn(),
46
+ buffering: jest.fn(),
47
+ buffering_complete: jest.fn(),
48
+ complete: jest.fn(),
49
+ fullscreen: jest.fn(),
50
+ load: jest.fn(),
51
+ load_complete: jest.fn(),
52
+ pause: jest.fn(),
53
+ resume: jest.fn(),
54
+ stop: jest.fn(),
55
+ windowed: jest.fn(),
56
+ time: jest.fn(),
57
+ seek: jest.fn(),
58
+ },
59
+ adBreakActive: false,
60
+ streamOptions: {},
61
+ jwt: '',
62
+ apiPayload: {},
63
+ version: '',
64
+ drmProfile: {},
65
+ variant: '',
66
+ isShowingPlayNextScreen: false,
67
+ keyPress: function (e) {
68
+ jest.fn();
69
+ },
70
+ setVolume: function (volume) {
71
+ jest.fn();
72
+ },
73
+ increaseVolume: function () {
74
+ jest.fn();
75
+ },
76
+ decreaseVolume: function () {
77
+ jest.fn();
78
+ },
79
+ goForward: function (seconds) {
80
+ jest.fn();
81
+ },
82
+ goBackwards: function (seconds) {
83
+ jest.fn();
84
+ },
85
+ watchFromStart: function () {
86
+ jest.fn();
87
+ },
88
+ showPlayNextScreen: function () {
89
+ jest.fn();
90
+ },
91
+ cancelPlayNextScreen: function () {
92
+ jest.fn();
93
+ },
94
+ hidePlayNextScreen: function () {
95
+ jest.fn();
96
+ },
97
+ doPlayNext: function () {
98
+ jest.fn();
99
+ },
100
+ destroy: function (asyncMode) {
101
+ throw new Error('Function not implemented.');
102
+ },
103
+ unload: function (asyncMode) {
104
+ throw new Error('Function not implemented.');
105
+ },
106
+ printVersion: function () {
107
+ jest.fn();
108
+ },
109
+ play: function () {
110
+ throw new Error('Function not implemented.');
111
+ },
112
+ pause: function () {
113
+ throw new Error('Function not implemented.');
114
+ }
115
+ };
@@ -15,6 +15,15 @@ export interface ApiPayload {
15
15
  baseURL: string;
16
16
  jwt: string;
17
17
  data: Record<string, unknown>;
18
+ ster?: SterData;
19
+ }
20
+ interface SterData {
21
+ identifier: string;
22
+ site?: string;
23
+ deviceType?: number;
24
+ os?: string;
25
+ osVersion?: string;
26
+ player?: string;
18
27
  }
19
28
  export interface DRMProfile {
20
29
  profileName: string;
@@ -86,6 +95,7 @@ export interface StreamOptions {
86
95
  ageRating?: string;
87
96
  nicam?: string[] | null;
88
97
  playNext?: PlayNext;
98
+ ster?: SterData;
89
99
  }
90
100
  export interface UIComponents {
91
101
  errorMessageOverlay?: ErrorMessageOverlay;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npo/player",
3
- "version": "1.18.4",
3
+ "version": "1.20.0",
4
4
  "description": "NPO Player",
5
5
  "author": "Publieke Omroep <player@npo.nl>",
6
6
  "contributors": [
@@ -9,7 +9,7 @@
9
9
  "Arjan Kruithof"
10
10
  ],
11
11
  "engines": {
12
- "node": "^18.16.0"
12
+ "node": "^18 || ^20"
13
13
  },
14
14
  "license": "ISC",
15
15
  "main": "./lib/npoplayer",
@@ -24,7 +24,7 @@
24
24
  "bundle": "npm run lint && bash build-lib.sh && npm run build:scss && npm run build:cdn",
25
25
  "build:ts": "bash build-lib.sh",
26
26
  "test": "jest",
27
- "test:ci": "node_modules/.bin/jest",
27
+ "test:ci": "jest --collectCoverage --testResultsProcessor=jest-sonar-reporter",
28
28
  "version:dev": "npm version prerelease --preid=dev --no-git-tag-version"
29
29
  },
30
30
  "files": [
@@ -55,7 +55,7 @@
55
55
  "eslint-plugin-import": "^2.27.5",
56
56
  "eslint-plugin-n": "^15.7.0",
57
57
  "eslint-plugin-promise": "^6.1.1",
58
- "eslint-plugin-sonarjs": "^0.19.0",
58
+ "eslint-plugin-sonarjs": "^0.23.0",
59
59
  "fs-extra": "^11.1.1",
60
60
  "jest": "^28.1.3",
61
61
  "jest-environment-jsdom": "^29.4.1",
@@ -81,9 +81,9 @@
81
81
  "webpack-dev-server": "^4.11.1"
82
82
  },
83
83
  "dependencies": {
84
- "@npotag/tag": "^3.0.0",
85
- "bitmovin-player": "8.125.0",
86
- "bitmovin-player-ui": "^3.48.0"
84
+ "@npotag/tag": "^3.0.1",
85
+ "bitmovin-player": "8.151.0",
86
+ "bitmovin-player-ui": "3.54.0"
87
87
  },
88
88
  "browserslist": [
89
89
  "defaults",
@@ -18,19 +18,19 @@
18
18
  .bmpui-seekbar-bufferlevel {
19
19
  position: relative;
20
20
  z-index: 2;
21
- background-color: var(--npo-player-white);
21
+ background-color: #fff;
22
22
  opacity: 0.6;
23
23
  }
24
24
 
25
25
  .bmpui-seekbar-backdrop {
26
- background-color: var(--npo-player-white);
26
+ background-color: #fff;
27
27
  opacity: 0.3;
28
28
  }
29
29
 
30
30
  .bmpui-seekbar-playbackposition {
31
31
  position: relative;
32
32
  z-index: 3;
33
- background: var(--npo-player-white);
33
+ background: #fff;
34
34
  backdrop-filter: blur(50px);
35
35
  }
36
36
  }
@@ -42,7 +42,7 @@
42
42
  align-items: center;
43
43
  top: 24px;
44
44
  left: 24px;
45
- font-family: var(--fontBold);
45
+ font-family: 'NPOSansBold', sans-serif;
46
46
  font-weight: 700;
47
47
 
48
48
  &::before {
@@ -80,7 +80,7 @@
80
80
  width: fit-content;
81
81
 
82
82
  .bmpui-label {
83
- font-family: var(--fontNormal);
83
+ font-family: 'NPOSansRegular', sans-serif;
84
84
  font-weight: normal;
85
85
  font-size: 12px;
86
86
  line-height: 0;
@@ -3,6 +3,7 @@
3
3
  &.bmpui-player-state-finished {
4
4
  .bmpui-ui-playbacktoggle-overlay {
5
5
  display: unset;
6
+
6
7
  .bmpui-ui-hugeplaybacktogglebutton {
7
8
  .bmpui-image {
8
9
  animation: none;
@@ -2,12 +2,21 @@
2
2
  padding: 24px 18px;
3
3
  color: var(--npo-player-textcolor);
4
4
 
5
+ .bmpui-container-wrapper {
6
+ display: grid;
7
+ grid-template-columns: auto auto;
8
+ grid-template-rows: auto auto;
9
+ }
10
+
5
11
  .bmpui-label-metadata-title {
6
12
  font-family: var(--fontBold);
7
13
  font-style: normal;
8
14
  font-weight: 700;
9
15
  font-size: 16px;
10
16
  line-height: 19.2px;
17
+ grid-column: 1;
18
+ grid-row: 1;
19
+ gap: 0;
11
20
  }
12
21
 
13
22
  .bmpui-label-metadata-description {
@@ -18,6 +27,8 @@
18
27
  line-height: 20px;
19
28
  margin: 4px 0;
20
29
  opacity: 0.65;
30
+ grid-column: 1;
31
+ grid-row: 2;
21
32
 
22
33
  // Max 4 lines
23
34
  display: -webkit-box;
@@ -26,4 +37,10 @@
26
37
  overflow: hidden;
27
38
  text-overflow: ellipsis;
28
39
  }
40
+
41
+ .bmpui-nicam {
42
+ grid-column: 2;
43
+ grid-row: 1;
44
+ justify-content: end;
45
+ }
29
46
  }
@@ -77,4 +77,24 @@
77
77
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 102 102'><g><path d='M1,51a50,50,0,1,1,50,50A50.018,50.018,0,0,1,1,51Z' fill='%23fff'/><path d='M7.4,51A43.6,43.6,0,1,1,51,94.6,43.51,43.51,0,0,1,7.4,51ZM82.2,66.9,35.1,19.7A35.793,35.793,0,0,0,19.7,35.1L66.8,82.2A35.552,35.552,0,0,0,82.2,66.9Z'/></g></svg>");
78
78
  }
79
79
  }
80
+ }
81
+
82
+ // show nicam on default state
83
+ &.bmpui-player-state-prepared,
84
+ &.bmpui-player-state-prepared.bmpui-layout-max-width-400,
85
+ &.bmpui-player-state-prepared.bmpui-layout-max-width-600,
86
+ &.show-nicam:not(.bmpui-player-state-paused).bmpui-layout-max-width-400,
87
+ &.show-nicam:not(.bmpui-player-state-paused).bmpui-layout-max-width-600 {
88
+ .bmpui-metadata,
89
+ .bmpui-metadata.bmpui-title-bar {
90
+ display: block;
91
+ opacity: 1;
92
+ visibility: visible;
93
+ background: none;
94
+
95
+ .bmpui-label-metadata-title,
96
+ .bmpui-label-metadata-description {
97
+ display: none;
98
+ }
99
+ }
80
100
  }
@@ -1,4 +1,5 @@
1
- &.bmpui-player-state-finished {
1
+ &.bmpui-player-state-finished,
2
+ &.bmpui-player-state-replay {
2
3
  .bmpui-ui-playbacktoggle-overlay {
3
4
  display: block !important;
4
5
 
@@ -14,7 +15,6 @@
14
15
 
15
16
  &::after {
16
17
  animation: none;
17
- background-color: transparent;
18
18
  background-repeat: no-repeat;
19
19
  background-position: 50% 50%;
20
20
  background-color: var(--npo-player-iconcolor);
@@ -13,7 +13,6 @@
13
13
  width: 148px;
14
14
  border-radius: 12px;
15
15
  border: 2px solid var(--npo-player-white);
16
- border-radius: 12px;
17
16
  box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.35);
18
17
  margin-bottom: 4px;
19
18
  display: none;
@@ -20,6 +20,7 @@
20
20
  overflow: hidden;
21
21
  writing-mode: horizontal-tb;
22
22
  width: 100% !important;
23
+ inset: none !important;
23
24
  display: block !important;
24
25
  bottom: 18px !important;
25
26
  left: 0 !important;
@@ -27,7 +28,6 @@
27
28
  top: auto !important;
28
29
  font-size: 1em !important;
29
30
  font-weight: 400 !important;
30
- inset: none !important;
31
31
  padding: 0 18px;
32
32
 
33
33
  @container (min-width: 600px) {