Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bitmovin/player-integration-conviva

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bitmovin/player-integration-conviva - npm Package Compare versions

Comparing version 5.4.0 to 5.4.1

8

CHANGELOG.md

@@ -10,2 +10,7 @@ # Changelog

## [5.4.1] - 2024-11-27
### Fixed
- Ad-related delays not contributing to rebuffering metrics
- Underreported VST after playing CSAI pre-rolls
## [5.4.0] - 2024-08-27

@@ -146,3 +151,4 @@ ### Added

[Unreleased]: https://github.com/bitmovin/bitmovin-player-analytics-conviva/compare/v5.4.0...HEAD
[Unreleased]: https://github.com/bitmovin/bitmovin-player-analytics-conviva/compare/v5.4.1...HEAD
[5.4.1]: https://github.com/bitmovin/bitmovin-player-analytics-conviva/compare/v5.4.0...v5.4.1
[5.4.0]: https://github.com/bitmovin/bitmovin-player-analytics-conviva/compare/v5.3.0...v5.4.0

@@ -149,0 +155,0 @@ [5.3.0]: https://github.com/bitmovin/bitmovin-player-analytics-conviva/compare/v5.2.0...v5.3.0

2

dist/bitmovin-player-analytics-conviva.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@convivainc/conviva-js-coresdk"),require("bitmovin-player")):"function"==typeof define&&define.amd?define("bitmovin-player-analytics-conviva",["@convivainc/conviva-js-coresdk","bitmovin-player"],e):"object"==typeof exports?exports["bitmovin-player-analytics-conviva"]=e(require("@convivainc/conviva-js-coresdk"),require("bitmovin-player")):(t.bitmovin=t.bitmovin||{},t.bitmovin.player=t.bitmovin.player||{},t.bitmovin.player.analytics=e(t.Conviva,t.bitmovin.player))}(window,function(t,e){return function(t){var e={};function a(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,a),n.l=!0,n.exports}return a.m=t,a.c=e,a.d=function(t,e,i){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(i,n,function(e){return t[e]}.bind(null,n));return i},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=6)}([function(e,a){e.exports=t},function(t,a){t.exports=e},function(t,e,a){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,a=1,i=arguments.length;a<i;a++)for(var n in e=arguments[a])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.AdHelper=void 0;var n=a(0),r=a(3),o=function(){function t(){}return t.mapCsaiAdPosition=function(t,e){return t.scheduleTime<=0?n.Constants.AdPosition.PREROLL:t.scheduleTime>=e.getDuration()?n.Constants.AdPosition.POSTROLL:n.Constants.AdPosition.MIDROLL},t.formatCsaiAdError=function(t){var e,a,i=(null==t?void 0:t.message)||"Unknown message",n=(null==t?void 0:t.name)||"Unknown name";return["Ad error:","".concat(n,";"),(null===(e=t.data)||void 0===e?void 0:e.code)?"Ad error code: ".concat(null===(a=t.data)||void 0===a?void 0:a.code,";"):void 0,"Message:","".concat(i,";"),"Error code: ".concat(t.code,";"),t.troubleShootLink?"Troubleshoot link: ".concat(t.troubleShootLink):void 0].filter(Boolean).join(" ")},t.extractCsaiConvivaAdInfo=function(e,a,i){var r,o,s,c=i.ad,l=c.data,d="NA",v="NA",y="NA",u=c.id;l&&("adSystem"in l&&(null===(o=l.adSystem)||void 0===o?void 0:o.name)&&(d=l.adSystem.name),"creative"in l&&(null===(s=null==l?void 0:l.creative)||void 0===s?void 0:s.id)&&(v=l.creative.id),"adTitle"in l&&l.adTitle&&(y=l.adTitle),"wrapperAdIds"in l&&l.wrapperAdIds&&l.wrapperAdIds.length&&(u=l.wrapperAdIds[l.wrapperAdIds.length-1]));var A=((r={"c3.ad.id":c.id,"c3.ad.technology":n.Constants.AdType.CLIENT_SIDE,"c3.ad.position":t.mapCsaiAdPosition(a.adBreak,e),"c3.ad.system":d,"c3.ad.creativeId":v,"c3.ad.firstAdId":u})[n.Constants.ASSET_NAME]=y,r[n.Constants.STREAM_URL]=c.mediaFileUrl||"NA",r["c3.ad.mediaFileApiFramework"]="NA",r["c3.ad.firstAdSystem"]="NA",r["c3.ad.firstCreativeId"]="NA",r);return"duration"in c&&c.duration&&(A[n.Constants.DURATION]=c.duration),A},t.convertSsaiAdInfoToConvivaAdInfo=function(t,e){var a,o=[r.INTEGRATION_VERSION_CONTENT_METADATA_CUSTOM_TAG,r.STREAM_TYPE_CONTENT_METADATA_CUSTOM_TAG,n.Constants.ASSET_NAME,n.Constants.IS_LIVE,n.Constants.DEFAULT_RESOURCE,n.Constants.ENCODED_FRAMERATE,n.Constants.VIEWER_ID,n.Constants.PLAYER_NAME],s={};o.forEach(function(t){s[t]=e[t]});var c=i(i(i({},s),t.additionalMetadata),((a={"c3.ad.id":t.id,"c3.ad.technology":n.Constants.AdType.SERVER_SIDE,"c3.ad.position":t.position||"NA","c3.ad.system":t.adSystem||"NA"})[n.Constants.ASSET_NAME]=t.title||s[n.Constants.ASSET_NAME]||"NA",a["c3.ad.adStitcher"]=t.adStitcher||"NA",a["c3.ad.isSlate"]=void 0===t.isSlate?"NA":t.isSlate.toString(),a));return t.duration&&(c[n.Constants.DURATION]=t.duration),c},t}();e.AdHelper=o},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConvivaAnalyticsTracker=e.VR_CONTENT_TYPE_CONTENT_METADATA_CUSTOM_TAG=e.STREAM_TYPE_CONTENT_METADATA_CUSTOM_TAG=e.PLAYER_TYPE_CONTENT_METADATA_CUSTOM_TAG=e.INTEGRATION_VERSION_CONTENT_METADATA_CUSTOM_TAG=e.PRELOAD_CONTENT_METADATA_CUSTOM_TAG=e.AUTOPLAY_CONTENT_METADATA_CUSTOM_TAG=void 0;var i=a(0),n=a(1),r=a(10),o=a(4),s=a(11),c=a(12),l=a(13),d=a(14),v=a(15),y=a(2),u=a(5),A=a(17),p=a(19);e.AUTOPLAY_CONTENT_METADATA_CUSTOM_TAG="autoplay",e.PRELOAD_CONTENT_METADATA_CUSTOM_TAG="preload",e.INTEGRATION_VERSION_CONTENT_METADATA_CUSTOM_TAG="integrationVersion",e.PLAYER_TYPE_CONTENT_METADATA_CUSTOM_TAG="playerType",e.STREAM_TYPE_CONTENT_METADATA_CUSTOM_TAG="streamType",e.VR_CONTENT_TYPE_CONTENT_METADATA_CUSTOM_TAG="vrContentType";var h=function(){function t(e,a){var n;void 0===a&&(a={});var u=this;if(this.logger=new o.Html5Logging,this.sessionKey=i.Constants.NO_SESSION_KEY,this._isAdBreakActive=!1,this.hasPlayed=!1,this.stallTrackingTimeout=new d.Timeout(t.STALL_TRACKING_DELAY_MS,function(){u._isAdBreakActive?(u.debugLog("[ ConvivaAnalyticsTracker ] report buffering ad playback state"),u.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.PLAYER_STATE,i.Constants.PlayerState.BUFFERING)):(u.debugLog("[ ConvivaAnalyticsTracker ] report buffering playback state"),u.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.PLAYER_STATE,i.Constants.PlayerState.BUFFERING))}),this.sessionEndedExternally=!1,this.internalEndSession=function(){u.isSessionActive()&&(u.debugLog("[ ConvivaAnalyticsTracker ] end session",u.sessionKey),u.contentMetadataBuilder.reset(),u.convivaVideoAnalytics.release(),u.convivaVideoAnalytics=null,u.convivaAdAnalytics.release(),u.convivaAdAnalytics=null,u.hasPlayed=!1,u._isAdBreakActive=!1)},this.onSourceLoaded=function(t){u.debugLog("[ ConvivaAnalyticsTracker ] [ Player Event ] source loaded",t),u.isSessionActive()&&(u.buildContentMetadata(),u.updateSession())},this.onPlay=function(t){u.debugLog("[ ConvivaAnalyticsTracker ] [ Player Event ] play"),u.canTrackPlayEvent&&(u.isSessionActive()||u.sessionEndedExternally||u.internalInitializeSession(),u.hasPlayed||(u.hasPlayed=!0,u.trackUpdateAudioTrack(u.player.getAudio()),u.trackInitialSubtitles()))},this.onPlaying=function(t){u.debugLog("[ ConvivaAnalyticsTracker ] [ Player Event ] playing",t),u.isSessionActive()&&(u.contentMetadataBuilder.setPlaybackStarted(!0),u.updateSession())},this.onPlaybackFinished=function(t){u.debugLog("[ ConvivaAnalyticsTracker ] [ Player Event ] playback finished",t),u.isSessionActive()&&(u.convivaVideoAnalytics.release(),u.convivaVideoAnalytics=null,u.convivaAdAnalytics.release(),u.convivaAdAnalytics=null)},this.trackVideoQualityChanged=function(t){if(u.isSessionActive()){var e=Math.round(t.targetQuality.bitrate/1e3);u.debugLog("[ ConvivaAnalyticsTracker ] report bitrate",{event:t,bitrateKbps:e}),u.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.BITRATE,e)}},this.trackAdBreakStarted=function(t){u.isSessionActive()&&(u._isAdBreakActive=!0,u.debugLog("[ ConvivaAnalyticsTracker ] report ad break started",{type:t}),u.convivaVideoAnalytics.reportAdBreakStarted(t,t===i.Constants.AdType.CLIENT_SIDE?i.Constants.AdPlayer.SEPARATE:i.Constants.AdPlayer.CONTENT))},this.trackAdStarted=function(t,e,a){if(u.isSessionActive()){if(u.debugLog("[ ConvivaAnalyticsTracker ] report ad started",{adInfo:t,type:e,bitrateKbps:a}),u.convivaAdAnalytics.reportAdStarted(t),u.debugLog("[ ConvivaAnalyticsTracker ] report ".concat(p.PlayerStateHelper.getPlayerState(u.player)," ad playback state")),u.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.PLAYER_STATE,p.PlayerStateHelper.getPlayerState(u.player)),e===i.Constants.AdType.SERVER_SIDE){var n=u.player.getPlaybackVideoData(),r="".concat(n.width,"x").concat(n.height);u.debugLog("[ ConvivaAnalyticsTracker ] report ad resolution",r),u.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.RESOLUTION,r),n.frameRate&&(u.debugLog("[ ConvivaAnalyticsTracker ] report framerate",n.frameRate),u.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.RENDERED_FRAMERATE,n.frameRate))}a&&(u.debugLog("[ ConvivaAnalyticsTracker ] report ad bitrate",a),u.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.BITRATE,a))}},this.trackAdFinished=function(){u.isSessionActive()&&(u.debugLog("[ ConvivaAnalyticsTracker ] report ad ended"),u.convivaAdAnalytics.reportAdEnded())},this.trackAdSkipped=function(){u.isSessionActive()&&(u.debugLog("[ ConvivaAnalyticsTracker ] report ad skipped"),u.convivaAdAnalytics.reportAdSkipped())},this.trackAdBreakFinished=function(){u.isSessionActive()&&(u._isAdBreakActive=!1,u.debugLog("[ ConvivaAnalyticsTracker ] report ad break ended"),u.convivaVideoAnalytics.reportAdBreakEnded(),u.debugLog("[ ConvivaAnalyticsTracker ] report ".concat(p.PlayerStateHelper.getPlayerState(u.player)," playback state")),u.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.PLAYER_STATE,p.PlayerStateHelper.getPlayerState(u.player)))},this.trackAdError=function(t){if(u.isSessionActive()){var e=y.AdHelper.formatCsaiAdError(t);u.debugLog("[ ConvivaAnalyticsTracker ] report ad error",{event:t,formattedError:e}),u.convivaAdAnalytics.reportAdError(e,i.Constants.ErrorSeverity.WARNING)}},this.trackError=function(t){u.isSessionActive()||u.sessionEndedExternally||u.internalInitializeSession(),u.debugLog("[ ConvivaAnalyticsTracker ] report playback deficiency",t),u.reportPlaybackDeficiency(String(t.code)+" "+t.name,i.Constants.ErrorSeverity.FATAL)},this.onSourceUnloaded=function(t){u.debugLog("[ ConvivaAnalyticsTracker ] [ Player Event ] source unloaded",t),u._isAdBreakActive||u.internalEndSession()},void 0!==i){this.config=a,this.config.debugLoggingEnabled=this.config.debugLoggingEnabled||!1;var A=this.config.deviceMetadata||{},h=((n={})[i.Constants.DeviceMetadata.CATEGORY]=A.category||this.config.deviceCategory||i.Constants.DeviceCategory.WEB,n[i.Constants.DeviceMetadata.BRAND]=A.brand,n[i.Constants.DeviceMetadata.MANUFACTURER]=A.manufacturer,n[i.Constants.DeviceMetadata.MODEL]=A.model,n[i.Constants.DeviceMetadata.TYPE]=A.type,n[i.Constants.DeviceMetadata.VERSION]=A.version,n[i.Constants.DeviceMetadata.OS_NAME]=A.osName,n[i.Constants.DeviceMetadata.OS_VERSION]=A.osVersion,n);i.Analytics.setDeviceMetadata(h);var g={};g[i.Constants.CallbackFunctions.CONSOLE_LOG]=this.logger.consoleLog,g[i.Constants.CallbackFunctions.MAKE_REQUEST]=(new r.Html5Http).makeRequest;var f=new s.Html5Storage;g[i.Constants.CallbackFunctions.SAVE_DATA]=f.saveData,g[i.Constants.CallbackFunctions.LOAD_DATA]=f.loadData,g[i.Constants.CallbackFunctions.CREATE_TIMER]=(new l.Html5Timer).createTimer,g[i.Constants.CallbackFunctions.GET_EPOCH_TIME_IN_MS]=(new c.Html5Time).getEpochTimeMs;var T={};T[i.Constants.GATEWAY_URL]=a.gatewayUrl,T[i.Constants.LOG_LEVEL]=this.config.debugLoggingEnabled?i.Constants.LogLevel.DEBUG:i.Constants.LogLevel.NONE,i.Analytics.init(e,g,T),this.contentMetadataBuilder=new v.ContentMetadataBuilder(this.logger)}else console.error("Conviva script missing, cannot init ConvivaAnalytics. Please load the Conviva script (conviva-core-sdk.min.js) before Bitmovin's ConvivaAnalytics integration.")}return Object.defineProperty(t.prototype,"player",{get:function(){if(!this._player)throw new Error("Player is not initialized, either pass it to the constructor or attach it via `attachPlayer` before using the integration.");return this._player},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPlayerAttached",{get:function(){return!!this._player},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAdBreakActive",{get:function(){return this._isAdBreakActive},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canTrackPlayEvent",{get:function(){return!this._isAdBreakActive},enumerable:!1,configurable:!0}),t.prototype.canAttachPlayer=function(t){var e=void 0;return this.isPlayerAttached&&(e="Player is already attached"),t.getSource()&&(e="Player.load() has already been called (attaching player is possible only before player.load())"),{canAttach:!e,reason:e}},t.prototype.attachPlayer=function(t){this.canAttachPlayer(t).canAttach&&(this._player=t,this.handlers=new u.PlayerEventWrapper(t),this.setPlayerInfo(),this.registerPlayerEvents())},t.prototype.setPlayerInfo=function(){var t;if(this.convivaVideoAnalytics&&this.convivaAdAnalytics&&this.isPlayerAttached){var e=((t={})[i.Constants.FRAMEWORK_NAME]="Bitmovin Player",t[i.Constants.FRAMEWORK_VERSION]=this.player.version,t);this.convivaVideoAnalytics.setPlayerInfo(e),this.convivaAdAnalytics.setAdPlayerInfo(e)}},t.prototype.getContentMetadata=function(){return this.contentMetadataBuilder.build()},t.prototype.initializeSession=function(){if(this.isSessionActive())this.logger.consoleLog("[ ConvivaAnalyticsTracker ] There is already a session running.",i.SystemSettings.LogLevel.WARNING);else{if(!this.isPlayerAttached&&!this.contentMetadataBuilder.assetName)throw"Player is not attached during session initialization and `assetName` is empty in the content metadata. Either attach the player before calling `initializeSession` or set the `assetName` manually using `updateContentMetadata`.";if(this.isPlayerAttached&&!this.player.getSource()&&!this.contentMetadataBuilder.assetName)throw"Player is attached but no source is loaded and `assetName` is empty in the content metadata. Either load a source before calling `initializeSession` or set the `assetName` manually using `updateContentMetadata`.";this.internalInitializeSession(),this.sessionEndedExternally=!1}},t.prototype.ensurePlaybackFinished=function(){this.isSessionActive()&&(this._isAdBreakActive&&(this.debugLog("[ ConvivaAnalyticsTracker ] report ad skipped"),this.convivaAdAnalytics.reportAdSkipped()),this.debugLog("[ ConvivaAnalyticsTracker ] report playback ended state"),this.convivaVideoAnalytics.reportPlaybackEnded())},t.prototype.endSession=function(){this.isSessionActive()&&(this.debugLog("[ ConvivaAnalytics ] external ending session"),this.ensurePlaybackFinished(),this.internalEndSession(),this.sessionEndedExternally=!0)},t.prototype.sendCustomApplicationEvent=function(t,e){void 0===e&&(e={}),this.isSessionActive()?(this.debugLog("[ ConvivaAnalyticsTracker ] report custom app event",{eventName:t,eventAttributes:e}),this.convivaVideoAnalytics.reportAppEvent(t,e)):this.logger.consoleLog("[ ConvivaAnalyticsTracker ] cannot send application event, no active monitoring session",i.SystemSettings.LogLevel.WARNING)},t.prototype.sendCustomPlaybackEvent=function(t,e){void 0===e&&(e={}),this.isSessionActive()?(this.debugLog("[ ConvivaAnalyticsTracker ] report custom playback event",{eventName:t,eventAttributes:e}),this.convivaVideoAnalytics.reportPlaybackEvent(t,e)):this.logger.consoleLog("[ ConvivaAnalyticsTracker ] cannot send playback event, no active monitoring session",i.SystemSettings.LogLevel.WARNING)},t.prototype.updateContentMetadata=function(t){this.internalUpdateContentMetadata(t)},t.prototype.reportPlaybackDeficiency=function(t,e,a){void 0===a&&(a=!0),this.isSessionActive()&&(this.debugLog("[ ConvivaAnalyticsTracker ] report playback failed",{message:t}),this.convivaVideoAnalytics.reportPlaybackFailed(t),a&&this.internalEndSession())},t.prototype.pauseTracking=function(){this.debugLog("[ ConvivaAnalyticsTracker ] pause tracking via ad break started reporting"),this.convivaVideoAnalytics.reportAdBreakStarted(i.Constants.AdType.CLIENT_SIDE,i.Constants.AdPlayer.SEPARATE)},t.prototype.resumeTracking=function(){this.debugLog("[ ConvivaAnalyticsTracker ] resume tracking via ad break ended reporting"),this.convivaVideoAnalytics.reportAdBreakEnded()},t.prototype.release=function(t){this.debugLog("[ ConvivaAnalyticsTracker ] releasing",{isPlayerDestroyed:t}),t||this.unregisterPlayerEvents(),this._player=null,this.handlers=null,this.ensurePlaybackFinished(),this.internalEndSession(),i.Analytics.release()},t.prototype.debugLog=function(t){for(var e=[],a=1;a<arguments.length;a++)e[a-1]=arguments[a];this.config.debugLoggingEnabled&&console.log.apply(console,arguments)},t.prototype.getUrlFromSource=function(t){switch(this.player.getStreamType()){case"dash":return t.dash;case"hls":return t.hls;case"progressive":return Array.isArray(t.progressive)?t.progressive[0].url:t.progressive}},t.prototype.internalUpdateContentMetadata=function(t){this.contentMetadataBuilder.setOverrides(t),this.isSessionActive()?(this.buildContentMetadata(),this.updateSession()):this.logger.consoleLog("[ ConvivaAnalyticsTracker ] no active session. Content metadata will be propagated to Conviva on session initialization.",i.SystemSettings.LogLevel.DEBUG)},t.prototype.internalInitializeSession=function(){var t=this;this.debugLog("[ ConvivaAnalyticsTracker ] initializing session"),this.buildContentMetadata(),this.convivaVideoAnalytics=i.Analytics.buildVideoAnalytics(),this.convivaAdAnalytics=i.Analytics.buildAdAnalytics(this.convivaVideoAnalytics),this.debugLog("[ ConvivaAnalyticsTracker ] report playback requested"),this.convivaVideoAnalytics.reportPlaybackRequested(this.contentMetadataBuilder.build()),this.sessionKey=this.convivaVideoAnalytics.getSessionId(),this.debugLog("[ ConvivaAnalyticsTracker ] new session key",this.sessionKey),this.setPlayerInfo(),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.PLAYER_STATE,i.Constants.PlayerState.STOPPED),this.convivaVideoAnalytics.setCallback(function(){if(t.isPlayerAttached){var e=t.player.getCurrentTime(n.TimeMode.RelativeTime);if(Number.isFinite(e)){var a=1e3*e;t._isAdBreakActive?(t.debugLog("[ ConvivaAnalyticsTracker ] report ad player head time",a),t.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.PLAY_HEAD_TIME,a)):(t.debugLog("[ ConvivaAnalyticsTracker ] report player head time",a),t.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.PLAY_HEAD_TIME,a))}}}),this.isSessionActive()||this.logger.consoleLog("[ ConvivaAnalyticsTracker ] Something went wrong, could not obtain session key",i.SystemSettings.LogLevel.ERROR)},t.prototype.buildContentMetadata=function(){var a,n;if(this.isPlayerAttached){this.contentMetadataBuilder.duration=this.player.getDuration(),this.contentMetadataBuilder.streamType=this.player.isLive()?i.ContentMetadata.StreamType.LIVE:i.ContentMetadata.StreamType.VOD,this.contentMetadataBuilder.addToCustom(((a={})[e.AUTOPLAY_CONTENT_METADATA_CUSTOM_TAG]=A.PlayerConfigHelper.getAutoplayConfig(this.player)+"",a[e.PRELOAD_CONTENT_METADATA_CUSTOM_TAG]=A.PlayerConfigHelper.getPreloadConfig(this.player)+"",a[e.INTEGRATION_VERSION_CONTENT_METADATA_CUSTOM_TAG]=t.VERSION,a));var r=this.player.getSource();r&&(this.contentMetadataBuilder.assetName=this.getAssetNameFromSource(r),this.contentMetadataBuilder.viewerId=this.contentMetadataBuilder.viewerId,this.contentMetadataBuilder.addToCustom(((n={})[e.PLAYER_TYPE_CONTENT_METADATA_CUSTOM_TAG]=this.player.getPlayerType(),n[e.STREAM_TYPE_CONTENT_METADATA_CUSTOM_TAG]=this.player.getStreamType(),n[e.VR_CONTENT_TYPE_CONTENT_METADATA_CUSTOM_TAG]=r.vr&&r.vr.contentType,n)),this.contentMetadataBuilder.streamUrl=this.getUrlFromSource(r))}else this.debugLog("[ ConvivaAnalyticsTracker ] Player is not attached, skipping default content metadata initialization, it will be initialized on source loaded event")},t.prototype.updateSession=function(){this.isSessionActive()&&this.convivaVideoAnalytics.setContentInfo(this.contentMetadataBuilder.build())},t.prototype.getAssetNameFromSource=function(t){var e=t.title;return e||"Untitled (no source.title set)"},t.prototype.isSessionActive=function(){return!!this.convivaVideoAnalytics},t.prototype.trackPlaybackStateChanged=function(t){if(this.isSessionActive()){var e=p.PlayerStateHelper.getPlayerStateFromEvent(t,this.player),a=[n.PlayerEvent.Play,n.PlayerEvent.Seek,n.PlayerEvent.TimeShift],r=[n.PlayerEvent.StallStarted,n.PlayerEvent.Playing,n.PlayerEvent.Paused,n.PlayerEvent.Seeked,n.PlayerEvent.TimeShifted,n.PlayerEvent.StallEnded,n.PlayerEvent.PlaybackFinished];-1!==a.indexOf(t.type)?this.stallTrackingTimeout.start():-1!==r.indexOf(t.type)&&this.stallTrackingTimeout.clear(),e&&(this._isAdBreakActive?(this.debugLog("[ ConvivaAnalyticsTracker ] report ad playback state",e),this.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.PLAYER_STATE,e)):(this.debugLog("[ ConvivaAnalyticsTracker ] report playback state",e),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.PLAYER_STATE,e))),t.type===n.PlayerEvent.PlaybackFinished&&(this.debugLog("[ ConvivaAnalyticsTracker ] report playback ended"),this.convivaVideoAnalytics.reportPlaybackEnded())}},t.prototype.trackSeekStart=function(t){this.isSessionActive()&&(this.debugLog("[ ConvivaAnalyticsTracker ] report seek started"),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.SEEK_STARTED,t))},t.prototype.trackSeekEnd=function(){this.isSessionActive()&&(this.debugLog("[ ConvivaAnalyticsTracker ] report seek ended"),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.SEEK_ENDED))},t.prototype.trackUpdateAudioTrack=function(t){if(this.isSessionActive()){var e="unknown"!==t.lang?"["+t.lang+"]:"+t.label:t.label;this.debugLog("[ ConvivaAnalyticsTracker ] report audio language",{formattedAudio:e}),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.AUDIO_LANGUAGE,e)}},t.prototype.trackUpdateSubtitleTrack=function(t){if(this.isSessionActive()){var e="unknown"!==t.lang?"["+t.lang+"]:"+t.label:t.label;"subtitles"===t.kind?(this.debugLog("[ ConvivaAnalyticsTracker ] report subtitles language",{formattedSubtitle:e}),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.SUBTITLES_LANGUAGE,e),this.debugLog("[ ConvivaAnalyticsTracker ] report off closed captions language"),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.CLOSED_CAPTIONS_LANGUAGE,"off")):"captions"===t.kind?(this.debugLog("[ ConvivaAnalyticsTracker ] report closed captions language",{formattedSubtitle:e}),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.CLOSED_CAPTIONS_LANGUAGE,e),this.debugLog("[ ConvivaAnalyticsTracker ] report off subtitles language"),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.SUBTITLES_LANGUAGE,"off")):this.trackTurnOffSubtitles()}},t.prototype.trackInitialSubtitles=function(){if(this.isSessionActive()){if(void 0!==this.player.subtitles){var t=this.player.subtitles.list().filter(function(t){return t.enabled});if(1===t.length)return void this.trackUpdateSubtitleTrack(t[0])}this.trackTurnOffSubtitles()}},t.prototype.trackTurnOffSubtitles=function(){this.isSessionActive()&&(this.debugLog("[ ConvivaAnalyticsTracker ] report off subtitles language"),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.SUBTITLES_LANGUAGE,"off"),this.debugLog("[ ConvivaAnalyticsTracker ] report off closed captions language"),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.CLOSED_CAPTIONS_LANGUAGE,"off"))},t.prototype.registerPlayerEvents=function(){this.handlers.add(n.PlayerEvent.SourceLoaded,this.onSourceLoaded),this.handlers.add(n.PlayerEvent.Play,this.onPlay),this.handlers.add(n.PlayerEvent.Playing,this.onPlaying),this.handlers.add(n.PlayerEvent.PlaybackFinished,this.onPlaybackFinished),this.handlers.add(n.PlayerEvent.SourceUnloaded,this.onSourceUnloaded)},t.prototype.unregisterPlayerEvents=function(){var t;null===(t=this.handlers)||void 0===t||t.clear()},Object.defineProperty(t,"version",{get:function(){return t.VERSION},enumerable:!1,configurable:!0}),t.VERSION="5.4.0",t.STALL_TRACKING_DELAY_MS=100,t}();e.ConvivaAnalyticsTracker=h},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Html5Logging=void 0;var i=a(0),n=function(){function t(){}return t.prototype.consoleLog=function(t,e){"undefined"!=typeof console&&(console.log&&e===i.SystemSettings.LogLevel.DEBUG||e===i.SystemSettings.LogLevel.INFO?console.log(t):console.warn&&e===i.SystemSettings.LogLevel.WARNING?console.warn(t):console.error&&e===i.SystemSettings.LogLevel.ERROR&&console.error(t))},t.prototype.release=function(){},t}();e.Html5Logging=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PlayerEventWrapper=void 0;var i=a(16),n=function(){function t(t){this.player=t,this.eventHandlers={}}return t.prototype.add=function(t,e){this.player.on(t,e),this.eventHandlers[t]||(this.eventHandlers[t]=[]),this.eventHandlers[t].push(e)},t.prototype.remove=function(t,e){this.player.off(t,e),this.eventHandlers[t]&&i.ArrayUtils.remove(this.eventHandlers[t],e)},t.prototype.clear=function(){for(var t in this.eventHandlers)for(var e=0,a=this.eventHandlers[t];e<a.length;e++){var i=a[e];this.remove(t,i)}},t}();e.PlayerEventWrapper=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConvivaAnalytics=void 0,a(7);var i=a(8);Object.defineProperty(e,"ConvivaAnalytics",{enumerable:!0,get:function(){return i.ConvivaAnalytics}})},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConvivaAnalytics=void 0;var i=a(0),n=a(1),r=a(9),o=a(3),s=a(20),c=a(5),l=a(2),d=a(4),v=function(){function t(t,e,a){void 0===a&&(a={});var n=this;this.logger=new d.Html5Logging,this.onPlaybackStateChanged=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] playback state change related event",t),n.convivaAnalyticsTracker.trackPlaybackStateChanged(t)},this.onPlay=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] play",t),n.convivaAnalyticsTracker.canTrackPlayEvent&&n.onPlaybackStateChanged(t)},this.onPlaying=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] playing",t),n.onPlaybackStateChanged(t)},this.onPlaybackFinished=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] playback finished",t),n.onPlaybackStateChanged(t)},this.onVideoQualityChanged=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] video quality changed",t),n.convivaAnalyticsTracker.trackVideoQualityChanged(t)},this.onCustomEvent=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] custom playback related event",t);var e=r.ObjectUtils.flatten(t);n.sendCustomPlaybackEvent(t.type,e)},this.onAdBreakStarted=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] adbreak started",t),n.lastAdBreakEvent=t,n.convivaAnalyticsTracker.trackAdBreakStarted(i.Constants.AdType.CLIENT_SIDE)},this.onAdStarted=function(t){var e;n.debugLog("[ ConvivaAnalytics ] [ Player Event ] ad started",t);var a=l.AdHelper.extractCsaiConvivaAdInfo(n.player,n.lastAdBreakEvent,t),r=null===(e=t.ad.data)||void 0===e?void 0:e.bitrate;n.convivaAnalyticsTracker.trackAdStarted(a,i.Constants.AdType.CLIENT_SIDE,r)},this.onAdFinished=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] ad finished",t),n.convivaAnalyticsTracker.trackAdFinished()},this.onAdSkipped=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] ad skipped",t),n.convivaAnalyticsTracker.trackAdSkipped(),n.onCustomEvent(t)},this.onAdBreakFinished=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] adbreak finished",t),n.convivaAnalyticsTracker.trackAdBreakFinished()},this.onAdError=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] ad error",t),n.convivaAnalyticsTracker.trackAdError(t),n.onCustomEvent(t)},this.onSeek=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] seek",t),n.convivaAnalyticsTracker.trackSeekStart(t.seekTarget),n.onPlaybackStateChanged(t)},this.onSeeked=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] seeked",t),n.convivaAnalyticsTracker.trackSeekEnd(),n.onPlaybackStateChanged(t)},this.onTimeShift=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] time shift",t),n.convivaAnalyticsTracker.trackSeekStart(-1),n.onPlaybackStateChanged(t)},this.onTimeShifted=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] time shifted",t),n.convivaAnalyticsTracker.trackSeekEnd(),n.onPlaybackStateChanged(t)},this.onAudioChanged=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] audio changed",t),n.convivaAnalyticsTracker.trackUpdateAudioTrack(t.targetAudio)},this.onSubtitleEnabled=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] subtitled enabled",t),n.convivaAnalyticsTracker.trackUpdateSubtitleTrack(t.subtitle)},this.onSubtitleDisabled=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] subtitles disabled",t),n.convivaAnalyticsTracker.trackTurnOffSubtitles()},this.onError=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] error",t),n.convivaAnalyticsTracker.trackError(t)},this.onDestroy=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] destroy",t),n.releaseInternal(t)},this.convivaAnalyticsTracker=new o.ConvivaAnalyticsTracker(e,a),this.debugLoggingEnabled=a.debugLoggingEnabled||!1,this._player=t,t&&this.attachPlayer(t),this.convivaSsaiAnalytics=new s.ConvivaAnalyticsSsai(this.convivaAnalyticsTracker),this.ssai={get isAdBreakActive(){return this.convivaSsaiAnalytics.isAdBreakActive},reportAdBreakStarted:this.convivaSsaiAnalytics.reportAdBreakStarted.bind(this.convivaSsaiAnalytics),reportAdStarted:this.convivaSsaiAnalytics.reportAdStarted.bind(this.convivaSsaiAnalytics),reportAdFinished:this.convivaSsaiAnalytics.reportAdFinished.bind(this.convivaSsaiAnalytics),reportAdSkipped:this.convivaSsaiAnalytics.reportAdSkipped.bind(this.convivaSsaiAnalytics),reportAdBreakFinished:this.convivaSsaiAnalytics.reportAdBreakFinished.bind(this.convivaSsaiAnalytics)}}return Object.defineProperty(t.prototype,"player",{get:function(){if(!this._player)throw new Error("Player is not initialized, either pass it to the constructor or attach it via `attachPlayer` before using the integration.");return this._player},enumerable:!1,configurable:!0}),t.prototype.attachPlayer=function(t){var e=this.convivaAnalyticsTracker.canAttachPlayer(t),a=e.canAttach,n=e.reason;a?(this.convivaAnalyticsTracker.attachPlayer(t),this._player=t,this.handlers=new c.PlayerEventWrapper(t),this.registerPlayerEvents()):this.logger.consoleLog("[ ConvivaAnalyticsTracker ] cannot attach player: ".concat(n),i.SystemSettings.LogLevel.WARNING)},t.prototype.initializeSession=function(){this.convivaAnalyticsTracker.initializeSession()},t.prototype.endSession=function(){this.debugLog("[ ConvivaAnalytics ] external ending session"),this.convivaSsaiAnalytics.reset(),this.convivaAnalyticsTracker.endSession()},t.prototype.sendCustomApplicationEvent=function(t,e){void 0===e&&(e={}),this.convivaAnalyticsTracker.sendCustomApplicationEvent(t,e)},t.prototype.sendCustomPlaybackEvent=function(t,e){void 0===e&&(e={}),this.convivaAnalyticsTracker.sendCustomPlaybackEvent(t,e)},t.prototype.updateContentMetadata=function(t){this.convivaAnalyticsTracker.updateContentMetadata(t)},t.prototype.reportPlaybackDeficiency=function(t,e,a){void 0===a&&(a=!0),this.convivaAnalyticsTracker.reportPlaybackDeficiency(t,e,a)},t.prototype.pauseTracking=function(){this.convivaAnalyticsTracker.pauseTracking()},t.prototype.resumeTracking=function(){this.convivaAnalyticsTracker.resumeTracking()},t.prototype.release=function(){this.releaseInternal()},t.prototype.releaseInternal=function(t){var e=(null==t?void 0:t.type)===n.PlayerEvent.Destroy;e||this.unregisterPlayerEvents(),this._player=null,this.handlers=null,this.debugLog("[ ConvivaAnalytics ] releasing",{event:t,isPlayerDestroyed:e}),this.convivaAnalyticsTracker.release(e),this.convivaSsaiAnalytics.reset(),this.lastAdBreakEvent=null},t.prototype.debugLog=function(t){for(var e=[],a=1;a<arguments.length;a++)e[a-1]=arguments[a];this.debugLoggingEnabled&&console.log.apply(console,arguments)},t.prototype.registerPlayerEvents=function(){this.handlers.add(n.PlayerEvent.Play,this.onPlay),this.handlers.add(n.PlayerEvent.Playing,this.onPlaying),this.handlers.add(n.PlayerEvent.Paused,this.onPlaybackStateChanged),this.handlers.add(n.PlayerEvent.StallStarted,this.onPlaybackStateChanged),this.handlers.add(n.PlayerEvent.StallEnded,this.onPlaybackStateChanged),this.handlers.add(n.PlayerEvent.PlaybackFinished,this.onPlaybackFinished),this.handlers.add(n.PlayerEvent.VideoPlaybackQualityChanged,this.onVideoQualityChanged),this.handlers.add(n.PlayerEvent.AudioPlaybackQualityChanged,this.onCustomEvent),this.handlers.add(n.PlayerEvent.Muted,this.onCustomEvent),this.handlers.add(n.PlayerEvent.Unmuted,this.onCustomEvent),this.handlers.add(n.PlayerEvent.ViewModeChanged,this.onCustomEvent),this.handlers.add(n.PlayerEvent.AdStarted,this.onAdStarted),this.handlers.add(n.PlayerEvent.AdFinished,this.onAdFinished),this.handlers.add(n.PlayerEvent.AdBreakStarted,this.onAdBreakStarted),this.handlers.add(n.PlayerEvent.AdBreakFinished,this.onAdBreakFinished),this.handlers.add(n.PlayerEvent.AdSkipped,this.onAdSkipped),this.handlers.add(n.PlayerEvent.AdError,this.onAdError),this.handlers.add(n.PlayerEvent.Error,this.onError),this.handlers.add(n.PlayerEvent.Destroy,this.onDestroy),this.handlers.add(n.PlayerEvent.Seek,this.onSeek),this.handlers.add(n.PlayerEvent.Seeked,this.onSeeked),this.handlers.add(n.PlayerEvent.TimeShift,this.onTimeShift),this.handlers.add(n.PlayerEvent.TimeShifted,this.onTimeShifted),this.handlers.add(n.PlayerEvent.AudioChanged,this.onAudioChanged),this.handlers.add(n.PlayerEvent.SubtitleEnabled,this.onSubtitleEnabled),this.handlers.add(n.PlayerEvent.SubtitleDisabled,this.onSubtitleDisabled),this.handlers.add(n.PlayerEvent.CastStarted,this.onCustomEvent),this.handlers.add(n.PlayerEvent.CastStopped,this.onCustomEvent)},t.prototype.unregisterPlayerEvents=function(){var t;null===(t=this.handlers)||void 0===t||t.clear()},t}();e.ConvivaAnalytics=v},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectUtils=void 0,function(t){t.flatten=function(t,e){void 0===e&&(e="");var a={},i=function(t,e){for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];"object"==typeof r?i(r,e+n+"."):a[e+n]=String(r)}};return i(t,e),a}}(e.ObjectUtils||(e.ObjectUtils={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Html5Http=void 0;var i=function(){function t(){}return t.prototype.makeRequest=function(t,e,a,i,n,r){return this.makeRequestStandard.apply(this,arguments)},t.prototype.release=function(){},t.prototype.makeRequestStandard=function(t,e,a,i,n,r){var o=new XMLHttpRequest;return o.open(t,e,!0),i&&o.overrideMimeType&&o.overrideMimeType(i),i&&o.setRequestHeader&&o.setRequestHeader("Content-Type",i),n>0&&(o.timeout=n,o.ontimeout=function(){o.ontimeout=o.onreadystatechange=null,r&&r(!1,"timeout after "+n+" ms")}),o.onreadystatechange=function(){4===o.readyState&&(o.ontimeout=o.onreadystatechange=null,200===o.status?r&&r(!0,o.responseText):r&&r(!1,"http status "+o.status))},o.send(a),null},t}();e.Html5Http=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Html5Storage=void 0;var i=function(){function t(){}return t.prototype.saveData=function(t,e,a,i){var n=t+"."+e;try{localStorage.setItem(n,a),i(!0,null)}catch(t){i(!1,t.toString())}},t.prototype.loadData=function(t,e,a){var i=t+"."+e;try{a(!0,localStorage.getItem(i))}catch(t){a(!1,t.toString())}},t.prototype.release=function(){},t}();e.Html5Storage=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Html5Time=void 0;var i=function(){function t(){}return t.prototype.getEpochTimeMs=function(){return(new Date).getTime()},t.prototype.release=function(){},t}();e.Html5Time=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Html5Timer=void 0;var i=function(){function t(){}return t.prototype.createTimer=function(t,e,a){var i=window.setInterval(t,e);return function(){-1!==i&&(clearInterval(i),i=-1)}},t.prototype.release=function(){},t}();e.Html5Timer=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e,a){void 0===a&&(a=!1),this.delay=t,this.callback=e,this.repeat=a,this.timeoutOrIntervalId=0}return t.prototype.start=function(){return this.reset(),this},t.prototype.clear=function(){this.clearInternal()},t.prototype.reset=function(){this.clearInternal(),this.repeat?this.timeoutOrIntervalId=setInterval(this.callback,this.delay):this.timeoutOrIntervalId=setTimeout(this.callback,this.delay)},t.prototype.clearInternal=function(){this.repeat?clearInterval(this.timeoutOrIntervalId):clearTimeout(this.timeoutOrIntervalId)},t}();e.Timeout=i},function(t,e,a){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,a=1,i=arguments.length;a<i;a++)for(var n in e=arguments[a])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.ContentMetadataBuilder=void 0;var n=a(0),r=function(){function t(t){this.metadataOverrides={},this.metadata={},this.latestBuiltMetadata={},this.playbackStarted=!1,this.logger=t}return t.prototype.setOverrides=function(t){this.playbackStarted&&this.logger.consoleLog("[ Conviva Analytics ] Playback has started. Only some metadata attributes will be updated",n.SystemSettings.LogLevel.WARNING),this.metadataOverrides=i(i({},this.metadataOverrides),t)},t.prototype.getOverrides=function(){return this.metadataOverrides},t.prototype.setPlaybackStarted=function(t){this.playbackStarted=t},t.prototype.getStaticMetadata=function(){var t={};return this.playbackStarted?(t.assetName=this.latestBuiltMetadata.assetName,t.viewerId=this.latestBuiltMetadata.viewerId,t.streamType=this.latestBuiltMetadata.streamType,t.applicationName=this.latestBuiltMetadata.applicationName,t.duration=this.latestBuiltMetadata.duration,t.custom=this.latestBuiltMetadata.custom):(t.assetName=this.latestBuiltMetadata.assetName||this.assetName,t.viewerId=this.viewerId,t.streamType=this.metadataOverrides.streamType||this.metadata.streamType,t.applicationName=this.metadataOverrides.applicationName||this.metadata.applicationName,t.duration=this.metadataOverrides.duration||this.metadata.duration,t.custom=i(i(i({},this.metadataOverrides.custom),this.metadataOverrides.additionalStandardTags),this.metadata.custom)),t},t.prototype.getDynamicMetadata=function(){return{encodedFrameRate:this.metadataOverrides.encodedFrameRate||this.metadata.encodedFrameRate,defaultResource:this.metadataOverrides.defaultResource||this.metadata.defaultResource,streamUrl:this.metadataOverrides.streamUrl||this.metadata.streamUrl}},t.prototype.build=function(){var t,e=i(i({},this.getStaticMetadata()),this.getDynamicMetadata());this.latestBuiltMetadata=e;var a=((t={})[n.Constants.ASSET_NAME]=e.assetName,t[n.Constants.ENCODED_FRAMERATE]=e.encodedFrameRate,t[n.Constants.DURATION]=e.duration,t[n.Constants.DEFAULT_RESOURCE]=e.defaultResource,t[n.Constants.STREAM_URL]=e.streamUrl,t[n.Constants.IS_LIVE]=e.streamType,t[n.Constants.VIEWER_ID]=e.viewerId||"GET_VIEWER_ID_FROM_PLAYER",t[n.Constants.PLAYER_NAME]=e.applicationName||"GET_PLAYER_NAME_OR_TYPE",t);return i(i({},a),e.custom)},Object.defineProperty(t.prototype,"assetName",{get:function(){return this.metadataOverrides.assetName||this.metadata.assetName},set:function(t){this.metadata.assetName=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewerId",{get:function(){return this.metadataOverrides.viewerId||this.metadata.viewerId},set:function(t){this.metadata.viewerId=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"streamType",{set:function(t){this.metadata.streamType=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"applicationName",{set:function(t){this.metadata.applicationName=t},enumerable:!1,configurable:!0}),t.prototype.addToCustom=function(t){this.metadata.custom=i(i({},this.metadata.custom),t)},Object.defineProperty(t.prototype,"duration",{set:function(t){this.metadata.duration=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"encodedFrameRate",{set:function(t){this.metadata.encodedFrameRate=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultResource",{set:function(t){this.metadata.defaultResource=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"streamUrl",{set:function(t){this.metadata.streamUrl=t},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.metadataOverrides={},this.metadata={},this.playbackStarted=!1,this.latestBuiltMetadata={}},t}();e.ContentMetadataBuilder=r},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.remove=function(t,e){var a=t.indexOf(e);return a>-1?t.splice(a,1)[0]:null}}(e.ArrayUtils||(e.ArrayUtils={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PlayerConfigHelper=void 0;var i=a(18),n=function(){function t(){}return t.getAutoplayConfig=function(e){var a=e.getConfig();return a.playback&&void 0!==a.playback.autoplay?a.playback.autoplay:t.AUTOPLAY_DEFAULT_CONFIG},t.getPreloadConfig=function(t){var e=t.getConfig();if(i.BrowserUtils.isMobile()){if(e.adaptation&&e.adaptation.mobile&&void 0!==e.adaptation.mobile.preload)return e.adaptation.mobile.preload}else if(e.adaptation&&e.adaptation.desktop&&void 0!==e.adaptation.desktop.preload)return e.adaptation.desktop.preload;return e.adaptation&&void 0!==e.adaptation.preload?e.adaptation.preload:!t.isLive()},t.AUTOPLAY_DEFAULT_CONFIG=!1,t}();e.PlayerConfigHelper=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BrowserUtils=void 0;var i=function(){function t(){}return t.isMobile=function(){var t=/Android/i.test(navigator.userAgent),e=/IEMobile/i.test(navigator.userAgent),a=/Windows Phone 10.0/i.test(navigator.userAgent),i=/Safari/i.test(navigator.userAgent)&&/Mobile/i.test(navigator.userAgent);return t||e||a||i},t}();e.BrowserUtils=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PlayerStateHelper=void 0;var i=a(1),n=a(0),r=function(){function t(){}return t.getPlayerStateFromEvent=function(t,e){var a;switch(t.type){case i.PlayerEvent.StallStarted:a=n.Constants.PlayerState.BUFFERING;break;case i.PlayerEvent.Playing:a=n.Constants.PlayerState.PLAYING;break;case i.PlayerEvent.Paused:a=n.Constants.PlayerState.PAUSED;break;case i.PlayerEvent.Seeked:case i.PlayerEvent.TimeShifted:case i.PlayerEvent.StallEnded:a=e.isPlaying()?n.Constants.PlayerState.PLAYING:n.Constants.PlayerState.PAUSED}return a},t.getPlayerState=function(t){return t.isStalled()?n.Constants.PlayerState.BUFFERING:t.isPlaying()?n.Constants.PlayerState.PLAYING:n.Constants.PlayerState.PAUSED},t}();e.PlayerStateHelper=r},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConvivaAnalyticsSsai=void 0;var i=a(0),n=a(2),r=function(){function t(t){this._isAdBreakActive=!1,this.convivaAnalyticsTracker=t}return Object.defineProperty(t.prototype,"isAdBreakActive",{get:function(){return this._isAdBreakActive},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this._isAdBreakActive=!1},t.prototype.reportAdBreakStarted=function(){this.convivaAnalyticsTracker.isAdBreakActive||this._isAdBreakActive||(this._isAdBreakActive=!0,this.convivaAnalyticsTracker.trackAdBreakStarted(i.Constants.AdType.SERVER_SIDE))},t.prototype.reportAdStarted=function(t){this._isAdBreakActive&&this.convivaAnalyticsTracker.trackAdStarted(n.AdHelper.convertSsaiAdInfoToConvivaAdInfo(t,this.convivaAnalyticsTracker.getContentMetadata()),i.Constants.AdType.SERVER_SIDE)},t.prototype.reportAdFinished=function(){this.isAdBreakActive&&this.convivaAnalyticsTracker.trackAdFinished()},t.prototype.reportAdSkipped=function(){this._isAdBreakActive&&this.convivaAnalyticsTracker.trackAdSkipped()},t.prototype.reportAdBreakFinished=function(){this._isAdBreakActive&&(this._isAdBreakActive=!1,this.convivaAnalyticsTracker.trackAdBreakFinished())},t}();e.ConvivaAnalyticsSsai=r}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@convivainc/conviva-js-coresdk"),require("bitmovin-player")):"function"==typeof define&&define.amd?define("bitmovin-player-analytics-conviva",["@convivainc/conviva-js-coresdk","bitmovin-player"],e):"object"==typeof exports?exports["bitmovin-player-analytics-conviva"]=e(require("@convivainc/conviva-js-coresdk"),require("bitmovin-player")):(t.bitmovin=t.bitmovin||{},t.bitmovin.player=t.bitmovin.player||{},t.bitmovin.player.analytics=e(t.Conviva,t.bitmovin.player))}(window,function(t,e){return function(t){var e={};function a(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,a),n.l=!0,n.exports}return a.m=t,a.c=e,a.d=function(t,e,i){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(i,n,function(e){return t[e]}.bind(null,n));return i},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=6)}([function(e,a){e.exports=t},function(t,a){t.exports=e},function(t,e,a){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,a=1,i=arguments.length;a<i;a++)for(var n in e=arguments[a])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.AdHelper=void 0;var n=a(0),r=a(3),o=function(){function t(){}return t.mapCsaiAdPosition=function(t,e){return t.scheduleTime<=0?n.Constants.AdPosition.PREROLL:t.scheduleTime>=e.getDuration()?n.Constants.AdPosition.POSTROLL:n.Constants.AdPosition.MIDROLL},t.formatCsaiAdError=function(t){var e,a,i=(null==t?void 0:t.message)||"Unknown message",n=(null==t?void 0:t.name)||"Unknown name";return["Ad error:","".concat(n,";"),(null===(e=t.data)||void 0===e?void 0:e.code)?"Ad error code: ".concat(null===(a=t.data)||void 0===a?void 0:a.code,";"):void 0,"Message:","".concat(i,";"),"Error code: ".concat(t.code,";"),t.troubleShootLink?"Troubleshoot link: ".concat(t.troubleShootLink):void 0].filter(Boolean).join(" ")},t.extractCsaiConvivaAdInfo=function(e,a,i){var r,o,s,c=i.ad,l=c.data,d="NA",v="NA",y="NA",u=c.id;l&&("adSystem"in l&&(null===(o=l.adSystem)||void 0===o?void 0:o.name)&&(d=l.adSystem.name),"creative"in l&&(null===(s=null==l?void 0:l.creative)||void 0===s?void 0:s.id)&&(v=l.creative.id),"adTitle"in l&&l.adTitle&&(y=l.adTitle),"wrapperAdIds"in l&&l.wrapperAdIds&&l.wrapperAdIds.length&&(u=l.wrapperAdIds[l.wrapperAdIds.length-1]));var A=((r={"c3.ad.id":c.id,"c3.ad.technology":n.Constants.AdType.CLIENT_SIDE,"c3.ad.position":t.mapCsaiAdPosition(a.adBreak,e),"c3.ad.system":d,"c3.ad.creativeId":v,"c3.ad.firstAdId":u})[n.Constants.ASSET_NAME]=y,r[n.Constants.STREAM_URL]=c.mediaFileUrl||"NA",r["c3.ad.mediaFileApiFramework"]="NA",r["c3.ad.firstAdSystem"]="NA",r["c3.ad.firstCreativeId"]="NA",r);return"duration"in c&&c.duration&&(A[n.Constants.DURATION]=c.duration),A},t.convertSsaiAdInfoToConvivaAdInfo=function(t,e){var a,o=[r.INTEGRATION_VERSION_CONTENT_METADATA_CUSTOM_TAG,r.STREAM_TYPE_CONTENT_METADATA_CUSTOM_TAG,n.Constants.ASSET_NAME,n.Constants.IS_LIVE,n.Constants.DEFAULT_RESOURCE,n.Constants.ENCODED_FRAMERATE,n.Constants.VIEWER_ID,n.Constants.PLAYER_NAME],s={};o.forEach(function(t){s[t]=e[t]});var c=i(i(i({},s),t.additionalMetadata),((a={"c3.ad.id":t.id,"c3.ad.technology":n.Constants.AdType.SERVER_SIDE,"c3.ad.position":t.position||"NA","c3.ad.system":t.adSystem||"NA"})[n.Constants.ASSET_NAME]=t.title||s[n.Constants.ASSET_NAME]||"NA",a["c3.ad.adStitcher"]=t.adStitcher||"NA",a["c3.ad.isSlate"]=void 0===t.isSlate?"NA":t.isSlate.toString(),a));return t.duration&&(c[n.Constants.DURATION]=t.duration),c},t}();e.AdHelper=o},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConvivaAnalyticsTracker=e.VR_CONTENT_TYPE_CONTENT_METADATA_CUSTOM_TAG=e.STREAM_TYPE_CONTENT_METADATA_CUSTOM_TAG=e.PLAYER_TYPE_CONTENT_METADATA_CUSTOM_TAG=e.INTEGRATION_VERSION_CONTENT_METADATA_CUSTOM_TAG=e.PRELOAD_CONTENT_METADATA_CUSTOM_TAG=e.AUTOPLAY_CONTENT_METADATA_CUSTOM_TAG=void 0;var i=a(0),n=a(1),r=a(10),o=a(4),s=a(11),c=a(12),l=a(13),d=a(14),v=a(15),y=a(2),u=a(5),A=a(17),p=a(19);e.AUTOPLAY_CONTENT_METADATA_CUSTOM_TAG="autoplay",e.PRELOAD_CONTENT_METADATA_CUSTOM_TAG="preload",e.INTEGRATION_VERSION_CONTENT_METADATA_CUSTOM_TAG="integrationVersion",e.PLAYER_TYPE_CONTENT_METADATA_CUSTOM_TAG="playerType",e.STREAM_TYPE_CONTENT_METADATA_CUSTOM_TAG="streamType",e.VR_CONTENT_TYPE_CONTENT_METADATA_CUSTOM_TAG="vrContentType";var h=function(){function t(e,a){var n;void 0===a&&(a={});var u=this;if(this.logger=new o.Html5Logging,this.sessionKey=i.Constants.NO_SESSION_KEY,this._isAdBreakActive=!1,this.hasPlayed=!1,this.stallTrackingTimeout=new d.Timeout(t.STALL_TRACKING_DELAY_MS,function(){u._isAdBreakActive?(u.debugLog("[ ConvivaAnalyticsTracker ] report buffering ad playback state"),u.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.PLAYER_STATE,i.Constants.PlayerState.BUFFERING)):(u.debugLog("[ ConvivaAnalyticsTracker ] report buffering playback state"),u.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.PLAYER_STATE,i.Constants.PlayerState.BUFFERING))}),this.sessionEndedExternally=!1,this.internalEndSession=function(){u.isSessionActive()&&(u.debugLog("[ ConvivaAnalyticsTracker ] end session",u.sessionKey),u.contentMetadataBuilder.reset(),u.convivaVideoAnalytics.release(),u.convivaVideoAnalytics=null,u.convivaAdAnalytics.release(),u.convivaAdAnalytics=null,u.hasPlayed=!1,u._isAdBreakActive=!1)},this.onSourceLoaded=function(t){u.debugLog("[ ConvivaAnalyticsTracker ] [ Player Event ] source loaded",t),u.isSessionActive()&&(u.buildContentMetadata(),u.updateSession())},this.onPlay=function(t){u.debugLog("[ ConvivaAnalyticsTracker ] [ Player Event ] play"),u.canTrackPlayEvent&&(u.isSessionActive()||u.sessionEndedExternally||u.internalInitializeSession(),u.hasPlayed||(u.hasPlayed=!0,u.trackUpdateAudioTrack(u.player.getAudio()),u.trackInitialSubtitles()))},this.onPlaying=function(t){u.debugLog("[ ConvivaAnalyticsTracker ] [ Player Event ] playing",t),u.isSessionActive()&&(u.contentMetadataBuilder.setPlaybackStarted(!0),u.updateSession())},this.onPlaybackFinished=function(t){u.debugLog("[ ConvivaAnalyticsTracker ] [ Player Event ] playback finished",t),u.isSessionActive()&&(u.convivaVideoAnalytics.release(),u.convivaVideoAnalytics=null,u.convivaAdAnalytics.release(),u.convivaAdAnalytics=null)},this.trackVideoQualityChanged=function(t){if(u.isSessionActive()){var e=Math.round(t.targetQuality.bitrate/1e3);u.debugLog("[ ConvivaAnalyticsTracker ] report bitrate",{event:t,bitrateKbps:e}),u.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.BITRATE,e)}},this.trackAdBreakStarted=function(t){u.isSessionActive()&&(u._isAdBreakActive=!0,u.debugLog("[ ConvivaAnalyticsTracker ] report ad break started",{type:t}),u.convivaVideoAnalytics.reportAdBreakStarted(t,t===i.Constants.AdType.CLIENT_SIDE?i.Constants.AdPlayer.SEPARATE:i.Constants.AdPlayer.CONTENT))},this.trackAdStarted=function(t,e,a){if(u.adBreakFinishedTimeout.clear(),u.isSessionActive()){if(u.isAdBreakActive||u.trackAdBreakStarted(e),u.debugLog("[ ConvivaAnalyticsTracker ] report ad started",{adInfo:t,type:e,bitrateKbps:a}),u.convivaAdAnalytics.reportAdStarted(t),u.debugLog("[ ConvivaAnalyticsTracker ] report ".concat(p.PlayerStateHelper.getPlayerState(u.player)," ad playback state")),u.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.PLAYER_STATE,p.PlayerStateHelper.getPlayerState(u.player)),e===i.Constants.AdType.SERVER_SIDE){var n=u.player.getPlaybackVideoData(),r="".concat(n.width,"x").concat(n.height);u.debugLog("[ ConvivaAnalyticsTracker ] report ad resolution",r),u.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.RESOLUTION,r),n.frameRate&&(u.debugLog("[ ConvivaAnalyticsTracker ] report framerate",n.frameRate),u.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.RENDERED_FRAMERATE,n.frameRate))}a&&(u.debugLog("[ ConvivaAnalyticsTracker ] report ad bitrate",a),u.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.BITRATE,a))}},this.trackAdSkipped=function(){u.isSessionActive()&&(u.debugLog("[ ConvivaAnalyticsTracker ] report ad skipped"),u.convivaAdAnalytics.reportAdSkipped())},this.trackAdFinished=function(){u.isSessionActive()&&(u.debugLog("[ ConvivaAnalyticsTracker ] report ad ended"),u.convivaAdAnalytics.reportAdEnded(),u.adBreakFinishedTimeout.start())},this.reportAdBreakEnded=function(){u._isAdBreakActive=!1,u.debugLog("[ ConvivaAnalyticsTracker ] report ad break ended"),u.convivaVideoAnalytics.reportAdBreakEnded()},this.adBreakFinishedTimeout=new d.Timeout(t.AD_BREAK_FINISHED_DELAY_MS,this.reportAdBreakEnded),this.trackAdBreakFinished=function(){u.adBreakFinishedTimeout.clear(),u.isSessionActive()&&(u.isAdBreakActive&&u.reportAdBreakEnded(),u.debugLog("[ ConvivaAnalyticsTracker ] report ".concat(p.PlayerStateHelper.getPlayerState(u.player)," playback state")),u.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.PLAYER_STATE,p.PlayerStateHelper.getPlayerState(u.player)))},this.trackAdError=function(t){if(u.isSessionActive()){var e=y.AdHelper.formatCsaiAdError(t);u.debugLog("[ ConvivaAnalyticsTracker ] report ad error",{event:t,formattedError:e}),u.convivaAdAnalytics.reportAdError(e,i.Constants.ErrorSeverity.WARNING)}},this.trackError=function(t){u.isSessionActive()||u.sessionEndedExternally||u.internalInitializeSession(),u.debugLog("[ ConvivaAnalyticsTracker ] report playback deficiency",t),u.reportPlaybackDeficiency(String(t.code)+" "+t.name,i.Constants.ErrorSeverity.FATAL)},this.onSourceUnloaded=function(t){u.debugLog("[ ConvivaAnalyticsTracker ] [ Player Event ] source unloaded",t),u._isAdBreakActive||u.internalEndSession()},void 0!==i){this.config=a,this.config.debugLoggingEnabled=this.config.debugLoggingEnabled||!1;var A=this.config.deviceMetadata||{},h=((n={})[i.Constants.DeviceMetadata.CATEGORY]=A.category||this.config.deviceCategory||i.Constants.DeviceCategory.WEB,n[i.Constants.DeviceMetadata.BRAND]=A.brand,n[i.Constants.DeviceMetadata.MANUFACTURER]=A.manufacturer,n[i.Constants.DeviceMetadata.MODEL]=A.model,n[i.Constants.DeviceMetadata.TYPE]=A.type,n[i.Constants.DeviceMetadata.VERSION]=A.version,n[i.Constants.DeviceMetadata.OS_NAME]=A.osName,n[i.Constants.DeviceMetadata.OS_VERSION]=A.osVersion,n);i.Analytics.setDeviceMetadata(h);var g={};g[i.Constants.CallbackFunctions.CONSOLE_LOG]=this.logger.consoleLog,g[i.Constants.CallbackFunctions.MAKE_REQUEST]=(new r.Html5Http).makeRequest;var f=new s.Html5Storage;g[i.Constants.CallbackFunctions.SAVE_DATA]=f.saveData,g[i.Constants.CallbackFunctions.LOAD_DATA]=f.loadData,g[i.Constants.CallbackFunctions.CREATE_TIMER]=(new l.Html5Timer).createTimer,g[i.Constants.CallbackFunctions.GET_EPOCH_TIME_IN_MS]=(new c.Html5Time).getEpochTimeMs;var T={};T[i.Constants.GATEWAY_URL]=a.gatewayUrl,T[i.Constants.LOG_LEVEL]=this.config.debugLoggingEnabled?i.Constants.LogLevel.DEBUG:i.Constants.LogLevel.NONE,i.Analytics.init(e,g,T),this.contentMetadataBuilder=new v.ContentMetadataBuilder(this.logger)}else console.error("Conviva script missing, cannot init ConvivaAnalytics. Please load the Conviva script (conviva-core-sdk.min.js) before Bitmovin's ConvivaAnalytics integration.")}return Object.defineProperty(t.prototype,"player",{get:function(){if(!this._player)throw new Error("Player is not initialized, either pass it to the constructor or attach it via `attachPlayer` before using the integration.");return this._player},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPlayerAttached",{get:function(){return!!this._player},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAdBreakActive",{get:function(){return this._isAdBreakActive},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canTrackPlayEvent",{get:function(){return!this._isAdBreakActive},enumerable:!1,configurable:!0}),t.prototype.canAttachPlayer=function(t){var e=void 0;return this.isPlayerAttached&&(e="Player is already attached"),t.getSource()&&(e="Player.load() has already been called (attaching player is possible only before player.load())"),{canAttach:!e,reason:e}},t.prototype.attachPlayer=function(t){this.canAttachPlayer(t).canAttach&&(this._player=t,this.handlers=new u.PlayerEventWrapper(t),this.setPlayerInfo(),this.registerPlayerEvents())},t.prototype.setPlayerInfo=function(){var t;if(this.convivaVideoAnalytics&&this.convivaAdAnalytics&&this.isPlayerAttached){var e=((t={})[i.Constants.FRAMEWORK_NAME]="Bitmovin Player",t[i.Constants.FRAMEWORK_VERSION]=this.player.version,t);this.convivaVideoAnalytics.setPlayerInfo(e),this.convivaAdAnalytics.setAdPlayerInfo(e)}},t.prototype.getContentMetadata=function(){return this.contentMetadataBuilder.build()},t.prototype.initializeSession=function(){if(this.isSessionActive())this.logger.consoleLog("[ ConvivaAnalyticsTracker ] There is already a session running.",i.SystemSettings.LogLevel.WARNING);else{if(!this.isPlayerAttached&&!this.contentMetadataBuilder.assetName)throw"Player is not attached during session initialization and `assetName` is empty in the content metadata. Either attach the player before calling `initializeSession` or set the `assetName` manually using `updateContentMetadata`.";if(this.isPlayerAttached&&!this.player.getSource()&&!this.contentMetadataBuilder.assetName)throw"Player is attached but no source is loaded and `assetName` is empty in the content metadata. Either load a source before calling `initializeSession` or set the `assetName` manually using `updateContentMetadata`.";this.internalInitializeSession(),this.sessionEndedExternally=!1}},t.prototype.ensurePlaybackFinished=function(){this.isSessionActive()&&(this._isAdBreakActive&&(this.debugLog("[ ConvivaAnalyticsTracker ] report ad skipped"),this.convivaAdAnalytics.reportAdSkipped()),this.debugLog("[ ConvivaAnalyticsTracker ] report playback ended state"),this.convivaVideoAnalytics.reportPlaybackEnded())},t.prototype.endSession=function(){this.isSessionActive()&&(this.debugLog("[ ConvivaAnalytics ] external ending session"),this.ensurePlaybackFinished(),this.internalEndSession(),this.sessionEndedExternally=!0)},t.prototype.sendCustomApplicationEvent=function(t,e){void 0===e&&(e={}),this.isSessionActive()?(this.debugLog("[ ConvivaAnalyticsTracker ] report custom app event",{eventName:t,eventAttributes:e}),this.convivaVideoAnalytics.reportAppEvent(t,e)):this.logger.consoleLog("[ ConvivaAnalyticsTracker ] cannot send application event, no active monitoring session",i.SystemSettings.LogLevel.WARNING)},t.prototype.sendCustomPlaybackEvent=function(t,e){void 0===e&&(e={}),this.isSessionActive()?(this.debugLog("[ ConvivaAnalyticsTracker ] report custom playback event",{eventName:t,eventAttributes:e}),this.convivaVideoAnalytics.reportPlaybackEvent(t,e)):this.logger.consoleLog("[ ConvivaAnalyticsTracker ] cannot send playback event, no active monitoring session",i.SystemSettings.LogLevel.WARNING)},t.prototype.updateContentMetadata=function(t){this.internalUpdateContentMetadata(t)},t.prototype.reportPlaybackDeficiency=function(t,e,a){void 0===a&&(a=!0),this.isSessionActive()&&(this.debugLog("[ ConvivaAnalyticsTracker ] report playback failed",{message:t}),this.convivaVideoAnalytics.reportPlaybackFailed(t),a&&this.internalEndSession())},t.prototype.pauseTracking=function(){this.debugLog("[ ConvivaAnalyticsTracker ] pause tracking via ad break started reporting"),this.convivaVideoAnalytics.reportAdBreakStarted(i.Constants.AdType.CLIENT_SIDE,i.Constants.AdPlayer.SEPARATE)},t.prototype.resumeTracking=function(){this.debugLog("[ ConvivaAnalyticsTracker ] resume tracking via ad break ended reporting"),this.convivaVideoAnalytics.reportAdBreakEnded()},t.prototype.release=function(t){this.debugLog("[ ConvivaAnalyticsTracker ] releasing",{isPlayerDestroyed:t}),t||this.unregisterPlayerEvents(),this._player=null,this.handlers=null,this.ensurePlaybackFinished(),this.internalEndSession(),i.Analytics.release()},t.prototype.debugLog=function(t){for(var e=[],a=1;a<arguments.length;a++)e[a-1]=arguments[a];this.config.debugLoggingEnabled&&console.log.apply(console,arguments)},t.prototype.getUrlFromSource=function(t){switch(this.player.getStreamType()){case"dash":return t.dash;case"hls":return t.hls;case"progressive":return Array.isArray(t.progressive)?t.progressive[0].url:t.progressive}},t.prototype.internalUpdateContentMetadata=function(t){this.contentMetadataBuilder.setOverrides(t),this.isSessionActive()?(this.buildContentMetadata(),this.updateSession()):this.logger.consoleLog("[ ConvivaAnalyticsTracker ] no active session. Content metadata will be propagated to Conviva on session initialization.",i.SystemSettings.LogLevel.DEBUG)},t.prototype.internalInitializeSession=function(){var t=this;this.debugLog("[ ConvivaAnalyticsTracker ] initializing session"),this.buildContentMetadata(),this.convivaVideoAnalytics=i.Analytics.buildVideoAnalytics(),this.convivaAdAnalytics=i.Analytics.buildAdAnalytics(this.convivaVideoAnalytics),this.debugLog("[ ConvivaAnalyticsTracker ] report playback requested"),this.convivaVideoAnalytics.reportPlaybackRequested(this.contentMetadataBuilder.build()),this.sessionKey=this.convivaVideoAnalytics.getSessionId(),this.debugLog("[ ConvivaAnalyticsTracker ] new session key",this.sessionKey),this.setPlayerInfo(),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.PLAYER_STATE,i.Constants.PlayerState.STOPPED),this.convivaVideoAnalytics.setCallback(function(){if(t.isPlayerAttached){var e=t.player.getCurrentTime(n.TimeMode.RelativeTime);if(Number.isFinite(e)){var a=1e3*e;t._isAdBreakActive?(t.debugLog("[ ConvivaAnalyticsTracker ] report ad player head time",a),t.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.PLAY_HEAD_TIME,a)):(t.debugLog("[ ConvivaAnalyticsTracker ] report player head time",a),t.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.PLAY_HEAD_TIME,a))}}}),this.isSessionActive()||this.logger.consoleLog("[ ConvivaAnalyticsTracker ] Something went wrong, could not obtain session key",i.SystemSettings.LogLevel.ERROR)},t.prototype.buildContentMetadata=function(){var a,n;if(this.isPlayerAttached){this.contentMetadataBuilder.duration=this.player.getDuration(),this.contentMetadataBuilder.streamType=this.player.isLive()?i.ContentMetadata.StreamType.LIVE:i.ContentMetadata.StreamType.VOD,this.contentMetadataBuilder.addToCustom(((a={})[e.AUTOPLAY_CONTENT_METADATA_CUSTOM_TAG]=A.PlayerConfigHelper.getAutoplayConfig(this.player)+"",a[e.PRELOAD_CONTENT_METADATA_CUSTOM_TAG]=A.PlayerConfigHelper.getPreloadConfig(this.player)+"",a[e.INTEGRATION_VERSION_CONTENT_METADATA_CUSTOM_TAG]=t.VERSION,a));var r=this.player.getSource();r&&(this.contentMetadataBuilder.assetName=this.getAssetNameFromSource(r),this.contentMetadataBuilder.viewerId=this.contentMetadataBuilder.viewerId,this.contentMetadataBuilder.addToCustom(((n={})[e.PLAYER_TYPE_CONTENT_METADATA_CUSTOM_TAG]=this.player.getPlayerType(),n[e.STREAM_TYPE_CONTENT_METADATA_CUSTOM_TAG]=this.player.getStreamType(),n[e.VR_CONTENT_TYPE_CONTENT_METADATA_CUSTOM_TAG]=r.vr&&r.vr.contentType,n)),this.contentMetadataBuilder.streamUrl=this.getUrlFromSource(r))}else this.debugLog("[ ConvivaAnalyticsTracker ] Player is not attached, skipping default content metadata initialization, it will be initialized on source loaded event")},t.prototype.updateSession=function(){this.isSessionActive()&&this.convivaVideoAnalytics.setContentInfo(this.contentMetadataBuilder.build())},t.prototype.getAssetNameFromSource=function(t){var e=t.title;return e||"Untitled (no source.title set)"},t.prototype.isSessionActive=function(){return!!this.convivaVideoAnalytics},t.prototype.trackPlaybackStateChanged=function(t){if(this.isSessionActive()){var e=p.PlayerStateHelper.getPlayerStateFromEvent(t,this.player),a=[n.PlayerEvent.Play,n.PlayerEvent.Seek,n.PlayerEvent.TimeShift,n.PlayerEvent.AdBreakStarted,n.PlayerEvent.AdFinished],r=[n.PlayerEvent.StallStarted,n.PlayerEvent.Playing,n.PlayerEvent.Paused,n.PlayerEvent.Seeked,n.PlayerEvent.TimeShifted,n.PlayerEvent.StallEnded,n.PlayerEvent.PlaybackFinished,n.PlayerEvent.AdStarted,n.PlayerEvent.AdBreakFinished];-1!==a.indexOf(t.type)?this.stallTrackingTimeout.start():-1!==r.indexOf(t.type)&&this.stallTrackingTimeout.clear(),e&&(this._isAdBreakActive?(this.debugLog("[ ConvivaAnalyticsTracker ] report ad playback state",e),this.convivaAdAnalytics.reportAdMetric(i.Constants.Playback.PLAYER_STATE,e)):(this.debugLog("[ ConvivaAnalyticsTracker ] report playback state",e),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.PLAYER_STATE,e))),t.type===n.PlayerEvent.PlaybackFinished&&(this.debugLog("[ ConvivaAnalyticsTracker ] report playback ended"),this.convivaVideoAnalytics.reportPlaybackEnded())}},t.prototype.trackSeekStart=function(t){this.isSessionActive()&&(this.debugLog("[ ConvivaAnalyticsTracker ] report seek started"),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.SEEK_STARTED,t))},t.prototype.trackSeekEnd=function(){this.isSessionActive()&&(this.debugLog("[ ConvivaAnalyticsTracker ] report seek ended"),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.SEEK_ENDED))},t.prototype.trackUpdateAudioTrack=function(t){if(this.isSessionActive()){var e="unknown"!==t.lang?"["+t.lang+"]:"+t.label:t.label;this.debugLog("[ ConvivaAnalyticsTracker ] report audio language",{formattedAudio:e}),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.AUDIO_LANGUAGE,e)}},t.prototype.trackUpdateSubtitleTrack=function(t){if(this.isSessionActive()){var e="unknown"!==t.lang?"["+t.lang+"]:"+t.label:t.label;"subtitles"===t.kind?(this.debugLog("[ ConvivaAnalyticsTracker ] report subtitles language",{formattedSubtitle:e}),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.SUBTITLES_LANGUAGE,e),this.debugLog("[ ConvivaAnalyticsTracker ] report off closed captions language"),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.CLOSED_CAPTIONS_LANGUAGE,"off")):"captions"===t.kind?(this.debugLog("[ ConvivaAnalyticsTracker ] report closed captions language",{formattedSubtitle:e}),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.CLOSED_CAPTIONS_LANGUAGE,e),this.debugLog("[ ConvivaAnalyticsTracker ] report off subtitles language"),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.SUBTITLES_LANGUAGE,"off")):this.trackTurnOffSubtitles()}},t.prototype.trackInitialSubtitles=function(){if(this.isSessionActive()){if(void 0!==this.player.subtitles){var t=this.player.subtitles.list().filter(function(t){return t.enabled});if(1===t.length)return void this.trackUpdateSubtitleTrack(t[0])}this.trackTurnOffSubtitles()}},t.prototype.trackTurnOffSubtitles=function(){this.isSessionActive()&&(this.debugLog("[ ConvivaAnalyticsTracker ] report off subtitles language"),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.SUBTITLES_LANGUAGE,"off"),this.debugLog("[ ConvivaAnalyticsTracker ] report off closed captions language"),this.convivaVideoAnalytics.reportPlaybackMetric(i.Constants.Playback.CLOSED_CAPTIONS_LANGUAGE,"off"))},t.prototype.registerPlayerEvents=function(){this.handlers.add(n.PlayerEvent.SourceLoaded,this.onSourceLoaded),this.handlers.add(n.PlayerEvent.Play,this.onPlay),this.handlers.add(n.PlayerEvent.Playing,this.onPlaying),this.handlers.add(n.PlayerEvent.PlaybackFinished,this.onPlaybackFinished),this.handlers.add(n.PlayerEvent.SourceUnloaded,this.onSourceUnloaded)},t.prototype.unregisterPlayerEvents=function(){var t;null===(t=this.handlers)||void 0===t||t.clear()},Object.defineProperty(t,"version",{get:function(){return t.VERSION},enumerable:!1,configurable:!0}),t.VERSION="5.4.1",t.AD_BREAK_FINISHED_DELAY_MS=250,t.STALL_TRACKING_DELAY_MS=100,t}();e.ConvivaAnalyticsTracker=h},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Html5Logging=void 0;var i=a(0),n=function(){function t(){}return t.prototype.consoleLog=function(t,e){"undefined"!=typeof console&&(console.log&&e===i.SystemSettings.LogLevel.DEBUG||e===i.SystemSettings.LogLevel.INFO?console.log(t):console.warn&&e===i.SystemSettings.LogLevel.WARNING?console.warn(t):console.error&&e===i.SystemSettings.LogLevel.ERROR&&console.error(t))},t.prototype.release=function(){},t}();e.Html5Logging=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PlayerEventWrapper=void 0;var i=a(16),n=function(){function t(t){this.player=t,this.eventHandlers={}}return t.prototype.add=function(t,e){this.player.on(t,e),this.eventHandlers[t]||(this.eventHandlers[t]=[]),this.eventHandlers[t].push(e)},t.prototype.remove=function(t,e){this.player.off(t,e),this.eventHandlers[t]&&i.ArrayUtils.remove(this.eventHandlers[t],e)},t.prototype.clear=function(){for(var t in this.eventHandlers)for(var e=0,a=this.eventHandlers[t];e<a.length;e++){var i=a[e];this.remove(t,i)}},t}();e.PlayerEventWrapper=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConvivaAnalytics=void 0,a(7);var i=a(8);Object.defineProperty(e,"ConvivaAnalytics",{enumerable:!0,get:function(){return i.ConvivaAnalytics}})},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConvivaAnalytics=void 0;var i=a(0),n=a(1),r=a(9),o=a(3),s=a(20),c=a(5),l=a(2),d=a(4),v=function(){function t(t,e,a){void 0===a&&(a={});var n=this;this.logger=new d.Html5Logging,this.onPlaybackStateChanged=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] playback state change related event",t),n.convivaAnalyticsTracker.trackPlaybackStateChanged(t)},this.onPlay=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] play",t),n.convivaAnalyticsTracker.canTrackPlayEvent&&n.onPlaybackStateChanged(t)},this.onPlaying=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] playing",t),n.onPlaybackStateChanged(t)},this.onPlaybackFinished=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] playback finished",t),n.onPlaybackStateChanged(t)},this.onVideoQualityChanged=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] video quality changed",t),n.convivaAnalyticsTracker.trackVideoQualityChanged(t)},this.onCustomEvent=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] custom playback related event",t);var e=r.ObjectUtils.flatten(t);n.sendCustomPlaybackEvent(t.type,e)},this.onAdBreakStarted=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] adbreak started",t),n.lastAdBreakEvent=t,n.convivaAnalyticsTracker.trackAdBreakStarted(i.Constants.AdType.CLIENT_SIDE),n.convivaAnalyticsTracker.trackPlaybackStateChanged(t)},this.onAdStarted=function(t){var e;n.debugLog("[ ConvivaAnalytics ] [ Player Event ] ad started",t);var a=l.AdHelper.extractCsaiConvivaAdInfo(n.player,n.lastAdBreakEvent,t),r=null===(e=t.ad.data)||void 0===e?void 0:e.bitrate;n.convivaAnalyticsTracker.trackAdStarted(a,i.Constants.AdType.CLIENT_SIDE,r),n.convivaAnalyticsTracker.trackPlaybackStateChanged(t)},this.onAdFinished=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] ad finished",t),n.convivaAnalyticsTracker.trackAdFinished(),n.convivaAnalyticsTracker.trackPlaybackStateChanged(t)},this.onAdSkipped=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] ad skipped",t),n.convivaAnalyticsTracker.trackAdSkipped(),n.onCustomEvent(t)},this.onAdBreakFinished=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] adbreak finished",t),n.convivaAnalyticsTracker.trackAdBreakFinished(),n.convivaAnalyticsTracker.trackPlaybackStateChanged(t)},this.onAdError=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] ad error",t),n.convivaAnalyticsTracker.trackAdError(t),n.onCustomEvent(t)},this.onSeek=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] seek",t),n.convivaAnalyticsTracker.trackSeekStart(t.seekTarget),n.onPlaybackStateChanged(t)},this.onSeeked=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] seeked",t),n.convivaAnalyticsTracker.trackSeekEnd(),n.onPlaybackStateChanged(t)},this.onTimeShift=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] time shift",t),n.convivaAnalyticsTracker.trackSeekStart(-1),n.onPlaybackStateChanged(t)},this.onTimeShifted=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] time shifted",t),n.convivaAnalyticsTracker.trackSeekEnd(),n.onPlaybackStateChanged(t)},this.onAudioChanged=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] audio changed",t),n.convivaAnalyticsTracker.trackUpdateAudioTrack(t.targetAudio)},this.onSubtitleEnabled=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] subtitled enabled",t),n.convivaAnalyticsTracker.trackUpdateSubtitleTrack(t.subtitle)},this.onSubtitleDisabled=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] subtitles disabled",t),n.convivaAnalyticsTracker.trackTurnOffSubtitles()},this.onError=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] error",t),n.convivaAnalyticsTracker.trackError(t)},this.onDestroy=function(t){n.debugLog("[ ConvivaAnalytics ] [ Player Event ] destroy",t),n.releaseInternal(t)},this.convivaAnalyticsTracker=new o.ConvivaAnalyticsTracker(e,a),this.debugLoggingEnabled=a.debugLoggingEnabled||!1,this._player=t,t&&this.attachPlayer(t),this.convivaSsaiAnalytics=new s.ConvivaAnalyticsSsai(this.convivaAnalyticsTracker),this.ssai={get isAdBreakActive(){return this.convivaSsaiAnalytics.isAdBreakActive},reportAdBreakStarted:this.convivaSsaiAnalytics.reportAdBreakStarted.bind(this.convivaSsaiAnalytics),reportAdStarted:this.convivaSsaiAnalytics.reportAdStarted.bind(this.convivaSsaiAnalytics),reportAdFinished:this.convivaSsaiAnalytics.reportAdFinished.bind(this.convivaSsaiAnalytics),reportAdSkipped:this.convivaSsaiAnalytics.reportAdSkipped.bind(this.convivaSsaiAnalytics),reportAdBreakFinished:this.convivaSsaiAnalytics.reportAdBreakFinished.bind(this.convivaSsaiAnalytics)}}return Object.defineProperty(t.prototype,"player",{get:function(){if(!this._player)throw new Error("Player is not initialized, either pass it to the constructor or attach it via `attachPlayer` before using the integration.");return this._player},enumerable:!1,configurable:!0}),t.prototype.attachPlayer=function(t){var e=this.convivaAnalyticsTracker.canAttachPlayer(t),a=e.canAttach,n=e.reason;a?(this.convivaAnalyticsTracker.attachPlayer(t),this._player=t,this.handlers=new c.PlayerEventWrapper(t),this.registerPlayerEvents()):this.logger.consoleLog("[ ConvivaAnalyticsTracker ] cannot attach player: ".concat(n),i.SystemSettings.LogLevel.WARNING)},t.prototype.initializeSession=function(){this.convivaAnalyticsTracker.initializeSession()},t.prototype.endSession=function(){this.debugLog("[ ConvivaAnalytics ] external ending session"),this.convivaSsaiAnalytics.reset(),this.convivaAnalyticsTracker.endSession()},t.prototype.sendCustomApplicationEvent=function(t,e){void 0===e&&(e={}),this.convivaAnalyticsTracker.sendCustomApplicationEvent(t,e)},t.prototype.sendCustomPlaybackEvent=function(t,e){void 0===e&&(e={}),this.convivaAnalyticsTracker.sendCustomPlaybackEvent(t,e)},t.prototype.updateContentMetadata=function(t){this.convivaAnalyticsTracker.updateContentMetadata(t)},t.prototype.reportPlaybackDeficiency=function(t,e,a){void 0===a&&(a=!0),this.convivaAnalyticsTracker.reportPlaybackDeficiency(t,e,a)},t.prototype.pauseTracking=function(){this.convivaAnalyticsTracker.pauseTracking()},t.prototype.resumeTracking=function(){this.convivaAnalyticsTracker.resumeTracking()},t.prototype.release=function(){this.releaseInternal()},t.prototype.releaseInternal=function(t){var e=(null==t?void 0:t.type)===n.PlayerEvent.Destroy;e||this.unregisterPlayerEvents(),this._player=null,this.handlers=null,this.debugLog("[ ConvivaAnalytics ] releasing",{event:t,isPlayerDestroyed:e}),this.convivaAnalyticsTracker.release(e),this.convivaSsaiAnalytics.reset(),this.lastAdBreakEvent=null},t.prototype.debugLog=function(t){for(var e=[],a=1;a<arguments.length;a++)e[a-1]=arguments[a];this.debugLoggingEnabled&&console.log.apply(console,arguments)},t.prototype.registerPlayerEvents=function(){this.handlers.add(n.PlayerEvent.Play,this.onPlay),this.handlers.add(n.PlayerEvent.Playing,this.onPlaying),this.handlers.add(n.PlayerEvent.Paused,this.onPlaybackStateChanged),this.handlers.add(n.PlayerEvent.StallStarted,this.onPlaybackStateChanged),this.handlers.add(n.PlayerEvent.StallEnded,this.onPlaybackStateChanged),this.handlers.add(n.PlayerEvent.PlaybackFinished,this.onPlaybackFinished),this.handlers.add(n.PlayerEvent.VideoPlaybackQualityChanged,this.onVideoQualityChanged),this.handlers.add(n.PlayerEvent.AudioPlaybackQualityChanged,this.onCustomEvent),this.handlers.add(n.PlayerEvent.Muted,this.onCustomEvent),this.handlers.add(n.PlayerEvent.Unmuted,this.onCustomEvent),this.handlers.add(n.PlayerEvent.ViewModeChanged,this.onCustomEvent),this.handlers.add(n.PlayerEvent.AdStarted,this.onAdStarted),this.handlers.add(n.PlayerEvent.AdFinished,this.onAdFinished),this.handlers.add(n.PlayerEvent.AdBreakStarted,this.onAdBreakStarted),this.handlers.add(n.PlayerEvent.AdBreakFinished,this.onAdBreakFinished),this.handlers.add(n.PlayerEvent.AdSkipped,this.onAdSkipped),this.handlers.add(n.PlayerEvent.AdError,this.onAdError),this.handlers.add(n.PlayerEvent.Error,this.onError),this.handlers.add(n.PlayerEvent.Destroy,this.onDestroy),this.handlers.add(n.PlayerEvent.Seek,this.onSeek),this.handlers.add(n.PlayerEvent.Seeked,this.onSeeked),this.handlers.add(n.PlayerEvent.TimeShift,this.onTimeShift),this.handlers.add(n.PlayerEvent.TimeShifted,this.onTimeShifted),this.handlers.add(n.PlayerEvent.AudioChanged,this.onAudioChanged),this.handlers.add(n.PlayerEvent.SubtitleEnabled,this.onSubtitleEnabled),this.handlers.add(n.PlayerEvent.SubtitleDisabled,this.onSubtitleDisabled),this.handlers.add(n.PlayerEvent.CastStarted,this.onCustomEvent),this.handlers.add(n.PlayerEvent.CastStopped,this.onCustomEvent)},t.prototype.unregisterPlayerEvents=function(){var t;null===(t=this.handlers)||void 0===t||t.clear()},t}();e.ConvivaAnalytics=v},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectUtils=void 0,function(t){t.flatten=function(t,e){void 0===e&&(e="");var a={},i=function(t,e){for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];"object"==typeof r?i(r,e+n+"."):a[e+n]=String(r)}};return i(t,e),a}}(e.ObjectUtils||(e.ObjectUtils={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Html5Http=void 0;var i=function(){function t(){}return t.prototype.makeRequest=function(t,e,a,i,n,r){return this.makeRequestStandard.apply(this,arguments)},t.prototype.release=function(){},t.prototype.makeRequestStandard=function(t,e,a,i,n,r){var o=new XMLHttpRequest;return o.open(t,e,!0),i&&o.overrideMimeType&&o.overrideMimeType(i),i&&o.setRequestHeader&&o.setRequestHeader("Content-Type",i),n>0&&(o.timeout=n,o.ontimeout=function(){o.ontimeout=o.onreadystatechange=null,r&&r(!1,"timeout after "+n+" ms")}),o.onreadystatechange=function(){4===o.readyState&&(o.ontimeout=o.onreadystatechange=null,200===o.status?r&&r(!0,o.responseText):r&&r(!1,"http status "+o.status))},o.send(a),null},t}();e.Html5Http=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Html5Storage=void 0;var i=function(){function t(){}return t.prototype.saveData=function(t,e,a,i){var n=t+"."+e;try{localStorage.setItem(n,a),i(!0,null)}catch(t){i(!1,t.toString())}},t.prototype.loadData=function(t,e,a){var i=t+"."+e;try{a(!0,localStorage.getItem(i))}catch(t){a(!1,t.toString())}},t.prototype.release=function(){},t}();e.Html5Storage=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Html5Time=void 0;var i=function(){function t(){}return t.prototype.getEpochTimeMs=function(){return(new Date).getTime()},t.prototype.release=function(){},t}();e.Html5Time=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Html5Timer=void 0;var i=function(){function t(){}return t.prototype.createTimer=function(t,e,a){var i=window.setInterval(t,e);return function(){-1!==i&&(clearInterval(i),i=-1)}},t.prototype.release=function(){},t}();e.Html5Timer=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e,a){void 0===a&&(a=!1),this.delay=t,this.callback=e,this.repeat=a,this.timeoutOrIntervalId=0}return t.prototype.start=function(){return this.reset(),this},t.prototype.clear=function(){this.clearInternal()},t.prototype.reset=function(){this.clearInternal(),this.repeat?this.timeoutOrIntervalId=setInterval(this.callback,this.delay):this.timeoutOrIntervalId=setTimeout(this.callback,this.delay)},t.prototype.clearInternal=function(){this.repeat?clearInterval(this.timeoutOrIntervalId):clearTimeout(this.timeoutOrIntervalId)},t}();e.Timeout=i},function(t,e,a){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,a=1,i=arguments.length;a<i;a++)for(var n in e=arguments[a])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.ContentMetadataBuilder=void 0;var n=a(0),r=function(){function t(t){this.metadataOverrides={},this.metadata={},this.latestBuiltMetadata={},this.playbackStarted=!1,this.logger=t}return t.prototype.setOverrides=function(t){this.playbackStarted&&this.logger.consoleLog("[ Conviva Analytics ] Playback has started. Only some metadata attributes will be updated",n.SystemSettings.LogLevel.WARNING),this.metadataOverrides=i(i({},this.metadataOverrides),t)},t.prototype.getOverrides=function(){return this.metadataOverrides},t.prototype.setPlaybackStarted=function(t){this.playbackStarted=t},t.prototype.getStaticMetadata=function(){var t={};return this.playbackStarted?(t.assetName=this.latestBuiltMetadata.assetName,t.viewerId=this.latestBuiltMetadata.viewerId,t.streamType=this.latestBuiltMetadata.streamType,t.applicationName=this.latestBuiltMetadata.applicationName,t.duration=this.latestBuiltMetadata.duration,t.custom=this.latestBuiltMetadata.custom):(t.assetName=this.latestBuiltMetadata.assetName||this.assetName,t.viewerId=this.viewerId,t.streamType=this.metadataOverrides.streamType||this.metadata.streamType,t.applicationName=this.metadataOverrides.applicationName||this.metadata.applicationName,t.duration=this.metadataOverrides.duration||this.metadata.duration,t.custom=i(i(i({},this.metadataOverrides.custom),this.metadataOverrides.additionalStandardTags),this.metadata.custom)),t},t.prototype.getDynamicMetadata=function(){return{encodedFrameRate:this.metadataOverrides.encodedFrameRate||this.metadata.encodedFrameRate,defaultResource:this.metadataOverrides.defaultResource||this.metadata.defaultResource,streamUrl:this.metadataOverrides.streamUrl||this.metadata.streamUrl}},t.prototype.build=function(){var t,e=i(i({},this.getStaticMetadata()),this.getDynamicMetadata());this.latestBuiltMetadata=e;var a=((t={})[n.Constants.ASSET_NAME]=e.assetName,t[n.Constants.ENCODED_FRAMERATE]=e.encodedFrameRate,t[n.Constants.DURATION]=e.duration,t[n.Constants.DEFAULT_RESOURCE]=e.defaultResource,t[n.Constants.STREAM_URL]=e.streamUrl,t[n.Constants.IS_LIVE]=e.streamType,t[n.Constants.VIEWER_ID]=e.viewerId||"GET_VIEWER_ID_FROM_PLAYER",t[n.Constants.PLAYER_NAME]=e.applicationName||"GET_PLAYER_NAME_OR_TYPE",t);return i(i({},a),e.custom)},Object.defineProperty(t.prototype,"assetName",{get:function(){return this.metadataOverrides.assetName||this.metadata.assetName},set:function(t){this.metadata.assetName=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewerId",{get:function(){return this.metadataOverrides.viewerId||this.metadata.viewerId},set:function(t){this.metadata.viewerId=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"streamType",{set:function(t){this.metadata.streamType=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"applicationName",{set:function(t){this.metadata.applicationName=t},enumerable:!1,configurable:!0}),t.prototype.addToCustom=function(t){this.metadata.custom=i(i({},this.metadata.custom),t)},Object.defineProperty(t.prototype,"duration",{set:function(t){this.metadata.duration=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"encodedFrameRate",{set:function(t){this.metadata.encodedFrameRate=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultResource",{set:function(t){this.metadata.defaultResource=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"streamUrl",{set:function(t){this.metadata.streamUrl=t},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.metadataOverrides={},this.metadata={},this.playbackStarted=!1,this.latestBuiltMetadata={}},t}();e.ContentMetadataBuilder=r},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.remove=function(t,e){var a=t.indexOf(e);return a>-1?t.splice(a,1)[0]:null}}(e.ArrayUtils||(e.ArrayUtils={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PlayerConfigHelper=void 0;var i=a(18),n=function(){function t(){}return t.getAutoplayConfig=function(e){var a=e.getConfig();return a.playback&&void 0!==a.playback.autoplay?a.playback.autoplay:t.AUTOPLAY_DEFAULT_CONFIG},t.getPreloadConfig=function(t){var e=t.getConfig();if(i.BrowserUtils.isMobile()){if(e.adaptation&&e.adaptation.mobile&&void 0!==e.adaptation.mobile.preload)return e.adaptation.mobile.preload}else if(e.adaptation&&e.adaptation.desktop&&void 0!==e.adaptation.desktop.preload)return e.adaptation.desktop.preload;return e.adaptation&&void 0!==e.adaptation.preload?e.adaptation.preload:!t.isLive()},t.AUTOPLAY_DEFAULT_CONFIG=!1,t}();e.PlayerConfigHelper=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BrowserUtils=void 0;var i=function(){function t(){}return t.isMobile=function(){var t=/Android/i.test(navigator.userAgent),e=/IEMobile/i.test(navigator.userAgent),a=/Windows Phone 10.0/i.test(navigator.userAgent),i=/Safari/i.test(navigator.userAgent)&&/Mobile/i.test(navigator.userAgent);return t||e||a||i},t}();e.BrowserUtils=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PlayerStateHelper=void 0;var i=a(1),n=a(0),r=function(){function t(){}return t.getPlayerStateFromEvent=function(t,e){var a;switch(t.type){case i.PlayerEvent.StallStarted:a=n.Constants.PlayerState.BUFFERING;break;case i.PlayerEvent.Playing:a=n.Constants.PlayerState.PLAYING;break;case i.PlayerEvent.Paused:a=n.Constants.PlayerState.PAUSED;break;case i.PlayerEvent.Seeked:case i.PlayerEvent.TimeShifted:case i.PlayerEvent.StallEnded:a=e.isPlaying()?n.Constants.PlayerState.PLAYING:n.Constants.PlayerState.PAUSED}return a},t.getPlayerState=function(t){return t.isStalled()?n.Constants.PlayerState.BUFFERING:t.isPlaying()?n.Constants.PlayerState.PLAYING:n.Constants.PlayerState.PAUSED},t}();e.PlayerStateHelper=r},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConvivaAnalyticsSsai=void 0;var i=a(0),n=a(2),r=function(){function t(t){this._isAdBreakActive=!1,this.convivaAnalyticsTracker=t}return Object.defineProperty(t.prototype,"isAdBreakActive",{get:function(){return this._isAdBreakActive},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this._isAdBreakActive=!1},t.prototype.reportAdBreakStarted=function(){this.convivaAnalyticsTracker.isAdBreakActive||this._isAdBreakActive||(this._isAdBreakActive=!0,this.convivaAnalyticsTracker.trackAdBreakStarted(i.Constants.AdType.SERVER_SIDE))},t.prototype.reportAdStarted=function(t){this._isAdBreakActive&&this.convivaAnalyticsTracker.trackAdStarted(n.AdHelper.convertSsaiAdInfoToConvivaAdInfo(t,this.convivaAnalyticsTracker.getContentMetadata()),i.Constants.AdType.SERVER_SIDE)},t.prototype.reportAdFinished=function(){this.isAdBreakActive&&this.convivaAnalyticsTracker.trackAdFinished()},t.prototype.reportAdSkipped=function(){this._isAdBreakActive&&this.convivaAnalyticsTracker.trackAdSkipped()},t.prototype.reportAdBreakFinished=function(){this._isAdBreakActive&&(this._isAdBreakActive=!1,this.convivaAnalyticsTracker.trackAdBreakFinished())},t}();e.ConvivaAnalyticsSsai=r}])});
//# sourceMappingURL=bitmovin-player-analytics-conviva.js.map

@@ -49,2 +49,3 @@ "use strict";

_this.convivaAnalyticsTracker.trackAdBreakStarted(Conviva.Constants.AdType.CLIENT_SIDE);
_this.convivaAnalyticsTracker.trackPlaybackStateChanged(event);
};

@@ -57,2 +58,3 @@ this.onAdStarted = function (event) {

_this.convivaAnalyticsTracker.trackAdStarted(adInfo, Conviva.Constants.AdType.CLIENT_SIDE, bitrateKbps);
_this.convivaAnalyticsTracker.trackPlaybackStateChanged(event);
};

@@ -62,2 +64,3 @@ this.onAdFinished = function (event) {

_this.convivaAnalyticsTracker.trackAdFinished();
_this.convivaAnalyticsTracker.trackPlaybackStateChanged(event);
};

@@ -72,2 +75,3 @@ this.onAdSkipped = function (event) {

_this.convivaAnalyticsTracker.trackAdBreakFinished();
_this.convivaAnalyticsTracker.trackPlaybackStateChanged(event);
};

@@ -74,0 +78,0 @@ this.onAdError = function (event) {

@@ -79,2 +79,3 @@ import * as Conviva from '@convivainc/conviva-js-coresdk';

private static readonly VERSION;
static readonly AD_BREAK_FINISHED_DELAY_MS = 250;
static readonly STALL_TRACKING_DELAY_MS = 100;

@@ -167,4 +168,6 @@ private _player;

trackAdStarted: (adInfo: Conviva.ConvivaMetadata, type: Conviva.valueof<Conviva.ConvivaConstants['AdType']>, bitrateKbps?: number) => void;
trackAdSkipped: () => void;
trackAdFinished: () => void;
trackAdSkipped: () => void;
private reportAdBreakEnded;
private adBreakFinishedTimeout;
trackAdBreakFinished: () => void;

@@ -171,0 +174,0 @@ trackAdError: (event: ErrorEvent) => void;

@@ -131,5 +131,12 @@ "use strict";

this.trackAdStarted = function (adInfo, type, bitrateKbps) {
// Clear the timeout that may have been scheduled by a previous ad finished event, as the ad break is not actually over yet.
_this.adBreakFinishedTimeout.clear();
if (!_this.isSessionActive()) {
return;
}
if (!_this.isAdBreakActive) {
// If no ad break is active, it must mean that the `adBreakFinishedTimeout` ran before AdStarted was emitted.
// Then we need to report this as the start of a new ad break.
_this.trackAdBreakStarted(type);
}
_this.debugLog('[ ConvivaAnalyticsTracker ] report ad started', {

@@ -158,9 +165,2 @@ adInfo: adInfo,

};
this.trackAdFinished = function () {
if (!_this.isSessionActive()) {
return;
}
_this.debugLog('[ ConvivaAnalyticsTracker ] report ad ended');
_this.convivaAdAnalytics.reportAdEnded();
};
this.trackAdSkipped = function () {

@@ -173,9 +173,27 @@ if (!_this.isSessionActive()) {

};
this.trackAdBreakFinished = function () {
this.trackAdFinished = function () {
if (!_this.isSessionActive()) {
return;
}
_this.debugLog('[ ConvivaAnalyticsTracker ] report ad ended');
_this.convivaAdAnalytics.reportAdEnded();
// Start timer to report ad break finished, as waiting for the event will cause VST to be too low.
_this.adBreakFinishedTimeout.start();
};
this.reportAdBreakEnded = function () {
_this._isAdBreakActive = false;
_this.debugLog('[ ConvivaAnalyticsTracker ] report ad break ended');
_this.convivaVideoAnalytics.reportAdBreakEnded();
};
this.adBreakFinishedTimeout = new timeout_1.Timeout(ConvivaAnalyticsTracker.AD_BREAK_FINISHED_DELAY_MS, this.reportAdBreakEnded);
this.trackAdBreakFinished = function () {
// Clear the timeout to prevent the ad break finished event from being reported twice
_this.adBreakFinishedTimeout.clear();
if (!_this.isSessionActive()) {
return;
}
if (_this.isAdBreakActive) {
// If ad break is still active, it must mean that the event was faster than the `adBreakFinishedTimeout`
_this.reportAdBreakEnded();
}
_this.debugLog("[ ConvivaAnalyticsTracker ] report ".concat(PlayerStateHelper_1.PlayerStateHelper.getPlayerState(_this.player), " playback state"));

@@ -578,2 +596,4 @@ _this.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE, PlayerStateHelper_1.PlayerStateHelper.getPlayerState(_this.player));

bitmovin_player_1.PlayerEvent.TimeShift,
bitmovin_player_1.PlayerEvent.AdBreakStarted,
bitmovin_player_1.PlayerEvent.AdFinished,
];

@@ -588,2 +608,4 @@ var stallTrackingClearEvents = [

bitmovin_player_1.PlayerEvent.PlaybackFinished,
bitmovin_player_1.PlayerEvent.AdStarted,
bitmovin_player_1.PlayerEvent.AdBreakFinished,
];

@@ -702,2 +724,3 @@ if (stallTrackingStartEvents.indexOf(event.type) !== -1) {

ConvivaAnalyticsTracker.VERSION = '{{VERSION}}';
ConvivaAnalyticsTracker.AD_BREAK_FINISHED_DELAY_MS = 250;
ConvivaAnalyticsTracker.STALL_TRACKING_DELAY_MS = 100;

@@ -704,0 +727,0 @@ return ConvivaAnalyticsTracker;

{
"name": "@bitmovin/player-integration-conviva",
"version": "5.4.0",
"version": "5.4.1",
"description": "Conviva analytics integration for the Bitmovin Player",

@@ -5,0 +5,0 @@ "repository": {

@@ -276,2 +276,3 @@ import * as Conviva from '@convivainc/conviva-js-coresdk';

this.convivaAnalyticsTracker.trackAdBreakStarted(Conviva.Constants.AdType.CLIENT_SIDE);
this.convivaAnalyticsTracker.trackPlaybackStateChanged(event);
};

@@ -286,2 +287,3 @@

this.convivaAnalyticsTracker.trackAdStarted(adInfo, Conviva.Constants.AdType.CLIENT_SIDE, bitrateKbps);
this.convivaAnalyticsTracker.trackPlaybackStateChanged(event);
}

@@ -292,2 +294,3 @@

this.convivaAnalyticsTracker.trackAdFinished();
this.convivaAnalyticsTracker.trackPlaybackStateChanged(event);
}

@@ -304,2 +307,3 @@

this.convivaAnalyticsTracker.trackAdBreakFinished();
this.convivaAnalyticsTracker.trackPlaybackStateChanged(event);
};

@@ -306,0 +310,0 @@

@@ -115,3 +115,5 @@ import * as Conviva from '@convivainc/conviva-js-coresdk';

public static readonly AD_BREAK_FINISHED_DELAY_MS = 250;
public static readonly STALL_TRACKING_DELAY_MS = 100;
private _player: PlayerAPI;

@@ -625,5 +627,7 @@

PlayerEvent.TimeShift,
PlayerEvent.AdBreakStarted,
PlayerEvent.AdFinished,
];
const stallTrackingClearEvents = [
PlayerEvent.StallStarted,
PlayerEvent.StallStarted, // StallStarted is reported as BUFFERING immediately. Does not need the delayed timeout approach.
PlayerEvent.Playing,

@@ -635,2 +639,4 @@ PlayerEvent.Paused,

PlayerEvent.PlaybackFinished,
PlayerEvent.AdStarted,
PlayerEvent.AdBreakFinished,
];

@@ -738,2 +744,5 @@

public trackAdStarted = (adInfo: Conviva.ConvivaMetadata, type: Conviva.valueof<Conviva.ConvivaConstants['AdType']>, bitrateKbps?: number) => {
// Clear the timeout that may have been scheduled by a previous ad finished event, as the ad break is not actually over yet.
this.adBreakFinishedTimeout.clear();
if (!this.isSessionActive()) {

@@ -743,2 +752,8 @@ return;

if (!this.isAdBreakActive) {
// If no ad break is active, it must mean that the `adBreakFinishedTimeout` ran before AdStarted was emitted.
// Then we need to report this as the start of a new ad break.
this.trackAdBreakStarted(type);
}
this.debugLog('[ ConvivaAnalyticsTracker ] report ad started', {

@@ -773,11 +788,2 @@ adInfo,

public trackAdFinished = () => {
if (!this.isSessionActive()) {
return;
}
this.debugLog('[ ConvivaAnalyticsTracker ] report ad ended');
this.convivaAdAnalytics.reportAdEnded();
}
public trackAdSkipped = () => {

@@ -792,3 +798,3 @@ if (!this.isSessionActive()) {

public trackAdBreakFinished = () => {
public trackAdFinished = () => {
if (!this.isSessionActive()) {

@@ -798,2 +804,10 @@ return;

this.debugLog('[ ConvivaAnalyticsTracker ] report ad ended');
this.convivaAdAnalytics.reportAdEnded();
// Start timer to report ad break finished, as waiting for the event will cause VST to be too low.
this.adBreakFinishedTimeout.start();
}
private reportAdBreakEnded = () => {
this._isAdBreakActive = false;

@@ -803,3 +817,19 @@

this.convivaVideoAnalytics.reportAdBreakEnded();
}
private adBreakFinishedTimeout = new Timeout(ConvivaAnalyticsTracker.AD_BREAK_FINISHED_DELAY_MS, this.reportAdBreakEnded);
public trackAdBreakFinished = () => {
// Clear the timeout to prevent the ad break finished event from being reported twice
this.adBreakFinishedTimeout.clear();
if (!this.isSessionActive()) {
return;
}
if (this.isAdBreakActive) {
// If ad break is still active, it must mean that the event was faster than the `adBreakFinishedTimeout`
this.reportAdBreakEnded();
}
this.debugLog(`[ ConvivaAnalyticsTracker ] report ${PlayerStateHelper.getPlayerState(this.player)} playback state`);

@@ -806,0 +836,0 @@ this.convivaVideoAnalytics.reportPlaybackMetric(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc