@bitmovin/player-integration-conviva
Advanced tools
Comparing version 4.0.3 to 4.1.0
@@ -9,3 +9,15 @@ # Changelog | ||
## [4.1.0] | ||
### Added | ||
- Support for Conviva-SDK version 4.5.7 | ||
### Fixed | ||
- Consecutive playback of multiple sources not tracked correctly | ||
### Removed | ||
- Support for Conviva-SDK version 4.0.15 | ||
## [4.0.3] | ||
### Added | ||
@@ -12,0 +24,0 @@ - `bitmovin-player@^8.31.0` as peer dependency. |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("bitmovin-player-analytics-conviva",[],e):"object"==typeof exports?exports["bitmovin-player-analytics-conviva"]=e():(t.bitmovin=t.bitmovin||{},t.bitmovin.player=t.bitmovin.player||{},t.bitmovin.player.analytics=e())}(window,function(){return function(t){var e={};function a(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}return a.m=t,a.c=e,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},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 n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)a.d(n,i,function(e){return t[e]}.bind(null,i));return n},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=0)}([function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=a(1);e.ConvivaAnalytics=n.ConvivaAnalytics},function(t,e,a){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,a=1,n=arguments.length;a<n;a++)for(var i in e=arguments[a])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var i=a(2),o=a(3),s=a(4),r=a(5),d=a(6),c=a(7),l=a(8),v=a(9),u=a(10),p=a(11),y=a(12),h=function(){function t(e,a,n){var u;void 0===n&&(n={});var p=this;if(this.stallTrackingTimout=new c.Timeout(t.STALL_TRACKING_DELAY_MS,function(){p.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.BUFFERING)}),this.sessionEndedExternally=!1,this.internalEndSession=function(t){p.isSessionActive()&&(p.debugLog("[ ConvivaAnalytics ] end session",Conviva.Constants.NO_SESSION_KEY,t),p.convivaVideoAnalytics.release(),Conviva.Analytics.release(),p.convivaVideoAnalytics=null,p.lastSeenBitrate=null)},this.onPlaybackStateChanged=function(t){if(!p.isAd&&p.isSessionActive()){var e;switch(t.type){case p.events.Play:case p.events.Seek:case p.events.TimeShift:p.stallTrackingTimout.start();break;case p.events.StallStarted:p.stallTrackingTimout.clear(),e=Conviva.Constants.PlayerState.BUFFERING;break;case p.events.Playing:p.stallTrackingTimout.clear(),p.adBreakStartedToFire&&(p.trackAdBreakStarted(p.adBreakStartedToFire),p.adBreakStartedToFire=null),e=Conviva.Constants.PlayerState.PLAYING;break;case p.events.Paused:p.stallTrackingTimout.clear(),e=Conviva.Constants.PlayerState.PAUSED;break;case p.events.Seeked:case p.events.TimeShifted:case p.events.StallEnded:p.stallTrackingTimout.clear(),e=p.player.isPlaying()?Conviva.Constants.PlayerState.PLAYING:Conviva.Constants.PlayerState.PAUSED;break;case p.events.PlaybackFinished:p.stallTrackingTimout.clear(),p.convivaVideoAnalytics.reportPlaybackEnded()}e&&(p.debugLog("[ ConvivaAnalytics ] report playback state",e),p.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,e))}},this.onSourceLoaded=function(t){p.isSessionActive()&&(p.buildSourceRelatedMetadata(p.player.getSource()),p.updateSession())},this.onPlay=function(t){p.debugLog("[ Player Event ] play",t),p.isAd||(p.isSessionActive()||p.sessionEndedExternally||p.internalInitializeSession(),p.onPlaybackStateChanged(t))},this.onPlaying=function(t){p.contentMetadataBuilder.setPlaybackStarted(!0),p.debugLog("[ Player Event ] playing",t),p.updateSession(),p.onPlaybackStateChanged(t)},this.onPlaybackFinished=function(t){p.debugLog("[ Player Event ] playback finished",t),p.isSessionActive()&&(p.onPlaybackStateChanged(t),p.convivaVideoAnalytics.release(),p.convivaVideoAnalytics=null)},this.onVideoQualityChanged=function(t){var e=Math.round(t.targetQuality.bitrate/1e3);p.isSessionActive()?(p.lastSeenBitrate=null,p.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,e)):p.lastSeenBitrate=e},this.onCustomEvent=function(t){if(p.isSessionActive()){var e=v.ObjectUtils.flatten(t);p.sendCustomPlaybackEvent(t.type,e)}else p.debugLog("skip custom event, no session existing",t)},this.trackAdBreakStarted=function(t){p.debugLog("[ ConvivaAnalytics ] adbreak started",t),p.isAd=!0;var e=y.AdBreakHelper.mapAdPosition(t.adBreak,p.player);p.isSessionActive()&&p.convivaVideoAnalytics.reportAdBreakStarted(Conviva.Constants.AdType.CLIENT_SIDE,Conviva.Constants.AdPlayer.SEPARATE,e)},this.onAdBreakFinished=function(t){p.debugLog("[ ConvivaAnalytics ] adbreak finished",t),p.isAd=!1,p.isSessionActive()&&(p.convivaVideoAnalytics.reportAdBreakEnded(),p.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING))},this.onAdSkipped=function(t){p.onCustomEvent(t)},this.onAdError=function(t){p.onCustomEvent(t)},this.onSeek=function(t){p.isSessionActive()&&(p.trackSeekStart(t.seekTarget),p.onPlaybackStateChanged(t))},this.onSeeked=function(t){p.isSessionActive()&&(p.trackSeekEnd(),p.onPlaybackStateChanged(t))},this.onTimeShift=function(t){p.isSessionActive()&&(p.trackSeekStart(-1),p.onPlaybackStateChanged(t))},this.onTimeShifted=function(t){p.isSessionActive()&&(p.trackSeekEnd(),p.onPlaybackStateChanged(t))},this.onError=function(t){p.isSessionActive()||p.sessionEndedExternally||p.internalInitializeSession(),p.reportPlaybackDeficiency(String(t.code)+" "+t.name,Conviva.Constants.ErrorSeverity.FATAL)},this.onSourceUnloaded=function(t){p.isAd||(p.internalEndSession(t),p.resetContentMetadata())},this.onDestroy=function(t){p.destroy(t)},this.onAdBreakStarted=function(t){if(t.adBreak.scheduleTime===1/0)return p.debugLog("[ ConvivaAnalytics ] detected post-roll ad ... Ending session"),void p.onPlaybackFinished({timestamp:Date.now(),type:p.events.PlaybackFinished});p.isSessionActive()?p.trackAdBreakStarted(t):p.adBreakStartedToFire=t},"undefined"!=typeof Conviva)if(e.getSource())console.error("Bitmovin Conviva integration must be instantiated before calling player.load()");else{this.player=e,this.events=e.exports.PlayerEvent,this.handlers=new g(e),this.config=n,this.config.debugLoggingEnabled=this.config.debugLoggingEnabled||!1,this.logger=new o.Html5Logging,this.sessionKey=Conviva.Constants.NO_SESSION_KEY,this.isAd=!1;var h=this.config.deviceMetadata||{},f=((u={})[Conviva.Constants.DeviceMetadata.CATEGORY]=h.category||this.config.deviceCategory||Conviva.Constants.DeviceCategory.WEB,u[Conviva.Constants.DeviceMetadata.BRAND]=h.brand,u[Conviva.Constants.DeviceMetadata.MANUFACTURER]=h.manufacturer,u[Conviva.Constants.DeviceMetadata.MODEL]=h.model,u[Conviva.Constants.DeviceMetadata.TYPE]=h.type,u[Conviva.Constants.DeviceMetadata.VERSION]=h.version,u[Conviva.Constants.DeviceMetadata.OS_NAME]=h.osName,u[Conviva.Constants.DeviceMetadata.OS_VERSION]=h.osVersion,u);Conviva.Analytics.setDeviceMetadata(f);var m={};m[Conviva.Constants.CallbackFunctions.CONSOLE_LOG]=this.logger.consoleLog,m[Conviva.Constants.CallbackFunctions.MAKE_REQUEST]=(new i.Html5Http).makeRequest;var C=new s.Html5Storage;m[Conviva.Constants.CallbackFunctions.SAVE_DATA]=C.saveData,m[Conviva.Constants.CallbackFunctions.LOAD_DATA]=C.loadData,m[Conviva.Constants.CallbackFunctions.CREATE_TIMER]=(new d.Html5Timer).createTimer,m[Conviva.Constants.CallbackFunctions.GET_EPOCH_TIME_IN_MS]=(new r.Html5Time).getEpochTimeMs;var S={};S[Conviva.Constants.GATEWAY_URL]=n.gatewayUrl,S[Conviva.Constants.LOG_LEVEL]=this.config.debugLoggingEnabled?Conviva.Constants.LogLevel.DEBUG:Conviva.Constants.LogLevel.NONE,Conviva.Analytics.init(a,m,S),this.contentMetadataBuilder=new l.ContentMetadataBuilder(this.logger),this.registerPlayerEvents()}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 t.prototype.initializeSession=function(){if(this.isSessionActive())this.logger.consoleLog("There is already a session running.",Conviva.SystemSettings.LogLevel.WARNING);else{if(!this.player.getSource()&&!this.contentMetadataBuilder.assetName)throw"AssetName is missing. Load player source first or set assetName via updateContentMetadata";this.internalInitializeSession(),this.sessionEndedExternally=!1}},t.prototype.endSession=function(){this.isSessionActive()&&(this.convivaVideoAnalytics.reportPlaybackEnded(),this.internalEndSession(),this.resetContentMetadata(),this.sessionEndedExternally=!0)},t.prototype.sendCustomApplicationEvent=function(t,e){void 0===e&&(e={}),this.isSessionActive()?this.convivaVideoAnalytics.reportAppEvent(t,e):this.logger.consoleLog("cannot send application event, no active monitoring session",Conviva.SystemSettings.LogLevel.WARNING)},t.prototype.sendCustomPlaybackEvent=function(t,e){void 0===e&&(e={}),this.isSessionActive()?this.convivaVideoAnalytics.reportPlaybackEvent(t,e):this.logger.consoleLog("cannot send playback event, no active monitoring session",Conviva.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.convivaVideoAnalytics.reportPlaybackFailed(t),a&&(this.internalEndSession(),this.resetContentMetadata()))},t.prototype.pauseTracking=function(){this.convivaVideoAnalytics.reportAdBreakStarted(Conviva.Constants.AdType.CLIENT_SIDE,Conviva.Constants.AdPlayer.SEPARATE,Conviva.Constants.AdPosition.PREROLL),this.debugLog("Tracking paused.")},t.prototype.resumeTracking=function(){this.convivaVideoAnalytics.reportAdBreakEnded(),this.debugLog("Tracking resumed.")},t.prototype.release=function(){this.destroy()},t.prototype.destroy=function(t){this.unregisterPlayerEvents(),this.internalEndSession(t)},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("[ ConvivaAnalytics ] no active session. Content metadata will be propagated to Conviva on session initialization.",Conviva.SystemSettings.LogLevel.DEBUG)},t.prototype.internalInitializeSession=function(){var t=this;this.buildContentMetadata(),this.convivaVideoAnalytics=Conviva.Analytics.buildVideoAnalytics(),this.convivaVideoAnalytics.reportPlaybackRequested(this.contentMetadataBuilder.build()),this.sessionKey=this.convivaVideoAnalytics.getSessionId(),this.convivaVideoAnalytics.setCallback(function(){var e=1e3*t.player.getCurrentTime("relativetime");t.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,e)}),this.debugLog("[ ConvivaAnalytics ] start session",this.sessionKey),this.isSessionActive()||this.logger.consoleLog("Something went wrong, could not obtain session key",Conviva.SystemSettings.LogLevel.ERROR),this.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),this.lastSeenBitrate&&this.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,this.lastSeenBitrate)},t.prototype.buildContentMetadata=function(){this.contentMetadataBuilder.duration=this.player.getDuration(),this.contentMetadataBuilder.streamType=this.player.isLive()?Conviva.ContentMetadata.StreamType.LIVE:Conviva.ContentMetadata.StreamType.VOD,this.contentMetadataBuilder.custom={autoplay:f.getAutoplayConfig(this.player)+"",preload:f.getPreloadConfig(this.player)+"",integrationVersion:t.VERSION};var e=this.player.getSource();e&&this.buildSourceRelatedMetadata(e)},t.prototype.buildSourceRelatedMetadata=function(t){this.contentMetadataBuilder.assetName=this.getAssetNameFromSource(t),this.contentMetadataBuilder.viewerId=this.contentMetadataBuilder.viewerId,this.contentMetadataBuilder.custom=n({playerType:this.player.getPlayerType(),streamType:this.player.getStreamType(),vrContentType:t.vr&&t.vr.contentType},this.contentMetadataBuilder.custom),this.contentMetadataBuilder.streamUrl=this.getUrlFromSource(t)},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.resetContentMetadata=function(){this.contentMetadataBuilder.reset()},t.prototype.isSessionActive=function(){return!!this.convivaVideoAnalytics},t.prototype.trackSeekStart=function(t){this.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)},t.prototype.trackSeekEnd=function(){this.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)},t.prototype.registerPlayerEvents=function(){var t=this.handlers;t.add(this.events.SourceLoaded,this.onSourceLoaded),t.add(this.events.Play,this.onPlay),t.add(this.events.Playing,this.onPlaying),t.add(this.events.Paused,this.onPlaybackStateChanged),t.add(this.events.StallStarted,this.onPlaybackStateChanged),t.add(this.events.StallEnded,this.onPlaybackStateChanged),t.add(this.events.PlaybackFinished,this.onPlaybackFinished),t.add(this.events.VideoPlaybackQualityChanged,this.onVideoQualityChanged),t.add(this.events.AudioPlaybackQualityChanged,this.onCustomEvent),t.add(this.events.Muted,this.onCustomEvent),t.add(this.events.Unmuted,this.onCustomEvent),t.add(this.events.ViewModeChanged,this.onCustomEvent),t.add(this.events.AdBreakStarted,this.onAdBreakStarted),t.add(this.events.AdBreakFinished,this.onAdBreakFinished),t.add(this.events.AdSkipped,this.onAdSkipped),t.add(this.events.AdError,this.onAdError),t.add(this.events.SourceUnloaded,this.onSourceUnloaded),t.add(this.events.Error,this.onError),t.add(this.events.Destroy,this.onDestroy),t.add(this.events.Seek,this.onSeek),t.add(this.events.Seeked,this.onSeeked),t.add(this.events.TimeShift,this.onTimeShift),t.add(this.events.TimeShifted,this.onTimeShifted),t.add(this.events.CastStarted,this.onCustomEvent),t.add(this.events.CastStopped,this.onCustomEvent)},t.prototype.unregisterPlayerEvents=function(){this.handlers.clear()},Object.defineProperty(t,"version",{get:function(){return t.VERSION},enumerable:!0,configurable:!0}),t.VERSION="4.0.3",t.STALL_TRACKING_DELAY_MS=100,t}();e.ConvivaAnalytics=h;var f=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(u.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}(),g=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]&&p.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 n=a[e];this.remove(t,n)}},t}()},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.makeRequest=function(t,e,a,n,i,o){return this.makeRequestStandard.apply(this,arguments)},t.prototype.release=function(){},t.prototype.makeRequestStandard=function(t,e,a,n,i,o){var s=new XMLHttpRequest;return s.open(t,e,!0),n&&s.overrideMimeType&&s.overrideMimeType(n),n&&s.setRequestHeader&&s.setRequestHeader("Content-Type",n),i>0&&(s.timeout=i,s.ontimeout=function(){s.ontimeout=s.onreadystatechange=null,o&&o(!1,"timeout after "+i+" ms")}),s.onreadystatechange=function(){4===s.readyState&&(s.ontimeout=s.onreadystatechange=null,200===s.status?o&&o(!0,s.responseText):o&&o(!1,"http status "+s.status))},s.send(a),null},t}();e.Html5Http=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.consoleLog=function(t,e){"undefined"!=typeof console&&(console.log&&e===Conviva.SystemSettings.LogLevel.DEBUG||e===Conviva.SystemSettings.LogLevel.INFO?console.log(t):console.warn&&e===Conviva.SystemSettings.LogLevel.WARNING?console.warn(t):console.error&&e===Conviva.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});var n=function(){function t(){}return t.prototype.saveData=function(t,e,a,n){var i=t+"."+e;try{localStorage.setItem(i,a),n(!0,null)}catch(t){n(!1,t.toString())}},t.prototype.loadData=function(t,e,a){var n=t+"."+e;try{a(!0,localStorage.getItem(n))}catch(t){a(!1,t.toString())}},t.prototype.release=function(){},t}();e.Html5Storage=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.getEpochTimeMs=function(){return(new Date).getTime()},t.prototype.release=function(){},t}();e.Html5Time=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.createTimer=function(t,e,a){var n=window.setInterval(t,e);return function(){-1!==n&&(clearInterval(n),n=-1)}},t.prototype.release=function(){},t}();e.Html5Timer=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=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=n},function(t,e,a){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,a=1,n=arguments.length;a<n;a++)for(var i in e=arguments[a])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.metadataOverrides={},this.metadata={},this.playbackStarted=!1,this.logger=t,this.contentMetadata=new Conviva.ContentMetadata}return t.prototype.setOverrides=function(t){this.playbackStarted&&this.logger.consoleLog("[ Conviva Analytics ] Playback has started. Only some metadata attributes will be updated",Conviva.SystemSettings.LogLevel.WARNING),this.metadataOverrides=n({},this.metadataOverrides,t)},t.prototype.getOverrides=function(){return this.metadataOverrides},t.prototype.setPlaybackStarted=function(t){this.playbackStarted=t},t.prototype.build=function(){this.playbackStarted||(this.contentMetadata.assetName||(this.contentMetadata.assetName=this.assetName),this.contentMetadata.viewerId=this.viewerId,this.contentMetadata.streamType=this.metadataOverrides.streamType||this.metadata.streamType,this.contentMetadata.applicationName=this.metadataOverrides.applicationName||this.metadata.applicationName,this.contentMetadata.duration=this.metadataOverrides.duration||this.metadata.duration,this.contentMetadata.framework=this.metadataOverrides.framework||this.metadata.framework,this.contentMetadata.frameworkVersion=this.metadataOverrides.frameworkVersion||this.metadata.frameworkVersion,this.contentMetadata.custom=this.custom),this.contentMetadata.encodedFrameRate=this.metadataOverrides.encodedFrameRate||this.metadata.encodedFrameRate,this.contentMetadata.defaultResource=this.metadataOverrides.defaultResource||this.metadata.defaultResource,this.contentMetadata.streamUrl=this.metadataOverrides.streamUrl||this.metadata.streamUrl;var t={};return t[Conviva.Constants.ASSET_NAME]=this.contentMetadata.assetName,t[Conviva.Constants.ENCODED_FRAMERATE]=this.contentMetadata.encodedFrameRate,t[Conviva.Constants.DURATION]=this.contentMetadata.duration,t[Conviva.Constants.DEFAULT_RESOURCE]=this.contentMetadata.defaultResource,t[Conviva.Constants.STREAM_URL]=this.contentMetadata.streamUrl,t[Conviva.Constants.IS_LIVE]=this.contentMetadata.streamType,t[Conviva.Constants.VIEWER_ID]=this.contentMetadata.viewerId||"GET_VIEWER_ID_FROM_PLAYER",t[Conviva.Constants.PLAYER_NAME]=this.contentMetadata.applicationName||"GET_PLAYER_NAME_OR_TYPE",t[Conviva.Constants.FRAMEWORK_NAME]=this.contentMetadata.framework,t[Conviva.Constants.FRAMEWORK_VERSION]=this.contentMetadata.frameworkVersion,n({},t,this.contentMetadata.custom)},Object.defineProperty(t.prototype,"assetName",{get:function(){return this.metadataOverrides.assetName||this.metadata.assetName},set:function(t){this.metadata.assetName=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"viewerId",{get:function(){return this.metadataOverrides.viewerId||this.metadata.viewerId},set:function(t){this.metadata.viewerId=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"streamType",{set:function(t){this.metadata.streamType=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"applicationName",{set:function(t){this.metadata.applicationName=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"custom",{get:function(){return n({},this.metadataOverrides.custom,this.metadata.custom)},set:function(t){this.metadata.custom=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"duration",{set:function(t){this.metadata.duration=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"encodedFrameRate",{set:function(t){this.metadata.encodedFrameRate=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"defaultResource",{set:function(t){this.metadata.defaultResource=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"streamUrl",{set:function(t){this.metadata.streamUrl=t},enumerable:!0,configurable:!0}),t.prototype.reset=function(){this.metadataOverrides={},this.metadata={},this.playbackStarted=!1,this.contentMetadata=new Conviva.ContentMetadata},t}();e.ContentMetadataBuilder=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.flatten=function(t,e){void 0===e&&(e="");var a={},n=function(t,e){for(var i in t)if(t.hasOwnProperty(i)){var o=t[i];"object"==typeof o?n(o,e+i+"."):a[e+i]=String(o)}};return n(t,e),a}}(e.ObjectUtils||(e.ObjectUtils={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=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),n=/Safari/i.test(navigator.userAgent)&&/Mobile/i.test(navigator.userAgent);return t||e||a||n},t}();e.BrowserUtils=n},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});var n=function(){function t(){}return t.mapAdPosition=function(t,e){return t.scheduleTime<=0?Conviva.Constants.AdPosition.PREROLL:t.scheduleTime>=e.getDuration()?Conviva.Constants.AdPosition.POSTROLL:Conviva.Constants.AdPosition.MIDROLL},t}();e.AdBreakHelper=n}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("bitmovin-player-analytics-conviva",[],e):"object"==typeof exports?exports["bitmovin-player-analytics-conviva"]=e():(t.bitmovin=t.bitmovin||{},t.bitmovin.player=t.bitmovin.player||{},t.bitmovin.player.analytics=e())}(window,function(){return function(t){var e={};function a(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}return a.m=t,a.c=e,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},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 n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)a.d(n,i,function(e){return t[e]}.bind(null,i));return n},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=0)}([function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=a(1);e.ConvivaAnalytics=n.ConvivaAnalytics},function(t,e,a){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,a=1,n=arguments.length;a<n;a++)for(var i in e=arguments[a])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var i=a(2),o=a(3),s=a(4),r=a(5),d=a(6),c=a(7),l=a(8),v=a(9),u=a(10),p=a(11),y=a(12),h=function(){function t(e,a,n){var u;void 0===n&&(n={});var p=this;if(this.stallTrackingTimout=new c.Timeout(t.STALL_TRACKING_DELAY_MS,function(){p.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.BUFFERING)}),this.sessionEndedExternally=!1,this.internalEndSession=function(t){p.isSessionActive()&&(p.debugLog("[ ConvivaAnalytics ] end session",Conviva.Constants.NO_SESSION_KEY,t),p.convivaVideoAnalytics.release(),p.convivaVideoAnalytics=null,p.lastSeenBitrate=null)},this.onPlaybackStateChanged=function(t){if(!p.isAd&&p.isSessionActive()){var e;switch(t.type){case p.events.Play:case p.events.Seek:case p.events.TimeShift:p.stallTrackingTimout.start();break;case p.events.StallStarted:p.stallTrackingTimout.clear(),e=Conviva.Constants.PlayerState.BUFFERING;break;case p.events.Playing:p.stallTrackingTimout.clear(),p.adBreakStartedToFire&&(p.trackAdBreakStarted(p.adBreakStartedToFire),p.adBreakStartedToFire=null),e=Conviva.Constants.PlayerState.PLAYING;break;case p.events.Paused:p.stallTrackingTimout.clear(),e=Conviva.Constants.PlayerState.PAUSED;break;case p.events.Seeked:case p.events.TimeShifted:case p.events.StallEnded:p.stallTrackingTimout.clear(),e=p.player.isPlaying()?Conviva.Constants.PlayerState.PLAYING:Conviva.Constants.PlayerState.PAUSED;break;case p.events.PlaybackFinished:p.stallTrackingTimout.clear(),p.convivaVideoAnalytics.reportPlaybackEnded()}e&&(p.debugLog("[ ConvivaAnalytics ] report playback state",e),p.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,e))}},this.onSourceLoaded=function(t){p.isSessionActive()&&(p.buildSourceRelatedMetadata(p.player.getSource()),p.updateSession())},this.onPlay=function(t){p.debugLog("[ Player Event ] play",t),p.isAd||(p.isSessionActive()||p.sessionEndedExternally||p.internalInitializeSession(),p.onPlaybackStateChanged(t))},this.onPlaying=function(t){p.contentMetadataBuilder.setPlaybackStarted(!0),p.debugLog("[ Player Event ] playing",t),p.updateSession(),p.onPlaybackStateChanged(t)},this.onPlaybackFinished=function(t){p.debugLog("[ Player Event ] playback finished",t),p.isSessionActive()&&(p.onPlaybackStateChanged(t),p.convivaVideoAnalytics.release(),p.convivaVideoAnalytics=null)},this.onVideoQualityChanged=function(t){var e=Math.round(t.targetQuality.bitrate/1e3);p.isSessionActive()?(p.lastSeenBitrate=null,p.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,e)):p.lastSeenBitrate=e},this.onCustomEvent=function(t){if(p.isSessionActive()){var e=v.ObjectUtils.flatten(t);p.sendCustomPlaybackEvent(t.type,e)}else p.debugLog("skip custom event, no session existing",t)},this.trackAdBreakStarted=function(t){p.debugLog("[ ConvivaAnalytics ] adbreak started",t),p.isAd=!0;var e=y.AdBreakHelper.mapAdPosition(t.adBreak,p.player);p.isSessionActive()&&p.convivaVideoAnalytics.reportAdBreakStarted(Conviva.Constants.AdType.CLIENT_SIDE,Conviva.Constants.AdPlayer.SEPARATE,e)},this.onAdBreakFinished=function(t){p.debugLog("[ ConvivaAnalytics ] adbreak finished",t),p.isAd=!1,p.isSessionActive()&&(p.convivaVideoAnalytics.reportAdBreakEnded(),p.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING))},this.onAdSkipped=function(t){p.onCustomEvent(t)},this.onAdError=function(t){p.onCustomEvent(t)},this.onSeek=function(t){p.isSessionActive()&&(p.trackSeekStart(t.seekTarget),p.onPlaybackStateChanged(t))},this.onSeeked=function(t){p.isSessionActive()&&(p.trackSeekEnd(),p.onPlaybackStateChanged(t))},this.onTimeShift=function(t){p.isSessionActive()&&(p.trackSeekStart(-1),p.onPlaybackStateChanged(t))},this.onTimeShifted=function(t){p.isSessionActive()&&(p.trackSeekEnd(),p.onPlaybackStateChanged(t))},this.onError=function(t){p.isSessionActive()||p.sessionEndedExternally||p.internalInitializeSession(),p.reportPlaybackDeficiency(String(t.code)+" "+t.name,Conviva.Constants.ErrorSeverity.FATAL)},this.onSourceUnloaded=function(t){p.isAd||(p.internalEndSession(t),p.resetContentMetadata())},this.onDestroy=function(t){p.destroy(t)},this.onAdBreakStarted=function(t){if(t.adBreak.scheduleTime===1/0)return p.debugLog("[ ConvivaAnalytics ] detected post-roll ad ... Ending session"),void p.onPlaybackFinished({timestamp:Date.now(),type:p.events.PlaybackFinished});p.isSessionActive()?p.trackAdBreakStarted(t):p.adBreakStartedToFire=t},"undefined"!=typeof Conviva)if(e.getSource())console.error("Bitmovin Conviva integration must be instantiated before calling player.load()");else{this.player=e,this.events=e.exports.PlayerEvent,this.handlers=new g(e),this.config=n,this.config.debugLoggingEnabled=this.config.debugLoggingEnabled||!1,this.logger=new o.Html5Logging,this.sessionKey=Conviva.Constants.NO_SESSION_KEY,this.isAd=!1;var h=this.config.deviceMetadata||{},f=((u={})[Conviva.Constants.DeviceMetadata.CATEGORY]=h.category||this.config.deviceCategory||Conviva.Constants.DeviceCategory.WEB,u[Conviva.Constants.DeviceMetadata.BRAND]=h.brand,u[Conviva.Constants.DeviceMetadata.MANUFACTURER]=h.manufacturer,u[Conviva.Constants.DeviceMetadata.MODEL]=h.model,u[Conviva.Constants.DeviceMetadata.TYPE]=h.type,u[Conviva.Constants.DeviceMetadata.VERSION]=h.version,u[Conviva.Constants.DeviceMetadata.OS_NAME]=h.osName,u[Conviva.Constants.DeviceMetadata.OS_VERSION]=h.osVersion,u);Conviva.Analytics.setDeviceMetadata(f);var m={};m[Conviva.Constants.CallbackFunctions.CONSOLE_LOG]=this.logger.consoleLog,m[Conviva.Constants.CallbackFunctions.MAKE_REQUEST]=(new i.Html5Http).makeRequest;var C=new s.Html5Storage;m[Conviva.Constants.CallbackFunctions.SAVE_DATA]=C.saveData,m[Conviva.Constants.CallbackFunctions.LOAD_DATA]=C.loadData,m[Conviva.Constants.CallbackFunctions.CREATE_TIMER]=(new d.Html5Timer).createTimer,m[Conviva.Constants.CallbackFunctions.GET_EPOCH_TIME_IN_MS]=(new r.Html5Time).getEpochTimeMs;var S={};S[Conviva.Constants.GATEWAY_URL]=n.gatewayUrl,S[Conviva.Constants.LOG_LEVEL]=this.config.debugLoggingEnabled?Conviva.Constants.LogLevel.DEBUG:Conviva.Constants.LogLevel.NONE,Conviva.Analytics.init(a,m,S),this.contentMetadataBuilder=new l.ContentMetadataBuilder(this.logger),this.registerPlayerEvents()}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 t.prototype.initializeSession=function(){if(this.isSessionActive())this.logger.consoleLog("There is already a session running.",Conviva.SystemSettings.LogLevel.WARNING);else{if(!this.player.getSource()&&!this.contentMetadataBuilder.assetName)throw"AssetName is missing. Load player source first or set assetName via updateContentMetadata";this.internalInitializeSession(),this.sessionEndedExternally=!1}},t.prototype.endSession=function(){this.isSessionActive()&&(this.convivaVideoAnalytics.reportPlaybackEnded(),this.internalEndSession(),this.resetContentMetadata(),this.sessionEndedExternally=!0)},t.prototype.sendCustomApplicationEvent=function(t,e){void 0===e&&(e={}),this.isSessionActive()?this.convivaVideoAnalytics.reportAppEvent(t,e):this.logger.consoleLog("cannot send application event, no active monitoring session",Conviva.SystemSettings.LogLevel.WARNING)},t.prototype.sendCustomPlaybackEvent=function(t,e){void 0===e&&(e={}),this.isSessionActive()?this.convivaVideoAnalytics.reportPlaybackEvent(t,e):this.logger.consoleLog("cannot send playback event, no active monitoring session",Conviva.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.convivaVideoAnalytics.reportPlaybackFailed(t),a&&(this.internalEndSession(),this.resetContentMetadata()))},t.prototype.pauseTracking=function(){this.convivaVideoAnalytics.reportAdBreakStarted(Conviva.Constants.AdType.CLIENT_SIDE,Conviva.Constants.AdPlayer.SEPARATE,Conviva.Constants.AdPosition.PREROLL),this.debugLog("Tracking paused.")},t.prototype.resumeTracking=function(){this.convivaVideoAnalytics.reportAdBreakEnded(),this.debugLog("Tracking resumed.")},t.prototype.release=function(){this.destroy()},t.prototype.destroy=function(t){this.unregisterPlayerEvents(),this.internalEndSession(t),Conviva.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("[ ConvivaAnalytics ] no active session. Content metadata will be propagated to Conviva on session initialization.",Conviva.SystemSettings.LogLevel.DEBUG)},t.prototype.internalInitializeSession=function(){var t=this;this.buildContentMetadata(),this.convivaVideoAnalytics=Conviva.Analytics.buildVideoAnalytics(),this.convivaVideoAnalytics.reportPlaybackRequested(this.contentMetadataBuilder.build()),this.sessionKey=this.convivaVideoAnalytics.getSessionId(),this.convivaVideoAnalytics.setCallback(function(){var e=1e3*t.player.getCurrentTime("relativetime");t.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,e)}),this.debugLog("[ ConvivaAnalytics ] start session",this.sessionKey),this.isSessionActive()||this.logger.consoleLog("Something went wrong, could not obtain session key",Conviva.SystemSettings.LogLevel.ERROR),this.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),this.lastSeenBitrate&&this.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,this.lastSeenBitrate)},t.prototype.buildContentMetadata=function(){this.contentMetadataBuilder.duration=this.player.getDuration(),this.contentMetadataBuilder.streamType=this.player.isLive()?Conviva.ContentMetadata.StreamType.LIVE:Conviva.ContentMetadata.StreamType.VOD,this.contentMetadataBuilder.custom={autoplay:f.getAutoplayConfig(this.player)+"",preload:f.getPreloadConfig(this.player)+"",integrationVersion:t.VERSION};var e=this.player.getSource();e&&this.buildSourceRelatedMetadata(e)},t.prototype.buildSourceRelatedMetadata=function(t){this.contentMetadataBuilder.assetName=this.getAssetNameFromSource(t),this.contentMetadataBuilder.viewerId=this.contentMetadataBuilder.viewerId,this.contentMetadataBuilder.custom=n({playerType:this.player.getPlayerType(),streamType:this.player.getStreamType(),vrContentType:t.vr&&t.vr.contentType},this.contentMetadataBuilder.custom),this.contentMetadataBuilder.streamUrl=this.getUrlFromSource(t)},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.resetContentMetadata=function(){this.contentMetadataBuilder.reset()},t.prototype.isSessionActive=function(){return!!this.convivaVideoAnalytics},t.prototype.trackSeekStart=function(t){this.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)},t.prototype.trackSeekEnd=function(){this.convivaVideoAnalytics.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)},t.prototype.registerPlayerEvents=function(){var t=this.handlers;t.add(this.events.SourceLoaded,this.onSourceLoaded),t.add(this.events.Play,this.onPlay),t.add(this.events.Playing,this.onPlaying),t.add(this.events.Paused,this.onPlaybackStateChanged),t.add(this.events.StallStarted,this.onPlaybackStateChanged),t.add(this.events.StallEnded,this.onPlaybackStateChanged),t.add(this.events.PlaybackFinished,this.onPlaybackFinished),t.add(this.events.VideoPlaybackQualityChanged,this.onVideoQualityChanged),t.add(this.events.AudioPlaybackQualityChanged,this.onCustomEvent),t.add(this.events.Muted,this.onCustomEvent),t.add(this.events.Unmuted,this.onCustomEvent),t.add(this.events.ViewModeChanged,this.onCustomEvent),t.add(this.events.AdBreakStarted,this.onAdBreakStarted),t.add(this.events.AdBreakFinished,this.onAdBreakFinished),t.add(this.events.AdSkipped,this.onAdSkipped),t.add(this.events.AdError,this.onAdError),t.add(this.events.SourceUnloaded,this.onSourceUnloaded),t.add(this.events.Error,this.onError),t.add(this.events.Destroy,this.onDestroy),t.add(this.events.Seek,this.onSeek),t.add(this.events.Seeked,this.onSeeked),t.add(this.events.TimeShift,this.onTimeShift),t.add(this.events.TimeShifted,this.onTimeShifted),t.add(this.events.CastStarted,this.onCustomEvent),t.add(this.events.CastStopped,this.onCustomEvent)},t.prototype.unregisterPlayerEvents=function(){this.handlers.clear()},Object.defineProperty(t,"version",{get:function(){return t.VERSION},enumerable:!0,configurable:!0}),t.VERSION="4.1.0",t.STALL_TRACKING_DELAY_MS=100,t}();e.ConvivaAnalytics=h;var f=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(u.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}(),g=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]&&p.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 n=a[e];this.remove(t,n)}},t}()},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.makeRequest=function(t,e,a,n,i,o){return this.makeRequestStandard.apply(this,arguments)},t.prototype.release=function(){},t.prototype.makeRequestStandard=function(t,e,a,n,i,o){var s=new XMLHttpRequest;return s.open(t,e,!0),n&&s.overrideMimeType&&s.overrideMimeType(n),n&&s.setRequestHeader&&s.setRequestHeader("Content-Type",n),i>0&&(s.timeout=i,s.ontimeout=function(){s.ontimeout=s.onreadystatechange=null,o&&o(!1,"timeout after "+i+" ms")}),s.onreadystatechange=function(){4===s.readyState&&(s.ontimeout=s.onreadystatechange=null,200===s.status?o&&o(!0,s.responseText):o&&o(!1,"http status "+s.status))},s.send(a),null},t}();e.Html5Http=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.consoleLog=function(t,e){"undefined"!=typeof console&&(console.log&&e===Conviva.SystemSettings.LogLevel.DEBUG||e===Conviva.SystemSettings.LogLevel.INFO?console.log(t):console.warn&&e===Conviva.SystemSettings.LogLevel.WARNING?console.warn(t):console.error&&e===Conviva.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});var n=function(){function t(){}return t.prototype.saveData=function(t,e,a,n){var i=t+"."+e;try{localStorage.setItem(i,a),n(!0,null)}catch(t){n(!1,t.toString())}},t.prototype.loadData=function(t,e,a){var n=t+"."+e;try{a(!0,localStorage.getItem(n))}catch(t){a(!1,t.toString())}},t.prototype.release=function(){},t}();e.Html5Storage=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.getEpochTimeMs=function(){return(new Date).getTime()},t.prototype.release=function(){},t}();e.Html5Time=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.createTimer=function(t,e,a){var n=window.setInterval(t,e);return function(){-1!==n&&(clearInterval(n),n=-1)}},t.prototype.release=function(){},t}();e.Html5Timer=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=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=n},function(t,e,a){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,a=1,n=arguments.length;a<n;a++)for(var i in e=arguments[a])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.metadataOverrides={},this.metadata={},this.playbackStarted=!1,this.logger=t,this.contentMetadata=new Conviva.ContentMetadata}return t.prototype.setOverrides=function(t){this.playbackStarted&&this.logger.consoleLog("[ Conviva Analytics ] Playback has started. Only some metadata attributes will be updated",Conviva.SystemSettings.LogLevel.WARNING),this.metadataOverrides=n({},this.metadataOverrides,t)},t.prototype.getOverrides=function(){return this.metadataOverrides},t.prototype.setPlaybackStarted=function(t){this.playbackStarted=t},t.prototype.build=function(){this.playbackStarted||(this.contentMetadata.assetName||(this.contentMetadata.assetName=this.assetName),this.contentMetadata.viewerId=this.viewerId,this.contentMetadata.streamType=this.metadataOverrides.streamType||this.metadata.streamType,this.contentMetadata.applicationName=this.metadataOverrides.applicationName||this.metadata.applicationName,this.contentMetadata.duration=this.metadataOverrides.duration||this.metadata.duration,this.contentMetadata.framework=this.metadataOverrides.framework||this.metadata.framework,this.contentMetadata.frameworkVersion=this.metadataOverrides.frameworkVersion||this.metadata.frameworkVersion,this.contentMetadata.custom=this.custom),this.contentMetadata.encodedFrameRate=this.metadataOverrides.encodedFrameRate||this.metadata.encodedFrameRate,this.contentMetadata.defaultResource=this.metadataOverrides.defaultResource||this.metadata.defaultResource,this.contentMetadata.streamUrl=this.metadataOverrides.streamUrl||this.metadata.streamUrl;var t={};return t[Conviva.Constants.ASSET_NAME]=this.contentMetadata.assetName,t[Conviva.Constants.ENCODED_FRAMERATE]=this.contentMetadata.encodedFrameRate,t[Conviva.Constants.DURATION]=this.contentMetadata.duration,t[Conviva.Constants.DEFAULT_RESOURCE]=this.contentMetadata.defaultResource,t[Conviva.Constants.STREAM_URL]=this.contentMetadata.streamUrl,t[Conviva.Constants.IS_LIVE]=this.contentMetadata.streamType,t[Conviva.Constants.VIEWER_ID]=this.contentMetadata.viewerId||"GET_VIEWER_ID_FROM_PLAYER",t[Conviva.Constants.PLAYER_NAME]=this.contentMetadata.applicationName||"GET_PLAYER_NAME_OR_TYPE",t[Conviva.Constants.FRAMEWORK_NAME]=this.contentMetadata.framework,t[Conviva.Constants.FRAMEWORK_VERSION]=this.contentMetadata.frameworkVersion,n({},t,this.contentMetadata.custom)},Object.defineProperty(t.prototype,"assetName",{get:function(){return this.metadataOverrides.assetName||this.metadata.assetName},set:function(t){this.metadata.assetName=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"viewerId",{get:function(){return this.metadataOverrides.viewerId||this.metadata.viewerId},set:function(t){this.metadata.viewerId=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"streamType",{set:function(t){this.metadata.streamType=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"applicationName",{set:function(t){this.metadata.applicationName=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"custom",{get:function(){return n({},this.metadataOverrides.custom,this.metadata.custom)},set:function(t){this.metadata.custom=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"duration",{set:function(t){this.metadata.duration=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"encodedFrameRate",{set:function(t){this.metadata.encodedFrameRate=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"defaultResource",{set:function(t){this.metadata.defaultResource=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"streamUrl",{set:function(t){this.metadata.streamUrl=t},enumerable:!0,configurable:!0}),t.prototype.reset=function(){this.metadataOverrides={},this.metadata={},this.playbackStarted=!1,this.contentMetadata=new Conviva.ContentMetadata},t}();e.ContentMetadataBuilder=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.flatten=function(t,e){void 0===e&&(e="");var a={},n=function(t,e){for(var i in t)if(t.hasOwnProperty(i)){var o=t[i];"object"==typeof o?n(o,e+i+"."):a[e+i]=String(o)}};return n(t,e),a}}(e.ObjectUtils||(e.ObjectUtils={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=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),n=/Safari/i.test(navigator.userAgent)&&/Mobile/i.test(navigator.userAgent);return t||e||a||n},t}();e.BrowserUtils=n},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});var n=function(){function t(){}return t.mapAdPosition=function(t,e){return t.scheduleTime<=0?Conviva.Constants.AdPosition.PREROLL:t.scheduleTime>=e.getDuration()?Conviva.Constants.AdPosition.POSTROLL:Conviva.Constants.AdPosition.MIDROLL},t}();e.AdBreakHelper=n}])}); | ||
//# sourceMappingURL=bitmovin-player-analytics-conviva.js.map |
@@ -46,3 +46,2 @@ "use strict"; | ||
_this.convivaVideoAnalytics.release(); | ||
Conviva.Analytics.release(); | ||
_this.convivaVideoAnalytics = null; | ||
@@ -442,2 +441,3 @@ _this.lastSeenBitrate = null; | ||
this.internalEndSession(event); | ||
Conviva.Analytics.release(); | ||
}; | ||
@@ -444,0 +444,0 @@ ConvivaAnalytics.prototype.debugLog = function (message) { |
{ | ||
"name": "@bitmovin/player-integration-conviva", | ||
"version": "4.0.3", | ||
"version": "4.1.0", | ||
"description": "Conviva analytics integration for the Bitmovin Player", | ||
@@ -5,0 +5,0 @@ "repository": { |
# Bitmovin Player Conviva Analytics Integration | ||
## Compatibility | ||
**This version of the Conviva Analytics Integration works only with Player Version >= 8.31.x. | ||
The recommended and tested version of the Conviva SDK is 4.0.15. See [CHANGELOG](CHANGELOG.md) for details. | ||
The recommended and tested version of the Conviva SDK is 4.5.7. See [CHANGELOG](CHANGELOG.md) for details. | ||
@@ -6,0 +6,0 @@ ## Getting Started |
@@ -350,2 +350,4 @@ import { | ||
this.internalEndSession(event); | ||
Conviva.Analytics.release(); | ||
} | ||
@@ -504,3 +506,2 @@ | ||
this.convivaVideoAnalytics.release(); | ||
Conviva.Analytics.release(); | ||
@@ -507,0 +508,0 @@ this.convivaVideoAnalytics = null; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
260310
56
1