@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.
- package/README.md +1 -1
- package/lib/js/ads/ster.js +23 -21
- package/lib/js/ads/ster.test.js +17 -17
- package/lib/js/api/getstreamobject.js +7 -7
- package/lib/js/api/getstreamobject.test.js +3 -3
- package/lib/js/markers/updateLiveMarkers.d.ts +3 -3
- package/lib/js/markers/updateLiveMarkers.js +14 -15
- package/lib/js/markers/updateLiveMarkers.test.js +11 -12
- package/lib/js/playeractions/customerrors.test.js +33 -33
- package/lib/js/playeractions/handlers/customerrors.js +48 -48
- package/lib/js/playeractions/handlers/error.js +1 -1
- package/lib/js/playeractions/handlers/error.test.js +11 -11
- package/lib/js/playeractions/handlers/handleoffsets.d.ts +2 -2
- package/lib/js/playeractions/handlers/handleoffsets.js +6 -6
- package/lib/js/playeractions/handlers/handleoffsets.test.js +12 -12
- package/lib/js/playeractions/handlers/mediasessionactions.d.ts +1 -1
- package/lib/js/playeractions/handlers/mediasessionactions.js +20 -15
- package/lib/js/playeractions/handlers/processplayerconfig.d.ts +2 -2
- package/lib/js/playeractions/handlers/processplayerconfig.js +4 -4
- package/lib/js/playeractions/handlers/processsourceconfig.d.ts +2 -1
- package/lib/js/playeractions/handlers/processsourceconfig.js +52 -46
- package/lib/js/playeractions/handlers/removereplayclass.d.ts +1 -1
- package/lib/js/playeractions/handlers/removereplayclass.test.d.ts +1 -1
- package/lib/js/playeractions/handlers/removereplayclass.test.js +7 -6
- package/lib/js/playeractions/playeractions.d.ts +4 -5
- package/lib/js/playeractions/playeractions.js +4 -5
- package/lib/js/settings/settings.user-agent.d.ts +1 -0
- package/lib/js/settings/settings.user-agent.js +1 -0
- package/lib/js/tracking/handlers/eventbinding.js +9 -9
- package/lib/js/tracking/handlers/eventlogging.js +2 -2
- package/lib/js/tracking/handlers/eventlogging.test.js +2 -2
- package/lib/js/tracking/handlers/playertrackerinit.d.ts +1 -1
- package/lib/js/tracking/handlers/playertrackerinit.js +5 -11
- package/lib/js/tracking/handlers/playertrackerstart.d.ts +1 -1
- package/lib/js/tracking/handlers/playertrackerstart.js +5 -10
- package/lib/js/utilities/utilities.element.d.ts +10 -0
- package/lib/js/utilities/utilities.element.js +8 -0
- package/lib/js/utilities/utilities.element.test.js +25 -0
- package/lib/js/utilities/utilities.jwt.d.ts +3 -0
- package/lib/js/utilities/utilities.jwt.js +22 -0
- package/lib/js/utilities/utilities.jwt.test.js +32 -0
- package/lib/js/utilities/utilities.locale.d.ts +2 -0
- package/lib/js/utilities/utilities.locale.js +4 -0
- package/lib/js/utilities/utilities.locale.test.js +10 -0
- package/lib/js/utilities/utilities.module.d.ts +1 -0
- package/lib/js/utilities/utilities.module.js +4 -0
- package/lib/js/utilities/utilities.module.test.js +19 -0
- package/lib/js/utilities/utilities.stream.d.ts +7 -0
- package/lib/js/utilities/utilities.stream.js +10 -0
- package/lib/js/utilities/utilities.stream.test.js +32 -0
- package/lib/js/utilities/utilities.text.d.ts +1 -0
- package/lib/js/utilities/utilities.text.js +3 -0
- package/lib/js/utilities/utilities.text.test.js +18 -0
- package/lib/js/utilities/utilities.time.d.ts +1 -0
- package/lib/js/utilities/utilities.time.js +3 -0
- package/lib/js/utilities/utilities.time.test.js +8 -0
- package/lib/js/utilities/utilities.url.d.ts +3 -0
- package/lib/js/utilities/utilities.url.js +29 -0
- package/lib/js/utilities/utilities.url.test.js +46 -0
- package/lib/js/utilities/utilities.user-agent.d.ts +3 -0
- package/lib/js/utilities/utilities.user-agent.js +13 -0
- package/lib/js/utilities/utilities.user-agent.test.js +60 -0
- package/lib/js/utilities/utilities.version.d.ts +1 -0
- package/lib/js/utilities/{printversion.js → utilities.version.js} +8 -8
- package/lib/js/utilities/utilities.version.test.js +26 -0
- package/lib/lang/nl.json +2 -1
- package/lib/npoplayer-bridge.test.d.ts +1 -1
- package/lib/npoplayer-bridge.test.js +6 -5
- package/lib/npoplayer.d.ts +14 -10
- package/lib/npoplayer.js +116 -124
- package/lib/npoplayer.test.js +3 -3
- package/lib/package.json +19 -12
- package/lib/services/a11y/setup.d.ts +2 -0
- package/lib/services/a11y/setup.js +18 -0
- package/lib/services/a11y/setup.test.js +109 -0
- package/lib/services/avTypeHandlers/getAVType.d.ts +2 -0
- package/lib/services/avTypeHandlers/getAVType.js +9 -0
- package/lib/services/avTypeHandlers/getAVType.test.js +18 -0
- package/lib/services/drmHandlers/constants.d.ts +15 -0
- package/lib/services/drmHandlers/constants.js +13 -0
- package/lib/services/drmHandlers/decideprofile.d.ts +2 -0
- package/lib/services/drmHandlers/decideprofile.js +51 -0
- package/lib/services/drmHandlers/decideprofile.test.js +34 -0
- package/lib/services/drmHandlers/drmhandlers.d.ts +2 -0
- package/lib/services/drmHandlers/drmhandlers.js +2 -0
- package/lib/services/drmHandlers/utils.d.ts +5 -0
- package/lib/services/drmHandlers/utils.js +26 -0
- package/lib/services/drmHandlers/utils.test.js +74 -0
- package/lib/services/drmHandlers/verifydrm.d.ts +2 -0
- package/lib/services/drmHandlers/verifydrm.js +40 -0
- package/lib/services/drmHandlers/verifydrm.test.js +89 -0
- package/lib/services/eventListenerHandlers/removeEventListeners.d.ts +2 -0
- package/lib/services/eventListenerHandlers/removeEventListeners.js +18 -0
- package/lib/services/eventListenerHandlers/removeEventListeners.test.js +27 -0
- package/lib/services/keyboardHandlers/resolvekeypress.d.ts +2 -0
- package/lib/services/keyboardHandlers/resolvekeypress.js +49 -0
- package/lib/{js/playeractions/handlers → services/keyboardHandlers}/resolvekeypress.test.js +21 -13
- package/lib/services/liveStreamHandlers/handleLiveStreamControls.d.ts +6 -0
- package/lib/services/liveStreamHandlers/handleLiveStreamControls.js +35 -0
- package/lib/services/localStorageHandlers/localStorageHandlers.d.ts +4 -0
- package/lib/services/localStorageHandlers/localStorageHandlers.js +33 -0
- package/lib/services/localStorageHandlers/localStorageHandlers.test.js +109 -0
- package/lib/services/npoPlayerAPI/npoPlayerAPI.d.ts +30 -0
- package/lib/services/npoPlayerAPI/npoPlayerAPI.js +91 -0
- package/lib/services/npoPlayerAPI/npoPlayerAPI.test.js +51 -0
- package/lib/services/segmentHandlers/addSegmentEventListeners.d.ts +2 -0
- package/lib/services/segmentHandlers/addSegmentEventListeners.js +14 -0
- package/lib/services/segmentHandlers/addSegmentEventListeners.test.js +43 -0
- package/lib/services/segmentHandlers/convertFragmentToSegment.d.ts +2 -0
- package/lib/services/segmentHandlers/convertFragmentToSegment.js +8 -0
- package/lib/services/segmentHandlers/convertFragmentToSegment.test.js +17 -0
- package/lib/services/segmentHandlers/handleSegmentSeek.d.ts +5 -0
- package/lib/services/segmentHandlers/handleSegmentSeek.js +15 -0
- package/lib/services/segmentHandlers/handleSegmentSeek.test.js +73 -0
- package/lib/services/segmentHandlers/handleSegmentTimeChanged.d.ts +2 -0
- package/lib/services/segmentHandlers/handleSegmentTimeChanged.js +21 -0
- package/lib/services/segmentHandlers/handleSegmentTimeChanged.test.d.ts +1 -0
- package/lib/services/segmentHandlers/handleSegmentTimeChanged.test.js +34 -0
- package/lib/services/segmentHandlers/initSegment.d.ts +7 -0
- package/lib/services/segmentHandlers/initSegment.js +10 -0
- package/lib/services/segmentHandlers/initSegment.test.d.ts +1 -0
- package/lib/services/segmentHandlers/initSegment.test.js +36 -0
- package/lib/services/segmentHandlers/setSegmentMarkers.d.ts +2 -0
- package/lib/services/segmentHandlers/setSegmentMarkers.js +25 -0
- package/lib/services/segmentHandlers/setSegmentMarkers.test.d.ts +1 -0
- package/lib/services/segmentHandlers/setSegmentMarkers.test.js +32 -0
- package/lib/services/services.d.ts +14 -0
- package/lib/services/services.js +47 -0
- package/lib/src/js/markers/updateLiveMarkers.d.ts +3 -3
- package/lib/src/js/playeractions/handlers/handleoffsets.d.ts +2 -2
- package/lib/src/js/playeractions/handlers/mediasessionactions.d.ts +1 -1
- package/lib/src/js/playeractions/handlers/processplayerconfig.d.ts +2 -2
- package/lib/src/js/playeractions/handlers/processsourceconfig.d.ts +2 -1
- package/lib/src/js/playeractions/handlers/removereplayclass.d.ts +1 -1
- package/lib/src/js/playeractions/handlers/removereplayclass.test.d.ts +1 -1
- package/lib/src/js/playeractions/playeractions.d.ts +4 -5
- package/lib/src/js/settings/settings.user-agent.d.ts +1 -0
- package/lib/src/js/tracking/handlers/playertrackerinit.d.ts +1 -1
- package/lib/src/js/tracking/handlers/playertrackerstart.d.ts +1 -1
- package/lib/src/js/utilities/utilities.element.d.ts +10 -0
- package/lib/src/js/utilities/utilities.element.test.d.ts +1 -0
- package/lib/src/js/utilities/utilities.jwt.d.ts +3 -0
- package/lib/src/js/utilities/utilities.jwt.test.d.ts +1 -0
- package/lib/src/js/utilities/utilities.locale.d.ts +2 -0
- package/lib/src/js/utilities/utilities.locale.test.d.ts +1 -0
- package/lib/src/js/utilities/utilities.module.d.ts +1 -0
- package/lib/src/js/utilities/utilities.module.test.d.ts +1 -0
- package/lib/src/js/utilities/utilities.stream.d.ts +7 -0
- package/lib/src/js/utilities/utilities.stream.test.d.ts +1 -0
- package/lib/src/js/utilities/utilities.text.d.ts +1 -0
- package/lib/src/js/utilities/utilities.text.test.d.ts +1 -0
- package/lib/src/js/utilities/utilities.time.d.ts +1 -0
- package/lib/src/js/utilities/utilities.time.test.d.ts +1 -0
- package/lib/src/js/utilities/utilities.url.d.ts +3 -0
- package/lib/src/js/utilities/utilities.url.test.d.ts +1 -0
- package/lib/src/js/utilities/utilities.user-agent.d.ts +3 -0
- package/lib/src/js/utilities/utilities.user-agent.test.d.ts +1 -0
- package/lib/src/js/utilities/utilities.version.d.ts +1 -0
- package/lib/src/js/utilities/utilities.version.test.d.ts +1 -0
- package/lib/src/npoplayer-bridge.test.d.ts +1 -1
- package/lib/src/npoplayer.d.ts +14 -10
- package/lib/src/services/a11y/setup.d.ts +2 -0
- package/lib/src/services/a11y/setup.test.d.ts +1 -0
- package/lib/src/services/avTypeHandlers/getAVType.d.ts +2 -0
- package/lib/src/services/avTypeHandlers/getAVType.test.d.ts +1 -0
- package/lib/src/services/drmHandlers/constants.d.ts +15 -0
- package/lib/src/services/drmHandlers/decideprofile.d.ts +2 -0
- package/lib/src/services/drmHandlers/decideprofile.test.d.ts +1 -0
- package/lib/src/services/drmHandlers/drmhandlers.d.ts +2 -0
- package/lib/src/services/drmHandlers/utils.d.ts +5 -0
- package/lib/src/services/drmHandlers/utils.test.d.ts +1 -0
- package/lib/src/services/drmHandlers/verifydrm.d.ts +2 -0
- package/lib/src/services/drmHandlers/verifydrm.test.d.ts +1 -0
- package/lib/src/services/eventListenerHandlers/removeEventListeners.d.ts +2 -0
- package/lib/src/services/eventListenerHandlers/removeEventListeners.test.d.ts +1 -0
- package/lib/src/services/keyboardHandlers/resolvekeypress.d.ts +2 -0
- package/lib/src/services/keyboardHandlers/resolvekeypress.test.d.ts +1 -0
- package/lib/src/services/liveStreamHandlers/handleLiveStreamControls.d.ts +6 -0
- package/lib/src/services/localStorageHandlers/localStorageHandlers.d.ts +4 -0
- package/lib/src/services/localStorageHandlers/localStorageHandlers.test.d.ts +1 -0
- package/lib/src/services/npoPlayerAPI/npoPlayerAPI.d.ts +30 -0
- package/lib/src/services/npoPlayerAPI/npoPlayerAPI.test.d.ts +1 -0
- package/lib/src/services/segmentHandlers/addSegmentEventListeners.d.ts +2 -0
- package/lib/src/services/segmentHandlers/addSegmentEventListeners.test.d.ts +1 -0
- package/lib/src/services/segmentHandlers/convertFragmentToSegment.d.ts +2 -0
- package/lib/src/services/segmentHandlers/convertFragmentToSegment.test.d.ts +1 -0
- package/lib/src/services/segmentHandlers/handleSegmentSeek.d.ts +5 -0
- package/lib/src/services/segmentHandlers/handleSegmentSeek.test.d.ts +1 -0
- package/lib/src/services/segmentHandlers/handleSegmentTimeChanged.d.ts +2 -0
- package/lib/src/services/segmentHandlers/handleSegmentTimeChanged.test.d.ts +1 -0
- package/lib/src/services/segmentHandlers/initSegment.d.ts +7 -0
- package/lib/src/services/segmentHandlers/initSegment.test.d.ts +1 -0
- package/lib/src/services/segmentHandlers/setSegmentMarkers.d.ts +2 -0
- package/lib/src/services/segmentHandlers/setSegmentMarkers.test.d.ts +1 -0
- package/lib/src/services/services.d.ts +14 -0
- package/lib/src/types/events.d.ts +91 -0
- package/lib/src/types/interfaces.d.ts +39 -15
- package/lib/{js → src}/ui/components/adbutton.d.ts +1 -1
- package/lib/{js → src}/ui/components/adlabel.d.ts +1 -1
- package/lib/{js → src}/ui/components/audio/controlbar.d.ts +1 -1
- package/lib/{js → src}/ui/components/buttons.d.ts +3 -3
- package/lib/src/ui/components/controlbar.d.ts +3 -0
- package/lib/{js → src}/ui/components/ctabar.d.ts +2 -2
- package/lib/src/ui/components/nativemobile/controlbar.d.ts +3 -0
- package/lib/src/ui/components/nativemobile/topbar.d.ts +3 -0
- package/lib/{js → src}/ui/components/playnext.d.ts +1 -1
- package/lib/src/{js/ui → ui}/components/seekbar.d.ts +1 -1
- package/lib/src/{js/ui → ui}/components/settingspanel.d.ts +1 -1
- package/lib/{js → src}/ui/components/titlebar.d.ts +1 -1
- package/lib/src/ui/components/topbar.d.ts +3 -0
- package/lib/src/ui/handlers/accessibilityhandler.test.d.ts +1 -0
- package/lib/src/ui/handlers/domhandlers.d.ts +3 -0
- package/lib/src/ui/handlers/domhandlers.test.d.ts +1 -0
- package/lib/{js → src}/ui/handlers/nicamhandler.d.ts +2 -2
- package/lib/src/ui/handlers/nicamhandler.test.d.ts +1 -0
- package/lib/{js → src}/ui/handlers/playnextstreen.test.d.ts +1 -1
- package/lib/src/{js/ui → ui}/handlers/streamhandler.d.ts +2 -2
- package/lib/{js → src}/ui/nativemobileuicontainer.d.ts +1 -1
- package/lib/src/ui/nativemobileuifactory.test.d.ts +1 -0
- package/lib/{js → src}/ui/uicontainer.d.ts +2 -3
- package/lib/tests/mocks/mockNpoplayer.js +18 -15
- package/lib/tests/mocks/mockPlayerAPI.d.ts +3 -0
- package/lib/tests/mocks/mockPlayerAPI.js +181 -0
- package/lib/tests/mocks/mockPlayerContext.d.ts +2 -0
- package/lib/tests/mocks/mockPlayerContext.js +40 -0
- package/lib/types/events.d.ts +91 -0
- package/lib/types/events.js +1 -0
- package/lib/types/interfaces.d.ts +39 -15
- package/lib/types/interfaces.js +12 -0
- package/lib/{src/js/ui → ui}/components/adbutton.d.ts +1 -1
- package/lib/{src/js/ui → ui}/components/adlabel.d.ts +1 -1
- package/lib/{src/js/ui → ui}/components/audio/controlbar.d.ts +1 -1
- package/lib/{js/ui → ui}/components/audio/controlbar.js +2 -2
- package/lib/{src/js/ui → ui}/components/buttons.d.ts +3 -3
- package/lib/{js/ui → ui}/components/buttons.js +7 -7
- package/lib/ui/components/controlbar.d.ts +3 -0
- package/lib/{js/ui → ui}/components/controlbar.js +5 -2
- package/lib/{src/js/ui → ui}/components/ctabar.d.ts +3 -3
- package/lib/{js/ui → ui}/components/ctabar.js +4 -6
- package/lib/{js/ui → ui}/components/nativemobile/buttons.js +8 -6
- package/lib/ui/components/nativemobile/controlbar.d.ts +3 -0
- package/lib/{js/ui → ui}/components/nativemobile/controlbar.js +6 -4
- package/lib/{js/ui → ui}/components/nativemobile/ctabar.js +1 -1
- package/lib/ui/components/nativemobile/topbar.d.ts +3 -0
- package/lib/{js/ui → ui}/components/nativemobile/topbar.js +6 -3
- package/lib/{src/js/ui → ui}/components/playnext.d.ts +1 -1
- package/lib/{js/ui → ui}/components/playnext.js +1 -1
- package/lib/{js/ui → ui}/components/seekbar.d.ts +1 -1
- package/lib/{js/ui → ui}/components/seekbar.js +1 -1
- package/lib/{js/ui → ui}/components/settingspanel.d.ts +1 -1
- package/lib/{js/ui → ui}/components/settingspanel.js +23 -40
- package/lib/{src/js/ui → ui}/components/titlebar.d.ts +1 -1
- package/lib/ui/components/topbar.d.ts +3 -0
- package/lib/{js/ui → ui}/components/topbar.js +8 -4
- package/lib/{js/ui → ui}/handlers/accessibilityhandler.js +10 -10
- package/lib/ui/handlers/accessibilityhandler.test.d.ts +1 -0
- package/lib/ui/handlers/domhandlers.d.ts +3 -0
- package/lib/ui/handlers/domhandlers.js +7 -0
- package/lib/ui/handlers/domhandlers.test.d.ts +1 -0
- package/lib/ui/handlers/domhandlers.test.js +51 -0
- package/lib/{js/ui → ui}/handlers/listboxhandlers.js +7 -7
- package/lib/{src/js/ui → ui}/handlers/nicamhandler.d.ts +2 -2
- package/lib/{js/ui → ui}/handlers/nicamhandler.js +31 -10
- package/lib/ui/handlers/nicamhandler.test.d.ts +1 -0
- package/lib/{js/ui → ui}/handlers/nicamhandler.test.js +4 -3
- package/lib/{js/ui → ui}/handlers/playnextscreen.js +1 -1
- package/lib/{src/js/ui → ui}/handlers/playnextstreen.test.d.ts +1 -1
- package/lib/{js/ui → ui}/handlers/playnextstreen.test.js +5 -3
- package/lib/{js/ui → ui}/handlers/streamhandler.d.ts +2 -2
- package/lib/ui/handlers/streamhandler.js +51 -0
- package/lib/{src/js/ui → ui}/nativemobileuicontainer.d.ts +1 -1
- package/lib/{js/ui → ui}/nativemobileuicontainer.js +8 -13
- package/lib/{js/ui → ui}/nativemobileuifactory.js +20 -23
- package/lib/ui/nativemobileuifactory.test.d.ts +1 -0
- package/lib/{js/ui → ui}/nativemobileuifactory.test.js +8 -6
- package/lib/{src/js/ui → ui}/uicontainer.d.ts +2 -3
- package/lib/{js/ui → ui}/uicontainer.js +31 -45
- package/package.json +19 -12
- package/src/{scss → style}/components/_controlbars.scss +4 -0
- package/src/{scss → style}/components/_icons.scss +6 -0
- package/src/style/components/_poster.scss +3 -0
- package/src/{scss → style}/components/_settingspanel.scss +15 -1
- package/src/{scss → style}/components/_subtitles.scss +25 -16
- package/src/{scss → style}/npoplayer.css +30 -20
- package/src/{scss → style}/npoplayer.scss +3 -0
- package/src/{scss → style}/variants/_player-small.scss +9 -8
- package/lib/js/checks/apple.d.ts +0 -2
- package/lib/js/checks/apple.js +0 -19
- package/lib/js/checks/apple.test.js +0 -20
- package/lib/js/drm/drm.d.ts +0 -2
- package/lib/js/drm/drm.js +0 -2
- package/lib/js/drm/handlers/decideprofile.d.ts +0 -3
- package/lib/js/drm/handlers/decideprofile.js +0 -53
- package/lib/js/drm/handlers/decideprofile.test.js +0 -33
- package/lib/js/drm/handlers/verifydrm.d.ts +0 -4
- package/lib/js/drm/handlers/verifydrm.js +0 -24
- package/lib/js/drm/handlers/verifydrm.test.js +0 -17
- package/lib/js/fragments/removefragments.d.ts +0 -2
- package/lib/js/fragments/removefragments.js +0 -5
- package/lib/js/fragments/removefragments.test.js +0 -26
- package/lib/js/fragments/setfragments.d.ts +0 -6
- package/lib/js/fragments/setfragments.js +0 -78
- package/lib/js/fragments/setfragments.test.js +0 -72
- package/lib/js/playeractions/handlers/resolvekeypress.d.ts +0 -3
- package/lib/js/playeractions/handlers/resolvekeypress.js +0 -52
- package/lib/js/ui/components/controlbar.d.ts +0 -3
- package/lib/js/ui/components/nativemobile/addFragments.d.ts +0 -1
- package/lib/js/ui/components/nativemobile/addFragments.js +0 -7
- package/lib/js/ui/components/nativemobile/controlbar.d.ts +0 -3
- package/lib/js/ui/components/nativemobile/topbar.d.ts +0 -3
- package/lib/js/ui/components/topbar.d.ts +0 -3
- package/lib/js/ui/handlers/domhandlers.d.ts +0 -3
- package/lib/js/ui/handlers/domhandlers.js +0 -7
- package/lib/js/ui/handlers/domhandlers.test.js +0 -50
- package/lib/js/ui/handlers/streamhandler.js +0 -40
- package/lib/js/utilities/printversion.d.ts +0 -1
- package/lib/js/utilities/utilities.d.ts +0 -16
- package/lib/js/utilities/utilities.js +0 -78
- package/lib/js/utilities/utilities.test.js +0 -50
- package/lib/src/js/checks/apple.d.ts +0 -2
- package/lib/src/js/drm/drm.d.ts +0 -2
- package/lib/src/js/drm/handlers/decideprofile.d.ts +0 -3
- package/lib/src/js/drm/handlers/verifydrm.d.ts +0 -4
- package/lib/src/js/fragments/removefragments.d.ts +0 -2
- package/lib/src/js/fragments/setfragments.d.ts +0 -6
- package/lib/src/js/playeractions/handlers/resolvekeypress.d.ts +0 -3
- package/lib/src/js/ui/components/controlbar.d.ts +0 -3
- package/lib/src/js/ui/components/nativemobile/addFragments.d.ts +0 -1
- package/lib/src/js/ui/components/nativemobile/controlbar.d.ts +0 -3
- package/lib/src/js/ui/components/nativemobile/topbar.d.ts +0 -3
- package/lib/src/js/ui/components/topbar.d.ts +0 -3
- package/lib/src/js/ui/handlers/domhandlers.d.ts +0 -3
- package/lib/src/js/utilities/printversion.d.ts +0 -1
- package/lib/src/js/utilities/utilities.d.ts +0 -16
- /package/lib/js/{utilities/localizationconfig.d.ts → settings/localization.d.ts} +0 -0
- /package/lib/js/{utilities/localizationconfig.js → settings/localization.js} +0 -0
- /package/lib/js/{checks/apple.test.d.ts → utilities/utilities.element.test.d.ts} +0 -0
- /package/lib/js/{drm/handlers/decideprofile.test.d.ts → utilities/utilities.jwt.test.d.ts} +0 -0
- /package/lib/js/{drm/handlers/verifydrm.test.d.ts → utilities/utilities.locale.test.d.ts} +0 -0
- /package/lib/js/{fragments/removefragments.test.d.ts → utilities/utilities.module.test.d.ts} +0 -0
- /package/lib/js/{fragments/setfragments.test.d.ts → utilities/utilities.stream.test.d.ts} +0 -0
- /package/lib/js/{playeractions/handlers/resolvekeypress.test.d.ts → utilities/utilities.text.test.d.ts} +0 -0
- /package/lib/js/{ui/handlers/accessibilityhandler.test.d.ts → utilities/utilities.time.test.d.ts} +0 -0
- /package/lib/js/{ui/handlers/domhandlers.test.d.ts → utilities/utilities.url.test.d.ts} +0 -0
- /package/lib/js/{ui/handlers/nicamhandler.test.d.ts → utilities/utilities.user-agent.test.d.ts} +0 -0
- /package/lib/js/{ui/nativemobileuifactory.test.d.ts → utilities/utilities.version.test.d.ts} +0 -0
- /package/lib/{js/utilities/utilities.test.d.ts → services/a11y/setup.test.d.ts} +0 -0
- /package/lib/{src/js/checks/apple.test.d.ts → services/avTypeHandlers/getAVType.test.d.ts} +0 -0
- /package/lib/{src/js/drm/handlers → services/drmHandlers}/decideprofile.test.d.ts +0 -0
- /package/lib/{src/js/drm/handlers/verifydrm.test.d.ts → services/drmHandlers/utils.test.d.ts} +0 -0
- /package/lib/{src/js/fragments/removefragments.test.d.ts → services/drmHandlers/verifydrm.test.d.ts} +0 -0
- /package/lib/{src/js/fragments/setfragments.test.d.ts → services/eventListenerHandlers/removeEventListeners.test.d.ts} +0 -0
- /package/lib/{src/js/playeractions/handlers → services/keyboardHandlers}/resolvekeypress.test.d.ts +0 -0
- /package/lib/{src/js/ui/handlers/accessibilityhandler.test.d.ts → services/localStorageHandlers/localStorageHandlers.test.d.ts} +0 -0
- /package/lib/{src/js/ui/handlers/domhandlers.test.d.ts → services/npoPlayerAPI/npoPlayerAPI.test.d.ts} +0 -0
- /package/lib/{src/js/ui/handlers/nicamhandler.test.d.ts → services/segmentHandlers/addSegmentEventListeners.test.d.ts} +0 -0
- /package/lib/{src/js/ui/nativemobileuifactory.test.d.ts → services/segmentHandlers/convertFragmentToSegment.test.d.ts} +0 -0
- /package/lib/{src/js/utilities/utilities.test.d.ts → services/segmentHandlers/handleSegmentSeek.test.d.ts} +0 -0
- /package/lib/src/js/{utilities/localizationconfig.d.ts → settings/localization.d.ts} +0 -0
- /package/lib/{js → src}/ui/components/nativemobile/buttons.d.ts +0 -0
- /package/lib/{js → src}/ui/components/nativemobile/ctabar.d.ts +0 -0
- /package/lib/{js → src}/ui/components/nativemobile/titlebar.d.ts +0 -0
- /package/lib/{js → src}/ui/handlers/accessibilityhandler.d.ts +0 -0
- /package/lib/{js → src}/ui/handlers/listboxhandlers.d.ts +0 -0
- /package/lib/{js → src}/ui/handlers/playnextscreen.d.ts +0 -0
- /package/lib/{js → src}/ui/handlers/timecontrolhandlers.d.ts +0 -0
- /package/lib/{js → src}/ui/nativemobileuifactory.d.ts +0 -0
- /package/lib/{js/ui → ui}/components/adbutton.js +0 -0
- /package/lib/{js/ui → ui}/components/adlabel.js +0 -0
- /package/lib/{src/js/ui → ui}/components/nativemobile/buttons.d.ts +0 -0
- /package/lib/{src/js/ui → ui}/components/nativemobile/ctabar.d.ts +0 -0
- /package/lib/{src/js/ui → ui}/components/nativemobile/titlebar.d.ts +0 -0
- /package/lib/{js/ui → ui}/components/nativemobile/titlebar.js +0 -0
- /package/lib/{js/ui → ui}/components/titlebar.js +0 -0
- /package/lib/{src/js/ui → ui}/handlers/accessibilityhandler.d.ts +0 -0
- /package/lib/{js/ui → ui}/handlers/accessibilityhandler.test.js +0 -0
- /package/lib/{src/js/ui → ui}/handlers/listboxhandlers.d.ts +0 -0
- /package/lib/{src/js/ui → ui}/handlers/playnextscreen.d.ts +0 -0
- /package/lib/{src/js/ui → ui}/handlers/timecontrolhandlers.d.ts +0 -0
- /package/lib/{js/ui → ui}/handlers/timecontrolhandlers.js +0 -0
- /package/lib/{src/js/ui → ui}/nativemobileuifactory.d.ts +0 -0
- /package/src/{scss → style}/components/_advert.scss +0 -0
- /package/src/{scss → style}/components/_audio.scss +0 -0
- /package/src/{scss → style}/components/_buffering.scss +0 -0
- /package/src/{scss → style}/components/_error.scss +0 -0
- /package/src/{scss → style}/components/_hugeplaybacktogglebutton.scss +0 -0
- /package/src/{scss → style}/components/_metadata.scss +0 -0
- /package/src/{scss → style}/components/_nicam.scss +0 -0
- /package/src/{scss → style}/components/_playnext.scss +0 -0
- /package/src/{scss → style}/components/_replay.scss +0 -0
- /package/src/{scss → style}/components/_seekbar.scss +0 -0
- /package/src/{scss → style}/components/_seekbarthumbnail.scss +0 -0
- /package/src/{scss → style}/components/_textbuttons.scss +0 -0
- /package/src/{scss → style}/components/_volumeslider.scss +0 -0
- /package/src/{scss → style}/components/audio/_bottombar.scss +0 -0
- /package/src/{scss → style}/components/audio/_buffering.scss +0 -0
- /package/src/{scss → style}/components/audio/_errors.scss +0 -0
- /package/src/{scss → style}/components/audio/_metadata.scss +0 -0
- /package/src/{scss → style}/components/audio/_playbutton.scss +0 -0
- /package/src/{scss → style}/components/audio/_poster.scss +0 -0
- /package/src/{scss → style}/components/audio/_replay.scss +0 -0
- /package/src/{scss → style}/components/audio/_seekbar.scss +0 -0
- /package/src/{scss → style}/components/audio/_topbar.scss +0 -0
- /package/src/{scss → style}/components/audio/_vars.scss +0 -0
- /package/src/{scss → style}/components/audio/_volumeslider.scss +0 -0
- /package/src/{scss → style}/variants/_player-audio.scss +0 -0
- /package/src/{scss → style}/variants/_player-base.scss +0 -0
- /package/src/{scss → style}/variants/_player-debug.scss +0 -0
- /package/src/{scss → style}/variants/_player-large.scss +0 -0
- /package/src/{scss → style}/variants/_player-medium.scss +0 -0
- /package/src/{scss → style}/variants/_player-native-mobile.scss +0 -0
- /package/src/{scss → style}/vars/_audio.scss +0 -0
- /package/src/{scss → style}/vars/_colors.scss +0 -0
- /package/src/{scss → style}/vars/_fonts.scss +0 -0
- /package/src/{scss → style}/vars/_icons.scss +0 -0
package/lib/npoplayer.js
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NpoPlayerServices } from './services/services';
|
|
2
|
+
import { Player, PlayerEvent } from 'bitmovin-player';
|
|
3
|
+
import { UIManager } from 'bitmovin-player-ui';
|
|
2
4
|
import AdsModuleBM from 'bitmovin-player/modules/bitmovinplayer-advertising-bitmovin';
|
|
3
5
|
import { logEvent, initPlayerTracker, startPlayerTracker } from './js/tracking/playertracker';
|
|
4
|
-
import { hidePlayNextScreen, showPlayNextScreenIfNeeded } from './
|
|
5
|
-
import * as utility from './js/utilities/utilities';
|
|
6
|
-
import * as drm from './js/drm/drm';
|
|
6
|
+
import { hidePlayNextScreen, showPlayNextScreenIfNeeded } from './ui/handlers/playnextscreen';
|
|
7
7
|
import * as playerAction from './js/playeractions/playeractions';
|
|
8
|
+
import { getModuleExport } from './js/utilities/utilities.module';
|
|
8
9
|
import { getStreamObject } from './js/api/getstreamobject';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
10
|
+
import { isJWTToken } from './js/utilities/utilities.jwt';
|
|
11
|
+
import { isMediaUrl, isUrl } from './js/utilities/utilities.url';
|
|
12
|
+
import { logVersion } from './js/utilities/utilities.version';
|
|
13
|
+
import { getStreamDurationInSeconds } from './js/utilities/utilities.stream';
|
|
11
14
|
import { customSpecificErrorMessageOverlayConfig } from './js/playeractions/handlers/customerrors';
|
|
12
|
-
import { createUIContainer
|
|
13
|
-
import { addAccessibilityAttributes } from './js/ui/handlers/accessibilityhandler';
|
|
15
|
+
import { createUIContainer } from './ui/uicontainer';
|
|
14
16
|
import { LogEmitter } from './types/classes';
|
|
15
17
|
import { handlePreRolls } from './js/ads/ster';
|
|
16
18
|
import pkg from '../package.json';
|
|
17
|
-
import { NpoPlayerUIVariants } from './types/interfaces';
|
|
18
|
-
import { nativeMobileUiFactory } from './
|
|
19
|
+
import { NpoPlayerUIVariants, LocalStorageValues } from './types/interfaces';
|
|
20
|
+
import { nativeMobileUiFactory } from './ui/nativemobileuifactory';
|
|
19
21
|
import { setupMediaSessionActionHandlers } from './js/playeractions/handlers/mediasessionactions';
|
|
20
|
-
import { processStream } from './
|
|
22
|
+
import { processStream } from './ui/handlers/streamhandler';
|
|
21
23
|
import { removeReplayClass } from './js/playeractions/handlers/removereplayclass';
|
|
22
|
-
import { showNicamAfterUiDelay } from './
|
|
24
|
+
import { showNicamAfterUiDelay } from './ui/handlers/nicamhandler';
|
|
23
25
|
import { updateLiveMarkers } from './js/markers/updateLiveMarkers';
|
|
24
|
-
|
|
26
|
+
import { NpoPlayerAPI } from './services/npoPlayerAPI/npoPlayerAPI';
|
|
27
|
+
export { NpoPlayerUIVariants };
|
|
25
28
|
export default class NpoPlayer {
|
|
26
29
|
constructor(_container, _playerConfig, _npotag, _npotaginstance, _variant) {
|
|
27
30
|
this.sourceConfig = {};
|
|
@@ -31,12 +34,11 @@ export default class NpoPlayer {
|
|
|
31
34
|
assets: { scrubbingThumbnail: '', subtitles: [] },
|
|
32
35
|
user: { type: 'anonymous' }
|
|
33
36
|
};
|
|
34
|
-
this.player =
|
|
35
|
-
this.uiManager =
|
|
36
|
-
this.streamTracker =
|
|
37
|
+
this.player = undefined;
|
|
38
|
+
this.uiManager = undefined;
|
|
39
|
+
this.streamTracker = undefined;
|
|
37
40
|
this.logEmitter = new LogEmitter();
|
|
38
41
|
this.uiComponents = {};
|
|
39
|
-
this.fragment = null;
|
|
40
42
|
this.streamOptions = {};
|
|
41
43
|
this.jwt = '';
|
|
42
44
|
this.apiPayload = { baseURL: '', jwt: '', data: {} };
|
|
@@ -45,6 +47,10 @@ export default class NpoPlayer {
|
|
|
45
47
|
this.drmProfile = { profileName: '', drm: '' };
|
|
46
48
|
this.isShowingPlayNextScreen = false;
|
|
47
49
|
this.canceledPlayNextScreen = false;
|
|
50
|
+
this.playerContext = undefined;
|
|
51
|
+
this.npoplayerServices = new NpoPlayerServices();
|
|
52
|
+
this.eventListeners = undefined;
|
|
53
|
+
this.userPreferences = {};
|
|
48
54
|
this.playerConfig = _playerConfig;
|
|
49
55
|
this.container = _container;
|
|
50
56
|
this.variant = _variant || NpoPlayerUIVariants.DEFAULT;
|
|
@@ -53,23 +59,32 @@ export default class NpoPlayer {
|
|
|
53
59
|
}
|
|
54
60
|
initPlayer(_container, playerConfig, variant) {
|
|
55
61
|
const processedPlayerConfig = playerAction.processPlayerConfig(this, playerConfig);
|
|
56
|
-
Player.addModule(
|
|
62
|
+
Player.addModule(getModuleExport(AdsModuleBM));
|
|
63
|
+
this.userPreferences = this.npoplayerServices.getStoredUserPrefs();
|
|
57
64
|
this.player = new Player(_container, processedPlayerConfig);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.
|
|
65
|
+
const npoPlayerAPI = new NpoPlayerAPI(this.player);
|
|
66
|
+
window.addEventListener('beforeunload', () => {
|
|
67
|
+
if (this.player) {
|
|
68
|
+
this.npoplayerServices.setStoredUserPrefs(LocalStorageValues.SUBTITLES_ENABLED, npoPlayerAPI.areSubtitlesEnabled().toString());
|
|
69
|
+
this.npoplayerServices.setStoredUserPrefs(LocalStorageValues.VOLUME, npoPlayerAPI.getVolume());
|
|
70
|
+
this.npoplayerServices.setStoredUserPrefs(LocalStorageValues.IS_MUTED, npoPlayerAPI.isMuted().toString());
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
this.playerContext = { player: npoPlayerAPI, npoplayer: this };
|
|
74
|
+
this.createUIManager(this.player, this.playerContext, variant);
|
|
75
|
+
this.npoplayerServices.handleUserPrefs(this.playerContext);
|
|
76
|
+
this.npoplayerServices.setAccessibilityAttributes(this.playerContext);
|
|
77
|
+
this.container.addEventListener('keydown', (e) => {
|
|
78
|
+
if (!this.playerContext)
|
|
79
|
+
return;
|
|
80
|
+
this.npoplayerServices.keyboardHandler(this.playerContext, e);
|
|
61
81
|
}, true);
|
|
62
|
-
const playbackToggleElement = this.container.querySelector('.bmpui-ui-playbacktoggle-overlay');
|
|
63
|
-
if (playbackToggleElement) {
|
|
64
|
-
playbackToggleElement.addEventListener('touchend', (event) => {
|
|
65
|
-
event.preventDefault();
|
|
66
|
-
this.player?.play();
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
82
|
}
|
|
70
83
|
async loadStream(source, options = {}) {
|
|
84
|
+
if (!this.playerContext)
|
|
85
|
+
return;
|
|
71
86
|
this.streamOptions = options;
|
|
72
|
-
if (this.player ==
|
|
87
|
+
if (this.player == undefined) {
|
|
73
88
|
console.error('Er is nog geen player geladen.');
|
|
74
89
|
return;
|
|
75
90
|
}
|
|
@@ -78,33 +93,33 @@ export default class NpoPlayer {
|
|
|
78
93
|
return;
|
|
79
94
|
}
|
|
80
95
|
let _streamObject;
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
const
|
|
96
|
+
const sourceIsUrl = isUrl(source);
|
|
97
|
+
const sourceIsMedia = await isMediaUrl(source);
|
|
98
|
+
const sourceIsJWTToken = isJWTToken(source);
|
|
84
99
|
const getDurationAndStartPlayerTracker = function () {
|
|
85
100
|
if (this.player === null)
|
|
86
101
|
return;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
startPlayerTracker(this,
|
|
102
|
+
const prid = (isJWTToken(source) ? this.streamObject?.metadata.prid : source) || 'unknown';
|
|
103
|
+
const duration = this.player ? this.player.getDuration() : undefined;
|
|
104
|
+
startPlayerTracker(this, getStreamDurationInSeconds({ duration: duration }), this.version, prid);
|
|
90
105
|
}.bind(this);
|
|
91
|
-
if (
|
|
106
|
+
if (sourceIsUrl && sourceIsMedia) {
|
|
92
107
|
this.sourceConfig = {
|
|
93
|
-
...options.sourceConfig
|
|
94
|
-
|
|
108
|
+
...options.sourceConfig,
|
|
109
|
+
progressive: source,
|
|
95
110
|
analytics: {
|
|
96
111
|
customData2: 'other',
|
|
97
112
|
customData3: 'unknown',
|
|
98
113
|
customData4: this.npoTag?.npoTagInstance?.getParty(),
|
|
99
114
|
customData5: this.version
|
|
100
|
-
}
|
|
115
|
+
}
|
|
101
116
|
};
|
|
102
|
-
this.player?.load(this.sourceConfig);
|
|
117
|
+
await this.playerContext.player?.load(this.sourceConfig);
|
|
103
118
|
getDurationAndStartPlayerTracker();
|
|
104
119
|
}
|
|
105
|
-
else if (
|
|
120
|
+
else if (sourceIsJWTToken) {
|
|
106
121
|
this.jwt = source;
|
|
107
|
-
const profile = await
|
|
122
|
+
const profile = await this.npoplayerServices.decideProfile(this.playerContext, options?.preferredDRM ?? '');
|
|
108
123
|
const defaultEndpoint = 'https://prod.npoplayer.nl/';
|
|
109
124
|
const endpoint = options?.endpoint ?? defaultEndpoint;
|
|
110
125
|
const payload = {
|
|
@@ -125,59 +140,51 @@ export default class NpoPlayer {
|
|
|
125
140
|
_streamObject = await getStreamObject(this, payload);
|
|
126
141
|
this.streamObject = _streamObject;
|
|
127
142
|
if (_streamObject) {
|
|
128
|
-
this.createUIManager(this.player, this.variant);
|
|
143
|
+
await this.createUIManager(this.player, this.playerContext, this.variant);
|
|
129
144
|
}
|
|
130
145
|
}
|
|
131
|
-
catch (
|
|
132
|
-
this.doError('Het is niet gelukt de stream op te halen. \n' +
|
|
146
|
+
catch (error) {
|
|
147
|
+
this.doError('Het is niet gelukt de stream op te halen. \n' + error);
|
|
133
148
|
this.player.pause();
|
|
134
149
|
return;
|
|
135
150
|
}
|
|
136
151
|
if (this.streamObject?.stream == undefined)
|
|
137
152
|
return;
|
|
138
|
-
const drmType = this.streamObject.stream.drmType ??
|
|
139
|
-
this.sourceConfig = await playerAction.processSourceConfig(options.sourceConfig ?? {}, this.streamObject, drmType && drmType.length > 0 ? profile.drm :
|
|
140
|
-
await
|
|
153
|
+
const drmType = this.streamObject.stream.drmType ?? undefined;
|
|
154
|
+
this.sourceConfig = await playerAction.processSourceConfig(this.npoplayerServices, options.sourceConfig ?? {}, this.streamObject, drmType && drmType.length > 0 ? profile.drm : undefined, this.streamOptions, this.version, this.npoTag?.npoTagInstance?.getParty(), this.npoplayerServices);
|
|
155
|
+
await this.npoplayerServices.verifyDRM(this.playerContext, payload);
|
|
141
156
|
setupMediaSessionActionHandlers(this.player, this.sourceConfig, _streamObject);
|
|
142
157
|
logEvent(this, 'load');
|
|
143
158
|
let streamDuration = _streamObject.metadata.duration;
|
|
144
|
-
|
|
159
|
+
const streamPrid = this.streamObject.metadata.prid || _streamObject.metadata.prid;
|
|
145
160
|
if (this.isShowingPlayNextScreen) {
|
|
146
161
|
this.hidePlayNextScreen();
|
|
147
162
|
}
|
|
148
163
|
const initAndStartTracker = () => {
|
|
149
164
|
if (this.player === null)
|
|
150
165
|
return;
|
|
151
|
-
this.player
|
|
152
|
-
this.player
|
|
153
|
-
this.player
|
|
154
|
-
streamDuration =
|
|
155
|
-
|
|
156
|
-
|
|
166
|
+
this.player?.off(PlayerEvent.SourceLoaded, initAndStartTracker);
|
|
167
|
+
this.player?.off(PlayerEvent.AdBreakFinished, initAndStartTracker);
|
|
168
|
+
this.player?.off(PlayerEvent.AdError, initAndStartTracker);
|
|
169
|
+
streamDuration =
|
|
170
|
+
streamDuration == undefined
|
|
171
|
+
? this.player?.on(PlayerEvent.Ready, getDurationAndStartPlayerTracker)
|
|
172
|
+
: startPlayerTracker(this, getStreamDurationInSeconds({ duration: streamDuration, durationIsInMs: true }), this.version, streamPrid);
|
|
157
173
|
};
|
|
158
|
-
if (this.variant !== NpoPlayerUIVariants.AUDIO &&
|
|
174
|
+
if (this.variant !== NpoPlayerUIVariants.AUDIO &&
|
|
175
|
+
this.streamObject.metadata.hasPreroll === 'true' &&
|
|
176
|
+
this.streamObject.assets.preroll) {
|
|
159
177
|
this.player.on(PlayerEvent.AdBreakFinished, initAndStartTracker);
|
|
160
178
|
this.player.on(PlayerEvent.AdError, initAndStartTracker);
|
|
161
179
|
await handlePreRolls(this.player, this.streamObject, this);
|
|
162
180
|
}
|
|
163
181
|
else {
|
|
164
|
-
this.player.on(PlayerEvent.
|
|
182
|
+
this.player.on(PlayerEvent.Ready, initAndStartTracker);
|
|
165
183
|
}
|
|
166
184
|
}
|
|
167
185
|
else {
|
|
168
186
|
this.doError(`Het is niet gelukt de stream op te halen: \n Input is geen valide token of media object.`, 500);
|
|
169
187
|
}
|
|
170
|
-
const triggerAddAccessibilityAttributes = () => {
|
|
171
|
-
this.player?.off(PlayerEvent.SourceLoaded, triggerAddAccessibilityAttributes);
|
|
172
|
-
this.player?.off(PlayerEvent.AdBreakFinished, triggerAddAccessibilityAttributes);
|
|
173
|
-
this.player?.off(PlayerEvent.AdError, triggerAddAccessibilityAttributes);
|
|
174
|
-
if (this.streamOptions.enableSubtitles === true)
|
|
175
|
-
this.player?.subtitles.enable('sub0');
|
|
176
|
-
void addAccessibilityAttributes(this.container, this.streamObject.metadata);
|
|
177
|
-
};
|
|
178
|
-
this.player.on(PlayerEvent.SourceLoaded, triggerAddAccessibilityAttributes);
|
|
179
|
-
this.player.on(PlayerEvent.AdBreakFinished, triggerAddAccessibilityAttributes);
|
|
180
|
-
this.player.on(PlayerEvent.AdError, triggerAddAccessibilityAttributes);
|
|
181
188
|
if (this.sourceConfig?.metadata) {
|
|
182
189
|
this.sourceConfig.metadata.jwt = source;
|
|
183
190
|
this.sourceConfig.metadata.streamLinkAsJsonString = JSON.stringify(this.streamObject);
|
|
@@ -194,73 +201,62 @@ export default class NpoPlayer {
|
|
|
194
201
|
this.hidePlayNextScreen();
|
|
195
202
|
});
|
|
196
203
|
}
|
|
197
|
-
this.player.on(PlayerEvent.Play, () => {
|
|
198
|
-
|
|
199
|
-
|
|
204
|
+
this.player.on(PlayerEvent.Play, () => {
|
|
205
|
+
showNicamAfterUiDelay(this.player, this.uiManager);
|
|
206
|
+
});
|
|
200
207
|
const setLiveOffsetListener = function () {
|
|
201
208
|
if (this.player === null)
|
|
202
209
|
return;
|
|
203
|
-
this.player
|
|
210
|
+
this.player?.off(PlayerEvent.SourceLoaded, setLiveOffsetListener);
|
|
204
211
|
playerAction.handleLiveOffsetLogic(this, this.player, options);
|
|
205
212
|
}.bind(this);
|
|
206
213
|
this.player.on(PlayerEvent.Ready, setLiveOffsetListener);
|
|
207
214
|
}
|
|
208
|
-
async createUIManager(player, variant) {
|
|
209
|
-
if (this.uiManager ===
|
|
215
|
+
async createUIManager(player, playerContext, variant) {
|
|
216
|
+
if (this.uiManager === undefined || variant !== this.variant) {
|
|
210
217
|
const uiConfig = {
|
|
211
218
|
errorMessages: customSpecificErrorMessageOverlayConfig,
|
|
212
219
|
disableAutoHideWhenHovered: true,
|
|
213
|
-
seekbarSnappingEnabled: false
|
|
220
|
+
seekbarSnappingEnabled: false
|
|
214
221
|
};
|
|
215
222
|
this.uiManager = new UIManager(player, createUIContainer(this, player, variant, this.container), uiConfig);
|
|
216
223
|
this.variant = variant;
|
|
217
224
|
}
|
|
218
225
|
else {
|
|
219
|
-
processStream(this.streamObject, this.container, this.streamOptions, player, this.uiManager, this.sourceConfig);
|
|
226
|
+
processStream(this.streamObject, this.container, this.streamOptions, player, this.uiManager, this.sourceConfig, playerContext);
|
|
220
227
|
}
|
|
221
228
|
}
|
|
222
229
|
doError(input, status) {
|
|
223
|
-
if (this.player ==
|
|
230
|
+
if (this.player == undefined)
|
|
224
231
|
return;
|
|
225
232
|
if (status) {
|
|
226
233
|
this.logEmitter.emit('logError', status);
|
|
227
234
|
}
|
|
228
235
|
playerAction.handlePlayerError(this.player, this.uiComponents, input);
|
|
229
236
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
e.preventDefault();
|
|
233
|
-
if (!this.player)
|
|
234
|
-
return;
|
|
235
|
-
playerAction.resolveKeyPress(this.player, this, e);
|
|
236
|
-
}
|
|
237
|
-
play() {
|
|
238
|
-
if (this.player == null)
|
|
239
|
-
return;
|
|
240
|
-
this.player.play();
|
|
237
|
+
async play() {
|
|
238
|
+
await this.playerContext?.player.play();
|
|
241
239
|
}
|
|
242
240
|
pause() {
|
|
243
|
-
|
|
244
|
-
return;
|
|
245
|
-
this.player.pause();
|
|
241
|
+
this.playerContext?.player.pause();
|
|
246
242
|
}
|
|
247
243
|
setVolume(volume) {
|
|
248
|
-
if (this.player ==
|
|
244
|
+
if (this.player == undefined)
|
|
249
245
|
return;
|
|
250
246
|
this.player.setVolume(volume);
|
|
251
247
|
}
|
|
252
248
|
increaseVolume() {
|
|
253
|
-
if (this.player ==
|
|
249
|
+
if (this.player == undefined)
|
|
254
250
|
return;
|
|
255
251
|
this.setVolume(this.player.getVolume() + 10);
|
|
256
252
|
}
|
|
257
253
|
decreaseVolume() {
|
|
258
|
-
if (this.player ==
|
|
254
|
+
if (this.player == undefined)
|
|
259
255
|
return;
|
|
260
256
|
this.setVolume(this.player.getVolume() - 10);
|
|
261
257
|
}
|
|
262
258
|
goForward(seconds) {
|
|
263
|
-
if (this.player ==
|
|
259
|
+
if (this.player == undefined)
|
|
264
260
|
return;
|
|
265
261
|
if (this.player.isLive() ?? false) {
|
|
266
262
|
this.player.timeShift(Math.min(0, this.player.getTimeShift() + seconds));
|
|
@@ -270,7 +266,7 @@ export default class NpoPlayer {
|
|
|
270
266
|
}
|
|
271
267
|
}
|
|
272
268
|
goBackwards(seconds) {
|
|
273
|
-
if (this.player ==
|
|
269
|
+
if (this.player == undefined)
|
|
274
270
|
return;
|
|
275
271
|
if (this.player.isLive() ?? false) {
|
|
276
272
|
this.player.timeShift(this.player.getTimeShift() - seconds);
|
|
@@ -280,12 +276,12 @@ export default class NpoPlayer {
|
|
|
280
276
|
}
|
|
281
277
|
}
|
|
282
278
|
watchFromStart() {
|
|
283
|
-
if (this.player ==
|
|
279
|
+
if (this.player == undefined)
|
|
284
280
|
return;
|
|
285
281
|
playerAction.shiftToProgramStart(this.player, this.streamOptions.liveProgramTime);
|
|
286
282
|
}
|
|
287
283
|
showPlayNextScreen() {
|
|
288
|
-
if (this.player ==
|
|
284
|
+
if (this.player == undefined || !this.streamOptions.playNext?.showPlayNext || this.adBreakActive)
|
|
289
285
|
return;
|
|
290
286
|
this.player.off(PlayerEvent.TimeChanged, () => {
|
|
291
287
|
this.showPlayNextScreen();
|
|
@@ -294,7 +290,9 @@ export default class NpoPlayer {
|
|
|
294
290
|
const overlayDuration = this.streamOptions.playNext?.duration || 10;
|
|
295
291
|
const offset = this.streamOptions.playNext?.offset || overlayDuration;
|
|
296
292
|
const showPlayNextAt = videoDuration - offset;
|
|
297
|
-
if (!this.isShowingPlayNextScreen &&
|
|
293
|
+
if (!this.isShowingPlayNextScreen &&
|
|
294
|
+
this.player.getCurrentTime() > showPlayNextAt &&
|
|
295
|
+
!this.canceledPlayNextScreen) {
|
|
298
296
|
this.isShowingPlayNextScreen = true;
|
|
299
297
|
showPlayNextScreenIfNeeded(overlayDuration, this.container, this.streamOptions.playNext?.proceedCallback);
|
|
300
298
|
}
|
|
@@ -308,11 +306,10 @@ export default class NpoPlayer {
|
|
|
308
306
|
return;
|
|
309
307
|
updateLiveMarkers(timeLineMarkers, this.player, this.uiManager, this.streamOptions.autoFillTimeLineMarkerDuration ?? true);
|
|
310
308
|
}
|
|
311
|
-
;
|
|
312
309
|
cancelPlayNextScreen() {
|
|
313
310
|
this.canceledPlayNextScreen = true;
|
|
314
311
|
this.hidePlayNextScreen();
|
|
315
|
-
|
|
312
|
+
this.streamOptions.playNext?.cancelCallback?.();
|
|
316
313
|
}
|
|
317
314
|
hidePlayNextScreen() {
|
|
318
315
|
this.player?.off(PlayerEvent.Paused, () => {
|
|
@@ -323,50 +320,43 @@ export default class NpoPlayer {
|
|
|
323
320
|
}
|
|
324
321
|
doPlayNext() {
|
|
325
322
|
this.hidePlayNextScreen();
|
|
326
|
-
|
|
323
|
+
this.streamOptions.playNext?.proceedCallback?.();
|
|
327
324
|
}
|
|
328
325
|
destroy(asyncMode = false) {
|
|
329
326
|
const destroyLogic = async () => {
|
|
330
327
|
try {
|
|
331
|
-
if (this.npoTag !=
|
|
328
|
+
if (this.npoTag != undefined) {
|
|
332
329
|
clearInterval(this.npoTag.heartbeatInterval);
|
|
333
330
|
}
|
|
334
331
|
logEvent(this, 'stop');
|
|
335
|
-
const playerContainer = this.player?.getContainer();
|
|
336
|
-
if (playerContainer)
|
|
337
|
-
removeUIContainer(playerContainer);
|
|
338
332
|
this.uiManager?.release();
|
|
339
|
-
this.uiManager =
|
|
333
|
+
this.uiManager = undefined;
|
|
340
334
|
await this.player?.destroy();
|
|
341
335
|
return true;
|
|
342
336
|
}
|
|
343
|
-
catch (
|
|
344
|
-
console.error('Error destroying player:',
|
|
337
|
+
catch (error) {
|
|
338
|
+
console.error('Error destroying player:', error);
|
|
345
339
|
return false;
|
|
346
340
|
}
|
|
347
341
|
};
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
}
|
|
342
|
+
return asyncMode
|
|
343
|
+
? destroyLogic()
|
|
344
|
+
.then(() => true)
|
|
345
|
+
.catch(() => false)
|
|
346
|
+
: destroyLogic();
|
|
354
347
|
}
|
|
355
348
|
unload(asyncMode = false) {
|
|
356
349
|
const unloadLogic = async () => {
|
|
357
350
|
try {
|
|
358
|
-
if (this.npoTag !=
|
|
351
|
+
if (this.npoTag != undefined) {
|
|
359
352
|
clearInterval(this.npoTag.heartbeatInterval);
|
|
360
353
|
}
|
|
361
|
-
const playerContainer = this.player?.getContainer();
|
|
362
|
-
if (playerContainer)
|
|
363
|
-
removeUIContainer(playerContainer);
|
|
364
354
|
this.hidePlayNextScreen();
|
|
365
355
|
await this.player?.unload();
|
|
366
356
|
return true;
|
|
367
357
|
}
|
|
368
|
-
catch (
|
|
369
|
-
console.error('Error unloading player:',
|
|
358
|
+
catch (error) {
|
|
359
|
+
console.error('Error unloading player:', error);
|
|
370
360
|
return false;
|
|
371
361
|
}
|
|
372
362
|
};
|
|
@@ -377,16 +367,18 @@ export default class NpoPlayer {
|
|
|
377
367
|
try {
|
|
378
368
|
return unloadLogic();
|
|
379
369
|
}
|
|
380
|
-
catch
|
|
370
|
+
catch {
|
|
381
371
|
return false;
|
|
382
372
|
}
|
|
383
373
|
}
|
|
384
374
|
}
|
|
385
375
|
printVersion() {
|
|
386
|
-
|
|
376
|
+
logVersion(this.version);
|
|
387
377
|
}
|
|
388
378
|
}
|
|
389
|
-
|
|
379
|
+
;
|
|
380
|
+
window.bitmovin.playerui = function () {
|
|
381
|
+
};
|
|
390
382
|
window.bitmovin.playerui.UIFactory = {
|
|
391
383
|
buildDefaultSmallScreenUI: function (player, config = {}) {
|
|
392
384
|
return nativeMobileUiFactory(player, config);
|
package/lib/npoplayer.test.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import NpoPlayer from './npoplayer';
|
|
2
2
|
const div = document.createElement('div');
|
|
3
3
|
const testPlayerConfig = {
|
|
4
|
-
key: 'dummy-key'
|
|
4
|
+
key: 'dummy-key'
|
|
5
5
|
};
|
|
6
|
-
jest.mock('./
|
|
7
|
-
processStream: jest.fn()
|
|
6
|
+
jest.mock('./ui/handlers/streamhandler', () => ({
|
|
7
|
+
processStream: jest.fn()
|
|
8
8
|
}));
|
|
9
9
|
let player;
|
|
10
10
|
test('player init', async () => {
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npo/player",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "NPO Player",
|
|
5
5
|
"author": "Publieke Omroep <player@npo.nl>",
|
|
6
6
|
"contributors": [
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"types": "./lib/npoplayer.d.ts",
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "webpack --hot",
|
|
19
|
-
"build:scss": "npm run build:web-styles && npm run build:mobile-styles && mkdir -p dist && cp src/scss/*.css dist && cp src/scss/*.css.map
|
|
20
|
-
"build:web-styles": "sass src/
|
|
21
|
-
"build:mobile-styles": "sass src/
|
|
19
|
+
"build:scss": "npm run build:web-styles && npm run build:mobile-styles && mkdir -p dist && cp src/style/*.css dist && mkdir src/scss && cp src/style/*.css.map dist && cp src/style/*.css src/scss && cp src/style/*.css.map src/scss",
|
|
20
|
+
"build:web-styles": "sass src/style/npoplayer.scss:src/style/npoplayer.css --style=compressed && postcss src/style/npoplayer.css --use autoprefixer postcss-import -o src/style/npoplayer.css",
|
|
21
|
+
"build:mobile-styles": "sass src/style/npoplayer-mobile.scss:src/style/npoplayer-mobile.css --style=compressed && postcss src/style/npoplayer-mobile.css --use autoprefixer postcss-import -o src/style/npoplayer-mobile.css",
|
|
22
22
|
"build:cdn": "npm run build && bash build-cdn.sh",
|
|
23
23
|
"lint": "eslint src --fix",
|
|
24
24
|
"bundle": "npm run lint && bash build-lib.sh && npm run build:scss && npm run build:cdn",
|
|
@@ -33,16 +33,17 @@
|
|
|
33
33
|
"README.md",
|
|
34
34
|
"CHANGELOG.md",
|
|
35
35
|
"lib",
|
|
36
|
-
"src/
|
|
37
|
-
"src/
|
|
38
|
-
"src/
|
|
39
|
-
"src/
|
|
40
|
-
"src/
|
|
36
|
+
"src/style/components",
|
|
37
|
+
"src/style/variants",
|
|
38
|
+
"src/style/vars",
|
|
39
|
+
"src/style/npoplayer.scss",
|
|
40
|
+
"src/style/npoplayer.css"
|
|
41
41
|
],
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/core": "^7.20.12",
|
|
44
44
|
"@babel/preset-env": "^7.20.2",
|
|
45
45
|
"@babel/preset-typescript": "^7.18.6",
|
|
46
|
+
"@testing-library/jest-dom": "^6.4.5",
|
|
46
47
|
"@types/fs-extra": "^11.0.1",
|
|
47
48
|
"@types/jest": "^29.4.0",
|
|
48
49
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
|
@@ -52,11 +53,16 @@
|
|
|
52
53
|
"babel-loader": "^8.3.0",
|
|
53
54
|
"css-loader": "^6.7.3",
|
|
54
55
|
"eslint": "^8.38.0",
|
|
56
|
+
"eslint-config-prettier": "^9.1.0",
|
|
55
57
|
"eslint-config-standard-with-typescript": "^34.0.1",
|
|
56
58
|
"eslint-plugin-import": "^2.27.5",
|
|
59
|
+
"eslint-plugin-jest-dom": "^5.4.0",
|
|
57
60
|
"eslint-plugin-n": "^15.7.0",
|
|
61
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
58
62
|
"eslint-plugin-promise": "^6.1.1",
|
|
59
63
|
"eslint-plugin-sonarjs": "^0.23.0",
|
|
64
|
+
"eslint-plugin-testing-library": "^6.2.2",
|
|
65
|
+
"eslint-plugin-unicorn": "^52.0.0",
|
|
60
66
|
"fs-extra": "^11.1.1",
|
|
61
67
|
"jest": "^28.1.3",
|
|
62
68
|
"jest-environment-jsdom": "^29.4.1",
|
|
@@ -70,6 +76,7 @@
|
|
|
70
76
|
"postcss-import": "^15.1.0",
|
|
71
77
|
"postcss-loader": "^7.3.3",
|
|
72
78
|
"postcss-scss": "^4.0.7",
|
|
79
|
+
"prettier": "^3.2.5",
|
|
73
80
|
"sass": "^1.58.0",
|
|
74
81
|
"sass-loader": "^12.6.0",
|
|
75
82
|
"style-loader": "^3.3.1",
|
|
@@ -82,9 +89,9 @@
|
|
|
82
89
|
"webpack-dev-server": "^4.11.1"
|
|
83
90
|
},
|
|
84
91
|
"dependencies": {
|
|
85
|
-
"@npotag/tag": "
|
|
86
|
-
"bitmovin-player": "8.
|
|
87
|
-
"bitmovin-player-ui": "3.
|
|
92
|
+
"@npotag/tag": "3.1.2",
|
|
93
|
+
"bitmovin-player": "8.166.0",
|
|
94
|
+
"bitmovin-player-ui": "3.64.0"
|
|
88
95
|
},
|
|
89
96
|
"browserslist": [
|
|
90
97
|
"defaults",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PlayerEvent } from 'bitmovin-player';
|
|
2
|
+
import { addAccessibilityAttributes } from '../../ui/handlers/accessibilityhandler';
|
|
3
|
+
export function setupAccessibilityAttributes(playerContext) {
|
|
4
|
+
const { player, npoplayer } = playerContext;
|
|
5
|
+
const events = [PlayerEvent.SourceLoaded, PlayerEvent.AdBreakFinished, PlayerEvent.AdError];
|
|
6
|
+
const triggerAddAccessibilityAttributes = () => {
|
|
7
|
+
for (const event of events) {
|
|
8
|
+
player?.off(event, triggerAddAccessibilityAttributes);
|
|
9
|
+
}
|
|
10
|
+
if (npoplayer.streamOptions.enableSubtitles === true || npoplayer.userPreferences.subtitles_enabled === 'true') {
|
|
11
|
+
player?.enableSubtitles();
|
|
12
|
+
}
|
|
13
|
+
addAccessibilityAttributes(npoplayer.container, npoplayer.streamObject.metadata);
|
|
14
|
+
};
|
|
15
|
+
for (const event of events) {
|
|
16
|
+
player?.on(event, triggerAddAccessibilityAttributes);
|
|
17
|
+
}
|
|
18
|
+
}
|