@npo/player 1.22.4 → 1.23.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 (415) hide show
  1. package/README.md +1 -1
  2. package/lib/js/ads/ster.js +23 -21
  3. package/lib/js/ads/ster.test.js +17 -17
  4. package/lib/js/api/getstreamobject.js +7 -7
  5. package/lib/js/api/getstreamobject.test.js +3 -3
  6. package/lib/js/markers/updateLiveMarkers.d.ts +3 -3
  7. package/lib/js/markers/updateLiveMarkers.js +14 -15
  8. package/lib/js/markers/updateLiveMarkers.test.js +11 -12
  9. package/lib/js/playeractions/customerrors.test.js +33 -33
  10. package/lib/js/playeractions/handlers/customerrors.js +48 -48
  11. package/lib/js/playeractions/handlers/error.js +1 -1
  12. package/lib/js/playeractions/handlers/error.test.js +11 -11
  13. package/lib/js/playeractions/handlers/handleoffsets.d.ts +2 -2
  14. package/lib/js/playeractions/handlers/handleoffsets.js +6 -6
  15. package/lib/js/playeractions/handlers/handleoffsets.test.js +12 -12
  16. package/lib/js/playeractions/handlers/mediasessionactions.d.ts +1 -1
  17. package/lib/js/playeractions/handlers/mediasessionactions.js +20 -15
  18. package/lib/js/playeractions/handlers/processplayerconfig.d.ts +2 -2
  19. package/lib/js/playeractions/handlers/processplayerconfig.js +4 -4
  20. package/lib/js/playeractions/handlers/processsourceconfig.d.ts +2 -1
  21. package/lib/js/playeractions/handlers/processsourceconfig.js +52 -46
  22. package/lib/js/playeractions/handlers/removereplayclass.d.ts +1 -1
  23. package/lib/js/playeractions/handlers/removereplayclass.test.d.ts +1 -1
  24. package/lib/js/playeractions/handlers/removereplayclass.test.js +7 -6
  25. package/lib/js/playeractions/playeractions.d.ts +4 -5
  26. package/lib/js/playeractions/playeractions.js +4 -5
  27. package/lib/js/settings/settings.user-agent.d.ts +1 -0
  28. package/lib/js/settings/settings.user-agent.js +1 -0
  29. package/lib/js/tracking/handlers/eventbinding.js +9 -9
  30. package/lib/js/tracking/handlers/eventlogging.js +2 -2
  31. package/lib/js/tracking/handlers/eventlogging.test.js +2 -2
  32. package/lib/js/tracking/handlers/playertrackerinit.d.ts +1 -1
  33. package/lib/js/tracking/handlers/playertrackerinit.js +5 -11
  34. package/lib/js/tracking/handlers/playertrackerstart.d.ts +1 -1
  35. package/lib/js/tracking/handlers/playertrackerstart.js +5 -10
  36. package/lib/js/utilities/utilities.element.d.ts +10 -0
  37. package/lib/js/utilities/utilities.element.js +8 -0
  38. package/lib/js/utilities/utilities.element.test.js +25 -0
  39. package/lib/js/utilities/utilities.jwt.d.ts +3 -0
  40. package/lib/js/utilities/utilities.jwt.js +22 -0
  41. package/lib/js/utilities/utilities.jwt.test.js +32 -0
  42. package/lib/js/utilities/utilities.locale.d.ts +2 -0
  43. package/lib/js/utilities/utilities.locale.js +4 -0
  44. package/lib/js/utilities/utilities.locale.test.js +10 -0
  45. package/lib/js/utilities/utilities.module.d.ts +1 -0
  46. package/lib/js/utilities/utilities.module.js +4 -0
  47. package/lib/js/utilities/utilities.module.test.js +19 -0
  48. package/lib/js/utilities/utilities.stream.d.ts +7 -0
  49. package/lib/js/utilities/utilities.stream.js +10 -0
  50. package/lib/js/utilities/utilities.stream.test.js +32 -0
  51. package/lib/js/utilities/utilities.text.d.ts +1 -0
  52. package/lib/js/utilities/utilities.text.js +3 -0
  53. package/lib/js/utilities/utilities.text.test.js +18 -0
  54. package/lib/js/utilities/utilities.time.d.ts +1 -0
  55. package/lib/js/utilities/utilities.time.js +3 -0
  56. package/lib/js/utilities/utilities.time.test.js +8 -0
  57. package/lib/js/utilities/utilities.url.d.ts +3 -0
  58. package/lib/js/utilities/utilities.url.js +29 -0
  59. package/lib/js/utilities/utilities.url.test.js +46 -0
  60. package/lib/js/utilities/utilities.user-agent.d.ts +3 -0
  61. package/lib/js/utilities/utilities.user-agent.js +13 -0
  62. package/lib/js/utilities/utilities.user-agent.test.js +60 -0
  63. package/lib/js/utilities/utilities.version.d.ts +1 -0
  64. package/lib/js/utilities/{printversion.js → utilities.version.js} +8 -8
  65. package/lib/js/utilities/utilities.version.test.js +26 -0
  66. package/lib/lang/nl.json +2 -1
  67. package/lib/npoplayer-bridge.test.d.ts +1 -1
  68. package/lib/npoplayer-bridge.test.js +6 -5
  69. package/lib/npoplayer.d.ts +14 -10
  70. package/lib/npoplayer.js +116 -124
  71. package/lib/npoplayer.test.js +3 -3
  72. package/lib/package.json +19 -12
  73. package/lib/services/a11y/setup.d.ts +2 -0
  74. package/lib/services/a11y/setup.js +18 -0
  75. package/lib/services/a11y/setup.test.js +109 -0
  76. package/lib/services/avTypeHandlers/getAVType.d.ts +2 -0
  77. package/lib/services/avTypeHandlers/getAVType.js +9 -0
  78. package/lib/services/avTypeHandlers/getAVType.test.js +18 -0
  79. package/lib/services/drmHandlers/constants.d.ts +15 -0
  80. package/lib/services/drmHandlers/constants.js +13 -0
  81. package/lib/services/drmHandlers/decideprofile.d.ts +2 -0
  82. package/lib/services/drmHandlers/decideprofile.js +51 -0
  83. package/lib/services/drmHandlers/decideprofile.test.js +34 -0
  84. package/lib/services/drmHandlers/drmhandlers.d.ts +2 -0
  85. package/lib/services/drmHandlers/drmhandlers.js +2 -0
  86. package/lib/services/drmHandlers/utils.d.ts +5 -0
  87. package/lib/services/drmHandlers/utils.js +26 -0
  88. package/lib/services/drmHandlers/utils.test.js +74 -0
  89. package/lib/services/drmHandlers/verifydrm.d.ts +2 -0
  90. package/lib/services/drmHandlers/verifydrm.js +40 -0
  91. package/lib/services/drmHandlers/verifydrm.test.js +89 -0
  92. package/lib/services/eventListenerHandlers/removeEventListeners.d.ts +2 -0
  93. package/lib/services/eventListenerHandlers/removeEventListeners.js +18 -0
  94. package/lib/services/eventListenerHandlers/removeEventListeners.test.js +27 -0
  95. package/lib/services/keyboardHandlers/resolvekeypress.d.ts +2 -0
  96. package/lib/services/keyboardHandlers/resolvekeypress.js +49 -0
  97. package/lib/{js/playeractions/handlers → services/keyboardHandlers}/resolvekeypress.test.js +21 -13
  98. package/lib/services/liveStreamHandlers/handleLiveStreamControls.d.ts +6 -0
  99. package/lib/services/liveStreamHandlers/handleLiveStreamControls.js +35 -0
  100. package/lib/services/localStorageHandlers/localStorageHandlers.d.ts +4 -0
  101. package/lib/services/localStorageHandlers/localStorageHandlers.js +33 -0
  102. package/lib/services/localStorageHandlers/localStorageHandlers.test.js +109 -0
  103. package/lib/services/npoPlayerAPI/npoPlayerAPI.d.ts +30 -0
  104. package/lib/services/npoPlayerAPI/npoPlayerAPI.js +91 -0
  105. package/lib/services/npoPlayerAPI/npoPlayerAPI.test.js +51 -0
  106. package/lib/services/segmentHandlers/addSegmentEventListeners.d.ts +2 -0
  107. package/lib/services/segmentHandlers/addSegmentEventListeners.js +14 -0
  108. package/lib/services/segmentHandlers/addSegmentEventListeners.test.js +43 -0
  109. package/lib/services/segmentHandlers/convertFragmentToSegment.d.ts +2 -0
  110. package/lib/services/segmentHandlers/convertFragmentToSegment.js +8 -0
  111. package/lib/services/segmentHandlers/convertFragmentToSegment.test.js +17 -0
  112. package/lib/services/segmentHandlers/handleSegmentSeek.d.ts +5 -0
  113. package/lib/services/segmentHandlers/handleSegmentSeek.js +15 -0
  114. package/lib/services/segmentHandlers/handleSegmentSeek.test.js +73 -0
  115. package/lib/services/segmentHandlers/handleSegmentTimeChanged.d.ts +2 -0
  116. package/lib/services/segmentHandlers/handleSegmentTimeChanged.js +21 -0
  117. package/lib/services/segmentHandlers/handleSegmentTimeChanged.test.d.ts +1 -0
  118. package/lib/services/segmentHandlers/handleSegmentTimeChanged.test.js +34 -0
  119. package/lib/services/segmentHandlers/initSegment.d.ts +7 -0
  120. package/lib/services/segmentHandlers/initSegment.js +10 -0
  121. package/lib/services/segmentHandlers/initSegment.test.d.ts +1 -0
  122. package/lib/services/segmentHandlers/initSegment.test.js +36 -0
  123. package/lib/services/segmentHandlers/setSegmentMarkers.d.ts +2 -0
  124. package/lib/services/segmentHandlers/setSegmentMarkers.js +25 -0
  125. package/lib/services/segmentHandlers/setSegmentMarkers.test.d.ts +1 -0
  126. package/lib/services/segmentHandlers/setSegmentMarkers.test.js +32 -0
  127. package/lib/services/services.d.ts +14 -0
  128. package/lib/services/services.js +47 -0
  129. package/lib/src/js/markers/updateLiveMarkers.d.ts +3 -3
  130. package/lib/src/js/playeractions/handlers/handleoffsets.d.ts +2 -2
  131. package/lib/src/js/playeractions/handlers/mediasessionactions.d.ts +1 -1
  132. package/lib/src/js/playeractions/handlers/processplayerconfig.d.ts +2 -2
  133. package/lib/src/js/playeractions/handlers/processsourceconfig.d.ts +2 -1
  134. package/lib/src/js/playeractions/handlers/removereplayclass.d.ts +1 -1
  135. package/lib/src/js/playeractions/handlers/removereplayclass.test.d.ts +1 -1
  136. package/lib/src/js/playeractions/playeractions.d.ts +4 -5
  137. package/lib/src/js/settings/settings.user-agent.d.ts +1 -0
  138. package/lib/src/js/tracking/handlers/playertrackerinit.d.ts +1 -1
  139. package/lib/src/js/tracking/handlers/playertrackerstart.d.ts +1 -1
  140. package/lib/src/js/utilities/utilities.element.d.ts +10 -0
  141. package/lib/src/js/utilities/utilities.element.test.d.ts +1 -0
  142. package/lib/src/js/utilities/utilities.jwt.d.ts +3 -0
  143. package/lib/src/js/utilities/utilities.jwt.test.d.ts +1 -0
  144. package/lib/src/js/utilities/utilities.locale.d.ts +2 -0
  145. package/lib/src/js/utilities/utilities.locale.test.d.ts +1 -0
  146. package/lib/src/js/utilities/utilities.module.d.ts +1 -0
  147. package/lib/src/js/utilities/utilities.module.test.d.ts +1 -0
  148. package/lib/src/js/utilities/utilities.stream.d.ts +7 -0
  149. package/lib/src/js/utilities/utilities.stream.test.d.ts +1 -0
  150. package/lib/src/js/utilities/utilities.text.d.ts +1 -0
  151. package/lib/src/js/utilities/utilities.text.test.d.ts +1 -0
  152. package/lib/src/js/utilities/utilities.time.d.ts +1 -0
  153. package/lib/src/js/utilities/utilities.time.test.d.ts +1 -0
  154. package/lib/src/js/utilities/utilities.url.d.ts +3 -0
  155. package/lib/src/js/utilities/utilities.url.test.d.ts +1 -0
  156. package/lib/src/js/utilities/utilities.user-agent.d.ts +3 -0
  157. package/lib/src/js/utilities/utilities.user-agent.test.d.ts +1 -0
  158. package/lib/src/js/utilities/utilities.version.d.ts +1 -0
  159. package/lib/src/js/utilities/utilities.version.test.d.ts +1 -0
  160. package/lib/src/npoplayer-bridge.test.d.ts +1 -1
  161. package/lib/src/npoplayer.d.ts +14 -10
  162. package/lib/src/services/a11y/setup.d.ts +2 -0
  163. package/lib/src/services/a11y/setup.test.d.ts +1 -0
  164. package/lib/src/services/avTypeHandlers/getAVType.d.ts +2 -0
  165. package/lib/src/services/avTypeHandlers/getAVType.test.d.ts +1 -0
  166. package/lib/src/services/drmHandlers/constants.d.ts +15 -0
  167. package/lib/src/services/drmHandlers/decideprofile.d.ts +2 -0
  168. package/lib/src/services/drmHandlers/decideprofile.test.d.ts +1 -0
  169. package/lib/src/services/drmHandlers/drmhandlers.d.ts +2 -0
  170. package/lib/src/services/drmHandlers/utils.d.ts +5 -0
  171. package/lib/src/services/drmHandlers/utils.test.d.ts +1 -0
  172. package/lib/src/services/drmHandlers/verifydrm.d.ts +2 -0
  173. package/lib/src/services/drmHandlers/verifydrm.test.d.ts +1 -0
  174. package/lib/src/services/eventListenerHandlers/removeEventListeners.d.ts +2 -0
  175. package/lib/src/services/eventListenerHandlers/removeEventListeners.test.d.ts +1 -0
  176. package/lib/src/services/keyboardHandlers/resolvekeypress.d.ts +2 -0
  177. package/lib/src/services/keyboardHandlers/resolvekeypress.test.d.ts +1 -0
  178. package/lib/src/services/liveStreamHandlers/handleLiveStreamControls.d.ts +6 -0
  179. package/lib/src/services/localStorageHandlers/localStorageHandlers.d.ts +4 -0
  180. package/lib/src/services/localStorageHandlers/localStorageHandlers.test.d.ts +1 -0
  181. package/lib/src/services/npoPlayerAPI/npoPlayerAPI.d.ts +30 -0
  182. package/lib/src/services/npoPlayerAPI/npoPlayerAPI.test.d.ts +1 -0
  183. package/lib/src/services/segmentHandlers/addSegmentEventListeners.d.ts +2 -0
  184. package/lib/src/services/segmentHandlers/addSegmentEventListeners.test.d.ts +1 -0
  185. package/lib/src/services/segmentHandlers/convertFragmentToSegment.d.ts +2 -0
  186. package/lib/src/services/segmentHandlers/convertFragmentToSegment.test.d.ts +1 -0
  187. package/lib/src/services/segmentHandlers/handleSegmentSeek.d.ts +5 -0
  188. package/lib/src/services/segmentHandlers/handleSegmentSeek.test.d.ts +1 -0
  189. package/lib/src/services/segmentHandlers/handleSegmentTimeChanged.d.ts +2 -0
  190. package/lib/src/services/segmentHandlers/handleSegmentTimeChanged.test.d.ts +1 -0
  191. package/lib/src/services/segmentHandlers/initSegment.d.ts +7 -0
  192. package/lib/src/services/segmentHandlers/initSegment.test.d.ts +1 -0
  193. package/lib/src/services/segmentHandlers/setSegmentMarkers.d.ts +2 -0
  194. package/lib/src/services/segmentHandlers/setSegmentMarkers.test.d.ts +1 -0
  195. package/lib/src/services/services.d.ts +14 -0
  196. package/lib/src/types/events.d.ts +91 -0
  197. package/lib/src/types/interfaces.d.ts +39 -15
  198. package/lib/{js → src}/ui/components/adbutton.d.ts +1 -1
  199. package/lib/{js → src}/ui/components/adlabel.d.ts +1 -1
  200. package/lib/{js → src}/ui/components/audio/controlbar.d.ts +1 -1
  201. package/lib/{js → src}/ui/components/buttons.d.ts +3 -3
  202. package/lib/src/ui/components/controlbar.d.ts +3 -0
  203. package/lib/{js → src}/ui/components/ctabar.d.ts +2 -2
  204. package/lib/src/ui/components/nativemobile/controlbar.d.ts +3 -0
  205. package/lib/src/ui/components/nativemobile/topbar.d.ts +3 -0
  206. package/lib/{js → src}/ui/components/playnext.d.ts +1 -1
  207. package/lib/src/{js/ui → ui}/components/seekbar.d.ts +1 -1
  208. package/lib/src/{js/ui → ui}/components/settingspanel.d.ts +1 -1
  209. package/lib/{js → src}/ui/components/titlebar.d.ts +1 -1
  210. package/lib/src/ui/components/topbar.d.ts +3 -0
  211. package/lib/src/ui/handlers/accessibilityhandler.test.d.ts +1 -0
  212. package/lib/src/ui/handlers/domhandlers.d.ts +3 -0
  213. package/lib/src/ui/handlers/domhandlers.test.d.ts +1 -0
  214. package/lib/{js → src}/ui/handlers/nicamhandler.d.ts +2 -2
  215. package/lib/src/ui/handlers/nicamhandler.test.d.ts +1 -0
  216. package/lib/{js → src}/ui/handlers/playnextstreen.test.d.ts +1 -1
  217. package/lib/src/{js/ui → ui}/handlers/streamhandler.d.ts +2 -2
  218. package/lib/{js → src}/ui/nativemobileuicontainer.d.ts +1 -1
  219. package/lib/src/ui/nativemobileuifactory.test.d.ts +1 -0
  220. package/lib/{js → src}/ui/uicontainer.d.ts +2 -3
  221. package/lib/tests/mocks/mockNpoplayer.js +18 -15
  222. package/lib/tests/mocks/mockPlayerAPI.d.ts +3 -0
  223. package/lib/tests/mocks/mockPlayerAPI.js +181 -0
  224. package/lib/tests/mocks/mockPlayerContext.d.ts +2 -0
  225. package/lib/tests/mocks/mockPlayerContext.js +40 -0
  226. package/lib/types/events.d.ts +91 -0
  227. package/lib/types/events.js +1 -0
  228. package/lib/types/interfaces.d.ts +39 -15
  229. package/lib/types/interfaces.js +12 -0
  230. package/lib/{src/js/ui → ui}/components/adbutton.d.ts +1 -1
  231. package/lib/{src/js/ui → ui}/components/adlabel.d.ts +1 -1
  232. package/lib/{src/js/ui → ui}/components/audio/controlbar.d.ts +1 -1
  233. package/lib/{js/ui → ui}/components/audio/controlbar.js +2 -2
  234. package/lib/{src/js/ui → ui}/components/buttons.d.ts +3 -3
  235. package/lib/{js/ui → ui}/components/buttons.js +7 -7
  236. package/lib/ui/components/controlbar.d.ts +3 -0
  237. package/lib/{js/ui → ui}/components/controlbar.js +5 -2
  238. package/lib/{src/js/ui → ui}/components/ctabar.d.ts +3 -3
  239. package/lib/{js/ui → ui}/components/ctabar.js +4 -6
  240. package/lib/{js/ui → ui}/components/nativemobile/buttons.js +8 -6
  241. package/lib/ui/components/nativemobile/controlbar.d.ts +3 -0
  242. package/lib/{js/ui → ui}/components/nativemobile/controlbar.js +6 -4
  243. package/lib/{js/ui → ui}/components/nativemobile/ctabar.js +1 -1
  244. package/lib/ui/components/nativemobile/topbar.d.ts +3 -0
  245. package/lib/{js/ui → ui}/components/nativemobile/topbar.js +6 -3
  246. package/lib/{src/js/ui → ui}/components/playnext.d.ts +1 -1
  247. package/lib/{js/ui → ui}/components/playnext.js +1 -1
  248. package/lib/{js/ui → ui}/components/seekbar.d.ts +1 -1
  249. package/lib/{js/ui → ui}/components/seekbar.js +1 -1
  250. package/lib/{js/ui → ui}/components/settingspanel.d.ts +1 -1
  251. package/lib/{js/ui → ui}/components/settingspanel.js +23 -40
  252. package/lib/{src/js/ui → ui}/components/titlebar.d.ts +1 -1
  253. package/lib/ui/components/topbar.d.ts +3 -0
  254. package/lib/{js/ui → ui}/components/topbar.js +8 -4
  255. package/lib/{js/ui → ui}/handlers/accessibilityhandler.js +10 -10
  256. package/lib/ui/handlers/accessibilityhandler.test.d.ts +1 -0
  257. package/lib/ui/handlers/domhandlers.d.ts +3 -0
  258. package/lib/ui/handlers/domhandlers.js +7 -0
  259. package/lib/ui/handlers/domhandlers.test.d.ts +1 -0
  260. package/lib/ui/handlers/domhandlers.test.js +51 -0
  261. package/lib/{js/ui → ui}/handlers/listboxhandlers.js +7 -7
  262. package/lib/{src/js/ui → ui}/handlers/nicamhandler.d.ts +2 -2
  263. package/lib/{js/ui → ui}/handlers/nicamhandler.js +31 -10
  264. package/lib/ui/handlers/nicamhandler.test.d.ts +1 -0
  265. package/lib/{js/ui → ui}/handlers/nicamhandler.test.js +4 -3
  266. package/lib/{js/ui → ui}/handlers/playnextscreen.js +1 -1
  267. package/lib/{src/js/ui → ui}/handlers/playnextstreen.test.d.ts +1 -1
  268. package/lib/{js/ui → ui}/handlers/playnextstreen.test.js +5 -3
  269. package/lib/{js/ui → ui}/handlers/streamhandler.d.ts +2 -2
  270. package/lib/ui/handlers/streamhandler.js +51 -0
  271. package/lib/{src/js/ui → ui}/nativemobileuicontainer.d.ts +1 -1
  272. package/lib/{js/ui → ui}/nativemobileuicontainer.js +8 -13
  273. package/lib/{js/ui → ui}/nativemobileuifactory.js +20 -23
  274. package/lib/ui/nativemobileuifactory.test.d.ts +1 -0
  275. package/lib/{js/ui → ui}/nativemobileuifactory.test.js +8 -6
  276. package/lib/{src/js/ui → ui}/uicontainer.d.ts +2 -3
  277. package/lib/{js/ui → ui}/uicontainer.js +31 -45
  278. package/package.json +19 -12
  279. package/src/{scss → style}/components/_controlbars.scss +4 -0
  280. package/src/{scss → style}/components/_icons.scss +6 -0
  281. package/src/style/components/_poster.scss +3 -0
  282. package/src/{scss → style}/components/_settingspanel.scss +15 -1
  283. package/src/{scss → style}/components/_subtitles.scss +25 -16
  284. package/src/{scss → style}/npoplayer.css +30 -20
  285. package/src/{scss → style}/npoplayer.scss +3 -0
  286. package/src/{scss → style}/variants/_player-small.scss +9 -8
  287. package/lib/js/checks/apple.d.ts +0 -2
  288. package/lib/js/checks/apple.js +0 -19
  289. package/lib/js/checks/apple.test.js +0 -20
  290. package/lib/js/drm/drm.d.ts +0 -2
  291. package/lib/js/drm/drm.js +0 -2
  292. package/lib/js/drm/handlers/decideprofile.d.ts +0 -3
  293. package/lib/js/drm/handlers/decideprofile.js +0 -53
  294. package/lib/js/drm/handlers/decideprofile.test.js +0 -33
  295. package/lib/js/drm/handlers/verifydrm.d.ts +0 -4
  296. package/lib/js/drm/handlers/verifydrm.js +0 -24
  297. package/lib/js/drm/handlers/verifydrm.test.js +0 -17
  298. package/lib/js/fragments/removefragments.d.ts +0 -2
  299. package/lib/js/fragments/removefragments.js +0 -5
  300. package/lib/js/fragments/removefragments.test.js +0 -26
  301. package/lib/js/fragments/setfragments.d.ts +0 -6
  302. package/lib/js/fragments/setfragments.js +0 -78
  303. package/lib/js/fragments/setfragments.test.js +0 -72
  304. package/lib/js/playeractions/handlers/resolvekeypress.d.ts +0 -3
  305. package/lib/js/playeractions/handlers/resolvekeypress.js +0 -52
  306. package/lib/js/ui/components/controlbar.d.ts +0 -3
  307. package/lib/js/ui/components/nativemobile/addFragments.d.ts +0 -1
  308. package/lib/js/ui/components/nativemobile/addFragments.js +0 -7
  309. package/lib/js/ui/components/nativemobile/controlbar.d.ts +0 -3
  310. package/lib/js/ui/components/nativemobile/topbar.d.ts +0 -3
  311. package/lib/js/ui/components/topbar.d.ts +0 -3
  312. package/lib/js/ui/handlers/domhandlers.d.ts +0 -3
  313. package/lib/js/ui/handlers/domhandlers.js +0 -7
  314. package/lib/js/ui/handlers/domhandlers.test.js +0 -50
  315. package/lib/js/ui/handlers/streamhandler.js +0 -40
  316. package/lib/js/utilities/printversion.d.ts +0 -1
  317. package/lib/js/utilities/utilities.d.ts +0 -16
  318. package/lib/js/utilities/utilities.js +0 -78
  319. package/lib/js/utilities/utilities.test.js +0 -50
  320. package/lib/src/js/checks/apple.d.ts +0 -2
  321. package/lib/src/js/drm/drm.d.ts +0 -2
  322. package/lib/src/js/drm/handlers/decideprofile.d.ts +0 -3
  323. package/lib/src/js/drm/handlers/verifydrm.d.ts +0 -4
  324. package/lib/src/js/fragments/removefragments.d.ts +0 -2
  325. package/lib/src/js/fragments/setfragments.d.ts +0 -6
  326. package/lib/src/js/playeractions/handlers/resolvekeypress.d.ts +0 -3
  327. package/lib/src/js/ui/components/controlbar.d.ts +0 -3
  328. package/lib/src/js/ui/components/nativemobile/addFragments.d.ts +0 -1
  329. package/lib/src/js/ui/components/nativemobile/controlbar.d.ts +0 -3
  330. package/lib/src/js/ui/components/nativemobile/topbar.d.ts +0 -3
  331. package/lib/src/js/ui/components/topbar.d.ts +0 -3
  332. package/lib/src/js/ui/handlers/domhandlers.d.ts +0 -3
  333. package/lib/src/js/utilities/printversion.d.ts +0 -1
  334. package/lib/src/js/utilities/utilities.d.ts +0 -16
  335. /package/lib/js/{utilities/localizationconfig.d.ts → settings/localization.d.ts} +0 -0
  336. /package/lib/js/{utilities/localizationconfig.js → settings/localization.js} +0 -0
  337. /package/lib/js/{checks/apple.test.d.ts → utilities/utilities.element.test.d.ts} +0 -0
  338. /package/lib/js/{drm/handlers/decideprofile.test.d.ts → utilities/utilities.jwt.test.d.ts} +0 -0
  339. /package/lib/js/{drm/handlers/verifydrm.test.d.ts → utilities/utilities.locale.test.d.ts} +0 -0
  340. /package/lib/js/{fragments/removefragments.test.d.ts → utilities/utilities.module.test.d.ts} +0 -0
  341. /package/lib/js/{fragments/setfragments.test.d.ts → utilities/utilities.stream.test.d.ts} +0 -0
  342. /package/lib/js/{playeractions/handlers/resolvekeypress.test.d.ts → utilities/utilities.text.test.d.ts} +0 -0
  343. /package/lib/js/{ui/handlers/accessibilityhandler.test.d.ts → utilities/utilities.time.test.d.ts} +0 -0
  344. /package/lib/js/{ui/handlers/domhandlers.test.d.ts → utilities/utilities.url.test.d.ts} +0 -0
  345. /package/lib/js/{ui/handlers/nicamhandler.test.d.ts → utilities/utilities.user-agent.test.d.ts} +0 -0
  346. /package/lib/js/{ui/nativemobileuifactory.test.d.ts → utilities/utilities.version.test.d.ts} +0 -0
  347. /package/lib/{js/utilities/utilities.test.d.ts → services/a11y/setup.test.d.ts} +0 -0
  348. /package/lib/{src/js/checks/apple.test.d.ts → services/avTypeHandlers/getAVType.test.d.ts} +0 -0
  349. /package/lib/{src/js/drm/handlers → services/drmHandlers}/decideprofile.test.d.ts +0 -0
  350. /package/lib/{src/js/drm/handlers/verifydrm.test.d.ts → services/drmHandlers/utils.test.d.ts} +0 -0
  351. /package/lib/{src/js/fragments/removefragments.test.d.ts → services/drmHandlers/verifydrm.test.d.ts} +0 -0
  352. /package/lib/{src/js/fragments/setfragments.test.d.ts → services/eventListenerHandlers/removeEventListeners.test.d.ts} +0 -0
  353. /package/lib/{src/js/playeractions/handlers → services/keyboardHandlers}/resolvekeypress.test.d.ts +0 -0
  354. /package/lib/{src/js/ui/handlers/accessibilityhandler.test.d.ts → services/localStorageHandlers/localStorageHandlers.test.d.ts} +0 -0
  355. /package/lib/{src/js/ui/handlers/domhandlers.test.d.ts → services/npoPlayerAPI/npoPlayerAPI.test.d.ts} +0 -0
  356. /package/lib/{src/js/ui/handlers/nicamhandler.test.d.ts → services/segmentHandlers/addSegmentEventListeners.test.d.ts} +0 -0
  357. /package/lib/{src/js/ui/nativemobileuifactory.test.d.ts → services/segmentHandlers/convertFragmentToSegment.test.d.ts} +0 -0
  358. /package/lib/{src/js/utilities/utilities.test.d.ts → services/segmentHandlers/handleSegmentSeek.test.d.ts} +0 -0
  359. /package/lib/src/js/{utilities/localizationconfig.d.ts → settings/localization.d.ts} +0 -0
  360. /package/lib/{js → src}/ui/components/nativemobile/buttons.d.ts +0 -0
  361. /package/lib/{js → src}/ui/components/nativemobile/ctabar.d.ts +0 -0
  362. /package/lib/{js → src}/ui/components/nativemobile/titlebar.d.ts +0 -0
  363. /package/lib/{js → src}/ui/handlers/accessibilityhandler.d.ts +0 -0
  364. /package/lib/{js → src}/ui/handlers/listboxhandlers.d.ts +0 -0
  365. /package/lib/{js → src}/ui/handlers/playnextscreen.d.ts +0 -0
  366. /package/lib/{js → src}/ui/handlers/timecontrolhandlers.d.ts +0 -0
  367. /package/lib/{js → src}/ui/nativemobileuifactory.d.ts +0 -0
  368. /package/lib/{js/ui → ui}/components/adbutton.js +0 -0
  369. /package/lib/{js/ui → ui}/components/adlabel.js +0 -0
  370. /package/lib/{src/js/ui → ui}/components/nativemobile/buttons.d.ts +0 -0
  371. /package/lib/{src/js/ui → ui}/components/nativemobile/ctabar.d.ts +0 -0
  372. /package/lib/{src/js/ui → ui}/components/nativemobile/titlebar.d.ts +0 -0
  373. /package/lib/{js/ui → ui}/components/nativemobile/titlebar.js +0 -0
  374. /package/lib/{js/ui → ui}/components/titlebar.js +0 -0
  375. /package/lib/{src/js/ui → ui}/handlers/accessibilityhandler.d.ts +0 -0
  376. /package/lib/{js/ui → ui}/handlers/accessibilityhandler.test.js +0 -0
  377. /package/lib/{src/js/ui → ui}/handlers/listboxhandlers.d.ts +0 -0
  378. /package/lib/{src/js/ui → ui}/handlers/playnextscreen.d.ts +0 -0
  379. /package/lib/{src/js/ui → ui}/handlers/timecontrolhandlers.d.ts +0 -0
  380. /package/lib/{js/ui → ui}/handlers/timecontrolhandlers.js +0 -0
  381. /package/lib/{src/js/ui → ui}/nativemobileuifactory.d.ts +0 -0
  382. /package/src/{scss → style}/components/_advert.scss +0 -0
  383. /package/src/{scss → style}/components/_audio.scss +0 -0
  384. /package/src/{scss → style}/components/_buffering.scss +0 -0
  385. /package/src/{scss → style}/components/_error.scss +0 -0
  386. /package/src/{scss → style}/components/_hugeplaybacktogglebutton.scss +0 -0
  387. /package/src/{scss → style}/components/_metadata.scss +0 -0
  388. /package/src/{scss → style}/components/_nicam.scss +0 -0
  389. /package/src/{scss → style}/components/_playnext.scss +0 -0
  390. /package/src/{scss → style}/components/_replay.scss +0 -0
  391. /package/src/{scss → style}/components/_seekbar.scss +0 -0
  392. /package/src/{scss → style}/components/_seekbarthumbnail.scss +0 -0
  393. /package/src/{scss → style}/components/_textbuttons.scss +0 -0
  394. /package/src/{scss → style}/components/_volumeslider.scss +0 -0
  395. /package/src/{scss → style}/components/audio/_bottombar.scss +0 -0
  396. /package/src/{scss → style}/components/audio/_buffering.scss +0 -0
  397. /package/src/{scss → style}/components/audio/_errors.scss +0 -0
  398. /package/src/{scss → style}/components/audio/_metadata.scss +0 -0
  399. /package/src/{scss → style}/components/audio/_playbutton.scss +0 -0
  400. /package/src/{scss → style}/components/audio/_poster.scss +0 -0
  401. /package/src/{scss → style}/components/audio/_replay.scss +0 -0
  402. /package/src/{scss → style}/components/audio/_seekbar.scss +0 -0
  403. /package/src/{scss → style}/components/audio/_topbar.scss +0 -0
  404. /package/src/{scss → style}/components/audio/_vars.scss +0 -0
  405. /package/src/{scss → style}/components/audio/_volumeslider.scss +0 -0
  406. /package/src/{scss → style}/variants/_player-audio.scss +0 -0
  407. /package/src/{scss → style}/variants/_player-base.scss +0 -0
  408. /package/src/{scss → style}/variants/_player-debug.scss +0 -0
  409. /package/src/{scss → style}/variants/_player-large.scss +0 -0
  410. /package/src/{scss → style}/variants/_player-medium.scss +0 -0
  411. /package/src/{scss → style}/variants/_player-native-mobile.scss +0 -0
  412. /package/src/{scss → style}/vars/_audio.scss +0 -0
  413. /package/src/{scss → style}/vars/_colors.scss +0 -0
  414. /package/src/{scss → style}/vars/_fonts.scss +0 -0
  415. /package/src/{scss → style}/vars/_icons.scss +0 -0
@@ -1,23 +1,18 @@
1
1
  import { newStreamTracker } from '@npotag/tag';
2
2
  import { bindPlayerEvents } from './eventbinding';
3
- import { validatePrid } from '../../utilities/utilities';
3
+ import { validatePrid } from '../../utilities/utilities.stream';
4
4
  export function startPlayerTracker(playerInstance, duration, version, source) {
5
- playerInstance.streamTracker = null;
6
- let streamTrackerConfig = null;
7
- if (playerInstance.npoTag?.pageTracker == null) {
5
+ playerInstance.streamTracker = undefined;
6
+ let streamTrackerConfig = undefined;
7
+ if (playerInstance.npoTag?.pageTracker == undefined) {
8
8
  console.error('No pageTracker available');
9
9
  }
10
10
  else {
11
- const avTypeMapping = {
12
- 'vod': 'video',
13
- 'aod': 'audio'
14
- };
15
- const avType = avTypeMapping[playerInstance.streamObject.stream.avType];
16
11
  streamTrackerConfig = {
17
12
  stream_length: duration,
18
13
  stream_id: validatePrid(source),
19
14
  player_id: 'npoplayer-web',
20
- av_type: avType,
15
+ av_type: playerInstance.npoplayerServices.getAVType(playerInstance.streamObject.stream.avType),
21
16
  player_version: version,
22
17
  sko_player_version: '1.0.0'
23
18
  };
@@ -0,0 +1,10 @@
1
+ interface ElementByQuery {
2
+ container: HTMLElement;
3
+ query: string;
4
+ }
5
+ interface RemoveClassFromElementByQuery extends ElementByQuery {
6
+ className: string;
7
+ }
8
+ export declare function getElementByQuery({ container, query }: ElementByQuery): Element | null;
9
+ export declare function removeClassFromElementByQuery(params: RemoveClassFromElementByQuery): void;
10
+ export {};
@@ -0,0 +1,8 @@
1
+ export function getElementByQuery({ container, query }) {
2
+ return container.querySelector(query);
3
+ }
4
+ export function removeClassFromElementByQuery(params) {
5
+ const { className, container, query } = params;
6
+ const element = getElementByQuery({ container, query });
7
+ element?.classList.remove(className);
8
+ }
@@ -0,0 +1,25 @@
1
+ import { getElementByQuery, removeClassFromElementByQuery } from './utilities.element';
2
+ const CLASS = 'element-class';
3
+ const ID = 'element-id';
4
+ const PARENT_ELEMENT = document.createElement('div');
5
+ const CHILD_ELEMENT_WITH_ID = document.createElement('div');
6
+ const CHILD_ELEMENT_WITH_CLASS = document.createElement('div');
7
+ CHILD_ELEMENT_WITH_ID.setAttribute('id', ID);
8
+ CHILD_ELEMENT_WITH_CLASS.setAttribute('class', CLASS);
9
+ PARENT_ELEMENT.appendChild(CHILD_ELEMENT_WITH_ID);
10
+ PARENT_ELEMENT.appendChild(CHILD_ELEMENT_WITH_CLASS);
11
+ describe('getElementByQuery', () => {
12
+ it('should return the child element', () => {
13
+ expect(getElementByQuery({ container: PARENT_ELEMENT, query: `#${ID}` })).toEqual(CHILD_ELEMENT_WITH_ID);
14
+ });
15
+ });
16
+ describe('removeClassFromElementByQuery', () => {
17
+ it('should remove the specified class from from the queried element', () => {
18
+ removeClassFromElementByQuery({
19
+ container: PARENT_ELEMENT,
20
+ query: `.${CLASS}`,
21
+ className: CLASS
22
+ });
23
+ expect(PARENT_ELEMENT.querySelector(`.${CLASS}`)).toBeNull();
24
+ });
25
+ });
@@ -0,0 +1,3 @@
1
+ export declare const convertBase64ToObject: (value: string) => Record<string, any>;
2
+ export declare const convertJwtToBase64: (jwt: string) => string;
3
+ export declare function isJWTToken(token: string): boolean;
@@ -0,0 +1,22 @@
1
+ export const convertBase64ToObject = (value) => {
2
+ try {
3
+ const decodedValue = [...window.atob(value)];
4
+ const mappedValue = decodedValue.map((c) => {
5
+ const codePoint = c.codePointAt(0);
6
+ if (codePoint === undefined)
7
+ return;
8
+ return '%' + ('00' + codePoint.toString(16)).slice(-2);
9
+ });
10
+ return JSON.parse(decodeURIComponent(mappedValue.join('')));
11
+ }
12
+ catch {
13
+ return {};
14
+ }
15
+ };
16
+ export const convertJwtToBase64 = (jwt) => {
17
+ return jwt.toString().split('.')[1].replace('-', '+').replace('_', '/');
18
+ };
19
+ export function isJWTToken(token) {
20
+ const JWT_REGEX = /^(?:[\w=-]+\.){2}[\w+./=-]+$/;
21
+ return JWT_REGEX.test(token);
22
+ }
@@ -0,0 +1,32 @@
1
+ import { convertBase64ToObject, convertJwtToBase64, isJWTToken } from './utilities.jwt';
2
+ describe('convertBase64ToObject', () => {
3
+ test('base64 string should return an object', () => {
4
+ const BASE64 = 'eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ';
5
+ const exptectedObject = { sub: '1234567890', name: 'John Doe', iat: 1516239022 };
6
+ expect(convertBase64ToObject(BASE64)).toMatchObject(exptectedObject);
7
+ });
8
+ test('invalid base64 string should return an empty object', () => {
9
+ expect(convertBase64ToObject('e2ludmFsaWRPYmplY3R9=')).toMatchObject({});
10
+ });
11
+ });
12
+ describe('convertJwtToBase64', () => {
13
+ test('convert a JWT to a base64 string', () => {
14
+ const BASE64 = 'eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ';
15
+ const JWT = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
16
+ expect(convertJwtToBase64(JWT)).toBe(BASE64);
17
+ });
18
+ });
19
+ describe('isJWTToken', () => {
20
+ test('valid JWT token should return true', () => {
21
+ const validToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJucG8iLCJpYXQiOjE3MDA1Nzk4ODgsImxpY2Vuc2VfcHJvZmlsZSI6IndlYiIsImRybV90eXBlIjoid2lkZXZpbmUiLCJjbGllbnRfaXAiOiIzMS4yMS4yMDUuMTcxIn0.mxNDb_gx8nqwc5p-PwSPnJgjPB8_L-niXm_gIcgkQBw';
22
+ expect(isJWTToken(validToken)).toBe(true);
23
+ });
24
+ test('invalid JWT token should return false', () => {
25
+ const invalidToken = 'invalidToken';
26
+ expect(isJWTToken(invalidToken)).toBe(false);
27
+ });
28
+ test('an url input should return false, despite 3 dots', () => {
29
+ const invalidToken = 'https://www.example.com';
30
+ expect(isJWTToken(invalidToken)).toBe(false);
31
+ });
32
+ });
@@ -0,0 +1,2 @@
1
+ import { type LocalizableText } from 'bitmovin-player-ui/dist/js/framework/localization/i18n';
2
+ export declare function localizeKey(key: string): LocalizableText;
@@ -0,0 +1,4 @@
1
+ import { i18n } from 'bitmovin-player-ui/dist/js/framework/localization/i18n';
2
+ export function localizeKey(key) {
3
+ return i18n.getLocalizer(key);
4
+ }
@@ -0,0 +1,10 @@
1
+ import { i18n } from 'bitmovin-player-ui/dist/js/framework/localization/i18n';
2
+ import { localizeKey } from './utilities.locale';
3
+ const KEY = 'settings.value';
4
+ describe('localizeKey', () => {
5
+ it('should return a localized key', () => {
6
+ const spy = jest.spyOn(i18n, 'getLocalizer');
7
+ localizeKey(KEY);
8
+ expect(spy).toHaveBeenCalledWith(KEY);
9
+ });
10
+ });
@@ -0,0 +1 @@
1
+ export declare function getModuleExport(module: unknown): unknown;
@@ -0,0 +1,4 @@
1
+ export function getModuleExport(module) {
2
+ const isDefaultExport = typeof module === 'object' && module !== null && 'default' in module;
3
+ return isDefaultExport ? module.default : module;
4
+ }
@@ -0,0 +1,19 @@
1
+ import { getModuleExport } from './utilities.module';
2
+ describe('getModuleExport', () => {
3
+ it('should return null for the module', () => {
4
+ const MODULE = undefined;
5
+ expect(getModuleExport(MODULE)).toBeUndefined();
6
+ });
7
+ it('should return a string as module', () => {
8
+ const MODULE = 'module';
9
+ expect(getModuleExport(MODULE)).toBe(MODULE);
10
+ });
11
+ it('should return a non-default object as module', () => {
12
+ const MODULE = { module: true };
13
+ expect(getModuleExport(MODULE)).toMatchObject(MODULE);
14
+ });
15
+ it('should return the default module', () => {
16
+ const MODULE = { default: true };
17
+ expect(getModuleExport(MODULE)).toBeTruthy();
18
+ });
19
+ });
@@ -0,0 +1,7 @@
1
+ interface StreamDurationInSecondsParams {
2
+ duration: string | number | undefined;
3
+ durationIsInMs?: boolean;
4
+ }
5
+ export declare function getStreamDurationInSeconds(params: StreamDurationInSecondsParams): number;
6
+ export declare function validatePrid(prid: string | undefined): string;
7
+ export {};
@@ -0,0 +1,10 @@
1
+ import { convertMsToSeconds } from './utilities.time';
2
+ export function getStreamDurationInSeconds(params) {
3
+ const { duration, durationIsInMs } = params;
4
+ if (duration === undefined || duration === Number.POSITIVE_INFINITY)
5
+ return -1;
6
+ return durationIsInMs ? convertMsToSeconds(Number(duration)) : Number.isFinite(+duration) ? Number(duration) : -1;
7
+ }
8
+ export function validatePrid(prid) {
9
+ return prid !== '' && prid !== undefined ? prid : 'unknown';
10
+ }
@@ -0,0 +1,32 @@
1
+ import { getStreamDurationInSeconds, validatePrid } from './utilities.stream';
2
+ describe('getStreamDurationInSeconds', () => {
3
+ it('shoud return -1 for an undefined duration', () => {
4
+ expect(getStreamDurationInSeconds({ duration: undefined })).toBe(-1);
5
+ });
6
+ it('shoud return -1 for an infinite duration', () => {
7
+ expect(getStreamDurationInSeconds({ duration: Number.POSITIVE_INFINITY })).toBe(-1);
8
+ });
9
+ it('shoud return the duration in seconds with a string as input', () => {
10
+ expect(getStreamDurationInSeconds({ duration: '10' })).toBe(10);
11
+ });
12
+ it('shoud return the duration in seconds with a number as input', () => {
13
+ expect(getStreamDurationInSeconds({ duration: 10 })).toBe(10);
14
+ });
15
+ it('shoud return the duration in seconds with a string as input in ms', () => {
16
+ expect(getStreamDurationInSeconds({ duration: '10000', durationIsInMs: true })).toBe(10);
17
+ });
18
+ it('shoud return the duration in seconds with a number as input in ms', () => {
19
+ expect(getStreamDurationInSeconds({ duration: 10000, durationIsInMs: true })).toBe(10);
20
+ });
21
+ });
22
+ describe('validatePrid', () => {
23
+ it('should return "unknown" for an empty prid', () => {
24
+ expect(validatePrid('')).toBe('unknown');
25
+ });
26
+ it('should return "unknown" for a null value', () => {
27
+ expect(validatePrid(undefined)).toBe('unknown');
28
+ });
29
+ it('should return the prid', () => {
30
+ expect(validatePrid('PRID')).toBe('PRID');
31
+ });
32
+ });
@@ -0,0 +1 @@
1
+ export declare function replaceSpecialCharacters(text: string): string;
@@ -0,0 +1,3 @@
1
+ export function replaceSpecialCharacters(text) {
2
+ return text.replace(/['()*]/g, (char) => `%${char.codePointAt(0)?.toString(16).toUpperCase()}`);
3
+ }
@@ -0,0 +1,18 @@
1
+ import { replaceSpecialCharacters } from './utilities.text';
2
+ describe('replaceSpecialCharacters', () => {
3
+ it('should replace special characters with their hexadecimal representation', () => {
4
+ const inputText = 'This is a test with ( and * characters.';
5
+ const result = replaceSpecialCharacters(inputText);
6
+ expect(result).toBe('This is a test with %28 and %2A characters.');
7
+ });
8
+ it('should handle an empty string', () => {
9
+ const inputText = '';
10
+ const result = replaceSpecialCharacters(inputText);
11
+ expect(result).toBe('');
12
+ });
13
+ it('should handle a string with no special characters', () => {
14
+ const inputText = 'This is a normal string without special characters.';
15
+ const result = replaceSpecialCharacters(inputText);
16
+ expect(result).toBe(inputText);
17
+ });
18
+ });
@@ -0,0 +1 @@
1
+ export declare function convertMsToSeconds(ms: number): number;
@@ -0,0 +1,3 @@
1
+ export function convertMsToSeconds(ms) {
2
+ return ms / 1000;
3
+ }
@@ -0,0 +1,8 @@
1
+ import { convertMsToSeconds } from './utilities.time';
2
+ describe('convertMsToSeconds', () => {
3
+ test('convert milliseconds to seconds', () => {
4
+ const TIME_IN_MS = 5000;
5
+ const TIME_IN_SECONDS = 5;
6
+ expect(convertMsToSeconds(TIME_IN_MS)).toBe(TIME_IN_SECONDS);
7
+ });
8
+ });
@@ -0,0 +1,3 @@
1
+ export declare function isMediaUrl(url: string): Promise<boolean>;
2
+ export declare function isUrl(url: string): boolean;
3
+ export declare const removeTrailingSlash: (url: string) => string;
@@ -0,0 +1,29 @@
1
+ const supportedMediaTypes = [
2
+ 'video/',
3
+ 'audio/',
4
+ 'application/octet-stream',
5
+ 'application/mp4',
6
+ 'application/x-mpegURL',
7
+ 'application/vnd.apple.mpegurl',
8
+ 'application/ogg'
9
+ ];
10
+ export async function isMediaUrl(url) {
11
+ if (!isUrl(url))
12
+ return false;
13
+ try {
14
+ const response = await fetch(url, { method: 'HEAD' });
15
+ const header = response.headers.get('Content-Type') || '';
16
+ return supportedMediaTypes.some((mediaType) => header.startsWith(mediaType));
17
+ }
18
+ catch (error) {
19
+ console.error('Failed to fetch the URL', error);
20
+ return false;
21
+ }
22
+ }
23
+ export function isUrl(url) {
24
+ const URL_REGEX = /^(http|https):\/\/(?:www\.)?[\dA-Za-z-]+(?:\.[A-Za-z]{2,})+(?:\/[^ "]+)?(?:\?.*)?$/;
25
+ return URL_REGEX.test(url);
26
+ }
27
+ export const removeTrailingSlash = (url) => {
28
+ return url.slice(-1) === '/' ? (url = url.slice(0, -1)) : url;
29
+ };
@@ -0,0 +1,46 @@
1
+ import fetchMock from 'jest-fetch-mock';
2
+ import { isMediaUrl, isUrl, removeTrailingSlash } from './utilities.url';
3
+ fetchMock.enableMocks();
4
+ const INVALID_URL = 'invalidurl';
5
+ const VALID_URL = 'https://example.com';
6
+ describe('isMediaUrl', () => {
7
+ it('should return false for an invalid url', async () => {
8
+ expect(await isMediaUrl(INVALID_URL)).toBeFalsy();
9
+ });
10
+ it('should fail to fetch the url and return false', async () => {
11
+ expect(await isMediaUrl(VALID_URL)).toBeFalsy();
12
+ });
13
+ it('should not contain a header with a mediaType and return false', async () => {
14
+ fetchMock.mockResponseOnce('', { headers: { 'Content-Type': 'application/json' } });
15
+ expect(await isMediaUrl(VALID_URL)).toBeFalsy();
16
+ });
17
+ it('should contain a header with a mediaType and return true', async () => {
18
+ fetchMock.mockResponseOnce('', { headers: { 'Content-Type': 'application/vnd.apple.mpegurl' } });
19
+ expect(await isMediaUrl(VALID_URL)).toBeTruthy();
20
+ });
21
+ });
22
+ describe('isUrl', () => {
23
+ test('valid URL should return true', () => {
24
+ const VALID_URL = 'https://www.example.com';
25
+ expect(isUrl(VALID_URL)).toBeTruthy();
26
+ });
27
+ test('valid URL with parameters should return true', () => {
28
+ const VALID_URL = 'https://www.example.com?foo=bar';
29
+ expect(isUrl(VALID_URL)).toBeTruthy();
30
+ });
31
+ test('valid URL with parameters should return true', () => {
32
+ const VALID_URL = 'https://example.com';
33
+ expect(isUrl(VALID_URL)).toBeTruthy();
34
+ });
35
+ test('invalid URL should return false', () => {
36
+ const INVALID_URL = 'invalidurl';
37
+ expect(isUrl(INVALID_URL)).toBeFalsy();
38
+ });
39
+ });
40
+ describe('removeTrailingSlash', () => {
41
+ test('trailing slash should be removed from url', () => {
42
+ const URL_BASE = 'https://www.example.com';
43
+ const URL_WITH_TRAILING_SLASH = URL_BASE + '/';
44
+ expect(removeTrailingSlash(URL_WITH_TRAILING_SLASH)).toBe(URL_BASE);
45
+ });
46
+ });
@@ -0,0 +1,3 @@
1
+ export declare function isFairPlayDrmSupported(keySystems: string[]): boolean;
2
+ export declare const isSafariUserAgent: (userAgent: string) => boolean;
3
+ export declare function isSafari(): boolean;
@@ -0,0 +1,13 @@
1
+ import { supportedKeySystems } from '../settings/settings.user-agent';
2
+ export function isFairPlayDrmSupported(keySystems) {
3
+ return keySystems.some((keySystem) => window.WebKitMediaKeys?.isTypeSupported(keySystem, 'video/mp4'));
4
+ }
5
+ export const isSafariUserAgent = (userAgent) => userAgent.includes('Safari') &&
6
+ !userAgent.includes('Chrome') &&
7
+ !userAgent.includes('IEMobile') &&
8
+ !userAgent.includes('Edge') &&
9
+ !userAgent.includes('Chromium') &&
10
+ !userAgent.includes('Android');
11
+ export function isSafari() {
12
+ return isSafariUserAgent(navigator.userAgent) || isFairPlayDrmSupported(supportedKeySystems);
13
+ }
@@ -0,0 +1,60 @@
1
+ import { isFairPlayDrmSupported, isSafari, isSafariUserAgent } from './utilities.user-agent';
2
+ const defaultKeySystems = ['com.apple.fps.1_0', 'com.apple.fps.2_0'];
3
+ describe('isFairPlayDrmSupported', () => {
4
+ it('should call WebKitMediaKeys.isTypeSupported with the right parameters', () => {
5
+ const isTypeSupported = jest.fn();
6
+ Object.defineProperty(window, 'WebKitMediaKeys', {
7
+ value: { isTypeSupported },
8
+ writable: true
9
+ });
10
+ isFairPlayDrmSupported(defaultKeySystems);
11
+ expect(isTypeSupported).toHaveBeenCalledWith('com.apple.fps.1_0', 'video/mp4');
12
+ expect(isTypeSupported).toHaveBeenCalledWith('com.apple.fps.2_0', 'video/mp4');
13
+ });
14
+ it('should return false if WebKitMediaKeys is not available', () => {
15
+ Object.defineProperty(window, 'WebKitMediaKeys', {
16
+ value: undefined,
17
+ writable: true
18
+ });
19
+ expect(isFairPlayDrmSupported(defaultKeySystems)).toBe(false);
20
+ });
21
+ it('should return false if an empty array of key systems is provided', () => {
22
+ Object.defineProperty(window, 'WebKitMediaKeys', {
23
+ value: { isTypeSupported: () => true },
24
+ writable: true
25
+ });
26
+ expect(isFairPlayDrmSupported([])).toBe(false);
27
+ });
28
+ });
29
+ describe('isSafariUserAgent', () => {
30
+ it('should return true for Safari', () => {
31
+ expect(isSafariUserAgent('Safari')).toBe(true);
32
+ });
33
+ it('should return false for other user agents', () => {
34
+ expect(isSafariUserAgent('Chrome')).toBe(false);
35
+ expect(isSafariUserAgent('IEMobile')).toBe(false);
36
+ expect(isSafariUserAgent('Edge')).toBe(false);
37
+ expect(isSafariUserAgent('Chromium')).toBe(false);
38
+ expect(isSafariUserAgent('Android')).toBe(false);
39
+ });
40
+ });
41
+ describe('isSafari', () => {
42
+ it('should return true if the user agent is Safari', () => {
43
+ jest.spyOn(global.navigator, 'userAgent', 'get').mockReturnValue('Safari');
44
+ expect(isSafari()).toBe(true);
45
+ });
46
+ it('should return true if FairPlayDrm is supported', () => {
47
+ ;
48
+ window.WebKitMediaKeys = function () { };
49
+ window.WebKitMediaKeys.isTypeSupported = () => true;
50
+ jest.spyOn(global.navigator, 'userAgent', 'get').mockReturnValue('Chrome');
51
+ expect(isSafari()).toBe(true);
52
+ });
53
+ it('should return false if the user agent is not Safari and FairPlayDrm is not supported', () => {
54
+ ;
55
+ window.WebKitMediaKeys = function () { };
56
+ window.WebKitMediaKeys.isTypeSupported = () => false;
57
+ jest.spyOn(global.navigator, 'userAgent', 'get').mockReturnValue('Safari Chrome IEMobile Edge Chromium Android');
58
+ expect(isSafari()).toBe(false);
59
+ });
60
+ });
@@ -0,0 +1 @@
1
+ export declare function logVersion(version: string): void;
@@ -1,5 +1,5 @@
1
- export function printVersion(version) {
2
- const asciiArt = `
1
+ export function logVersion(version) {
2
+ const ASCII_ART = `
3
3
  ╔▒▒╖
4
4
  _╔╠╠╠╠╠╠╠φ_
5
5
  _#╠╠╠╠╠╠╠╠╠╠╠#_
@@ -17,10 +17,10 @@ export function printVersion(version) {
17
17
  \`╝╠╠╠╠╠╩\`
18
18
  \`╙╙╙
19
19
  `;
20
- const title = 'NPO Player';
21
- const versionString = 'v' + String(version);
22
- const colorCode = '#ff6d00';
23
- const titleStyle = `font-size: 24px; font-weight: bold; color: ${colorCode}; padding: 2px 4px;`;
24
- const versionStyle = 'font-size: 24px; font-weight: bold; padding: 2px 4px;';
25
- console.log(`%c${asciiArt}%c${title} %c${versionString}`, `color: ${colorCode}; background-color: rgb(11, 28, 54);`, titleStyle, versionStyle);
20
+ const COLOR_CODE = '#ff6d00';
21
+ const TITLE = 'NPO Player';
22
+ const TITLE_STYLE = `font-size: 24px; font-weight: bold; color: ${COLOR_CODE}; padding: 2px 4px;`;
23
+ const VERSION_STRING = 'v' + String(version);
24
+ const VERSION_STYLE = 'font-size: 24px; font-weight: bold; padding: 2px 4px;';
25
+ console.log(`%c${ASCII_ART}%c${TITLE} %c${VERSION_STRING}`, `color: ${COLOR_CODE}; background-color: rgb(11, 28, 54);`, TITLE_STYLE, VERSION_STYLE);
26
26
  }
@@ -0,0 +1,26 @@
1
+ import { logVersion } from './utilities.version';
2
+ describe('logVersion', () => {
3
+ it('should print the current version', () => {
4
+ const logSpy = jest.spyOn(console, 'log');
5
+ logVersion('1.0.0');
6
+ const ASCII_ART = `
7
+ ╔▒▒╖
8
+ _╔╠╠╠╠╠╠╠φ_
9
+ _#╠╠╠╠╠╠╠╠╠╠╠#_
10
+ ╓╔╠╠╠╠╝╝╠╠╠╠╠╠╠╠╠▒,
11
+ ╔╬╠╠╠╠╠ '╚╠╠╠╠╠╠╠╠▒╖
12
+ ╔╬╠╠╠╠╠╠╠ '╚╠╠╠╠╠╠╠╬╦
13
+ _╓╠╠╠╠╠╠╠╠╠╠ '╚╠╠╠╠╠╠╠╖╖
14
+ ╠╠╠╠╠╠╠╠╠╠╠╠ ╠╠╠╠╠╠╠╠▒
15
+ ╬╠╠╠╠╠╠╠╠╠╠╠ _╔╬╠╠╠╠╠╠╠╝
16
+ \`╝╠╠╠╠╠╠╠╠╠ _╔╠╠╠╠╠╠╠╠╠╩\`
17
+ \`╚╠╠╠╠╠╠╠ _╔╬╠╠╠╠╠╠╠╠╠╩
18
+ ╙╠╠╠╠╠▒╗φ╬╠╠╠╠╠╠╠╠╠╠╜
19
+ ╙╬╠╠╠╠╠╠╠╠╠╠╠╠╠╠╙
20
+ '╬╠╠╠╠╠╠╠╠╠╝^
21
+ \`╝╠╠╠╠╠╩\`
22
+ \`╙╙╙
23
+ `;
24
+ expect(logSpy).toHaveBeenCalledWith(`%c${ASCII_ART}%cNPO Player %cv1.0.0`, 'color: #ff6d00; background-color: rgb(11, 28, 54);', 'font-size: 24px; font-weight: bold; color: #ff6d00; padding: 2px 4px;', 'font-size: 24px; font-weight: bold; padding: 2px 4px;');
25
+ });
26
+ });
package/lib/lang/nl.json CHANGED
@@ -69,5 +69,6 @@
69
69
  "seekBar": "Video tijdlijn",
70
70
  "seekBar.value": "Waarde",
71
71
  "seekBar.timeshift": "Timeshift",
72
- "seekBar.durationText": "out of"
72
+ "seekBar.durationText": "out of",
73
+ "segment.unplayableTitle": "Niet beschikbaar"
73
74
  }
@@ -1 +1 @@
1
- export {};
1
+ import '@testing-library/jest-dom';
@@ -1,14 +1,16 @@
1
- jest.mock('./js/ui/nativemobileuifactory', () => ({
2
- nativeMobileUiFactory: jest.fn(),
1
+ import '@testing-library/jest-dom';
2
+ jest.mock('./ui/nativemobileuifactory', () => ({
3
+ nativeMobileUiFactory: jest.fn()
3
4
  }));
4
- const { nativeMobileUiFactory } = require('./js/ui/nativemobileuifactory');
5
+ const { nativeMobileUiFactory } = require('./ui/nativemobileuifactory');
5
6
  beforeAll(() => {
7
+ ;
6
8
  window.bitmovin = {};
7
9
  window.bitmovin.playerui = () => { };
8
10
  window.bitmovin.playerui.UIFactory = {
9
11
  buildDefaultSmallScreenUI: (player, config = {}) => {
10
12
  return nativeMobileUiFactory(player, config);
11
- },
13
+ }
12
14
  };
13
15
  });
14
16
  beforeEach(() => {
@@ -20,4 +22,3 @@ test('Bridge initation: nativeMobileUiFactory is called with correct arguments f
20
22
  window.bitmovin.playerui.UIFactory.buildDefaultSmallScreenUI(mockPlayer, mockConfig);
21
23
  expect(nativeMobileUiFactory).toHaveBeenCalledWith(mockPlayer, mockConfig);
22
24
  });
23
- export {};
@@ -1,21 +1,21 @@
1
+ import { NpoPlayerServices } from './services/services';
1
2
  import { type StreamTracker, type NPOTag } from '@npotag/tag';
2
3
  import { type InitialisationProps } from '@npotag/tag/dist/types/src/npoTag';
3
4
  import { type PlayerAPI, type PlayerConfig, type SourceConfig } from 'bitmovin-player';
4
5
  import { UIManager } from 'bitmovin-player-ui';
5
6
  import { LogEmitter } from './types/classes';
6
- import { type DRMProfile, type ApiPayload, type NPOTagObject, type Section, type StreamObject, type StreamOptions, type UIComponents, type TimeLineMarker, NpoPlayerUIVariants } from './types/interfaces';
7
- export { type PlayerConfig, type InitialisationProps, type NPOTagObject, type StreamOptions, NpoPlayerUIVariants, };
7
+ import { type DRMProfile, type ApiPayload, type NPOTagObject, type StreamObject, type StreamOptions, type UIComponents, type TimeLineMarker, type LocalStorageData, type PlayerContext, type EventListeners, NpoPlayerUIVariants } from './types/interfaces';
8
+ export { type PlayerConfig, type InitialisationProps, type NPOTagObject, type StreamOptions, NpoPlayerUIVariants };
8
9
  export default class NpoPlayer {
9
10
  playerConfig: PlayerConfig;
10
11
  sourceConfig: SourceConfig;
11
12
  streamObject: StreamObject;
12
- player: PlayerAPI | null;
13
- uiManager: UIManager | null;
13
+ player: PlayerAPI | undefined;
14
+ uiManager: UIManager | undefined;
14
15
  npoTag: NPOTagObject | undefined;
15
- streamTracker: StreamTracker | null;
16
+ streamTracker: StreamTracker | undefined;
16
17
  logEmitter: LogEmitter;
17
18
  uiComponents: UIComponents;
18
- fragment: Section | null;
19
19
  container: HTMLElement;
20
20
  streamOptions: StreamOptions;
21
21
  jwt: string;
@@ -26,13 +26,17 @@ export default class NpoPlayer {
26
26
  variant: NpoPlayerUIVariants;
27
27
  isShowingPlayNextScreen: boolean;
28
28
  canceledPlayNextScreen: boolean;
29
- constructor(_container: HTMLElement, _playerConfig: PlayerConfig, _npotag?: InitialisationProps | null, _npotaginstance?: NPOTag | undefined, _variant?: NpoPlayerUIVariants);
29
+ playerContext: PlayerContext | undefined;
30
+ npoplayerServices: NpoPlayerServices;
31
+ eventListeners: EventListeners | undefined;
32
+ mockNpoPlayer: any;
33
+ userPreferences: LocalStorageData;
34
+ constructor(_container: HTMLElement, _playerConfig: PlayerConfig, _npotag?: InitialisationProps | undefined, _npotaginstance?: NPOTag | undefined, _variant?: NpoPlayerUIVariants);
30
35
  initPlayer(_container: HTMLElement, playerConfig: PlayerConfig, variant: NpoPlayerUIVariants): void;
31
36
  loadStream(source: string, options?: StreamOptions): Promise<void>;
32
- createUIManager(player: PlayerAPI, variant: NpoPlayerUIVariants): Promise<void>;
37
+ createUIManager(player: PlayerAPI, playerContext: PlayerContext, variant: NpoPlayerUIVariants): Promise<void>;
33
38
  doError(input: any, status?: number): void;
34
- keyPress(e: KeyboardEvent): void;
35
- play(): void;
39
+ play(): Promise<void>;
36
40
  pause(): void;
37
41
  setVolume(volume: number): void;
38
42
  increaseVolume(): void;