@bitmovin/player-integration-conviva
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -7,2 +7,6 @@ # Changelog | ||
## [3.0.3] | ||
- Added a configuration option to set the Conviva Device Category. | ||
## [3.0.2] | ||
@@ -50,2 +54,3 @@ | ||
[3.0.3]: https://github.com/bitmovin/bitmovin-player-analytics-conviva/compare/v3.0.2...v3.0.3 | ||
[3.0.2]: https://github.com/bitmovin/bitmovin-player-analytics-conviva/compare/v3.0.1...v3.0.2 | ||
@@ -52,0 +57,0 @@ [3.0.1]: https://github.com/bitmovin/bitmovin-player-analytics-conviva/compare/v3.0.0...v3.0.1 |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("bitmovin-player-analytics-conviva",[],t):"object"==typeof exports?exports["bitmovin-player-analytics-conviva"]=t():(e.bitmovin=e.bitmovin||{},e.bitmovin.player=e.bitmovin.player||{},e.bitmovin.player.analytics=t())}(window,function(){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(a,i,function(t){return e[t]}.bind(null,i));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1);t.ConvivaAnalytics=a.ConvivaAnalytics},function(e,t,n){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(3),s=n(4),r=n(5),l=n(6),d=n(7),c=n(8),u=n(9),v=n(10),p=function(){function e(t,n,a){void 0===a&&(a={});var v=this;if(this.stallTrackingTimout=new c.Timeout(e.STALL_TRACKING_DELAY_MS,function(){v.playerStateManager.setPlayerState(Conviva.PlayerStateManager.PlayerState.BUFFERING)}),this.sessionEndedExternally=!1,this.internalEndSession=function(e){v.debugLog("[ ConvivaAnalytics ] end session",v.sessionKey,e),v.client.detachPlayer(v.sessionKey),v.client.cleanupSession(v.sessionKey),v.client.releasePlayerStateManager(v.playerStateManager),v.sessionKey=Conviva.Client.NO_SESSION_KEY,v.contentMetadataBuilder.reset(),v.lastSeenBitrate=null},this.onPlaybackStateChanged=function(e){if(!v.isAd&&v.isSessionActive()){var t;switch(e.type){case v.events.Play:case v.events.Seek:case v.events.TimeShift:v.stallTrackingTimout.start();break;case v.events.StallStarted:v.stallTrackingTimout.clear(),t=Conviva.PlayerStateManager.PlayerState.BUFFERING;break;case v.events.Playing:v.stallTrackingTimout.clear(),v.adBreakStartedToFire&&(v.trackAdBreakStarted(v.adBreakStartedToFire),v.adBreakStartedToFire=null),t=Conviva.PlayerStateManager.PlayerState.PLAYING;break;case v.events.Paused:v.stallTrackingTimout.clear(),t=Conviva.PlayerStateManager.PlayerState.PAUSED;break;case v.events.Seeked:case v.events.TimeShifted:case v.events.StallEnded:v.stallTrackingTimout.clear(),t=v.player.isPlaying()?Conviva.PlayerStateManager.PlayerState.PLAYING:Conviva.PlayerStateManager.PlayerState.PAUSED;break;case v.events.PlaybackFinished:v.stallTrackingTimout.clear(),t=Conviva.PlayerStateManager.PlayerState.STOPPED}t&&(v.debugLog("[ ConvivaAnalytics ] report playback state",t),v.playerStateManager.setPlayerState(t))}},this.onSourceLoaded=function(e){v.isSessionActive()&&(v.buildSourceRelatedMetadata(v.player.getSource()),v.updateSession())},this.onPlay=function(e){v.debugLog("[ Player Event ] play",e),v.isAd||(v.isSessionActive()||v.sessionEndedExternally||v.internalInitializeSession(),v.onPlaybackStateChanged(e))},this.onPlaying=function(e){v.contentMetadataBuilder.setPlaybackStarted(!0),v.debugLog("[ Player Event ] playing",e),v.updateSession(),v.onPlaybackStateChanged(e)},this.onPlaybackFinished=function(e){v.debugLog("[ Player Event ] playback finished",e),v.isSessionActive()&&(v.onPlaybackStateChanged(e),v.internalEndSession(e))},this.onVideoQualityChanged=function(e){var t=Math.round(e.targetQuality.bitrate/1e3);v.isSessionActive()?(v.lastSeenBitrate=null,v.playerStateManager.setBitrateKbps(t)):v.lastSeenBitrate=t},this.onCustomEvent=function(e){if(v.isSessionActive()){var t=h.flatten(e);v.sendCustomPlaybackEvent(e.type,t)}else v.debugLog("skip custom event, no session existing",e)},this.trackAdBreakStarted=function(e){v.debugLog("[ ConvivaAnalytics ] adbreak started",e),v.isAd=!0;var t=v.mapAdPosition(e.adBreak);v.isSessionActive()&&v.client.adStart(v.sessionKey,Conviva.Client.AdStream.SEPARATE,Conviva.Client.AdPlayer.CONTENT,t)},this.onAdBreakFinished=function(e){v.debugLog("[ ConvivaAnalytics ] adbreak finished",e),v.isAd=!1,v.isSessionActive()&&v.client.adEnd(v.sessionKey)},this.onAdSkipped=function(e){v.onCustomEvent(e)},this.onAdError=function(e){v.onCustomEvent(e)},this.onSeek=function(e){v.isSessionActive()&&(v.trackSeekStart(e.seekTarget),v.onPlaybackStateChanged(e))},this.onSeeked=function(e){v.isSessionActive()&&(v.trackSeekEnd(),v.onPlaybackStateChanged(e))},this.onTimeShift=function(e){v.isSessionActive()&&(v.trackSeekStart(-1),v.onPlaybackStateChanged(e))},this.onTimeShifted=function(e){v.isSessionActive()&&(v.trackSeekEnd(),v.onPlaybackStateChanged(e))},this.onError=function(e){v.isSessionActive()||v.sessionEndedExternally||v.internalInitializeSession(),v.reportPlaybackDeficiency(String(e.code)+" "+e.name,Conviva.Client.ErrorSeverity.FATAL)},this.onSourceUnloaded=function(e){v.isAd||v.internalEndSession(e)},this.onDestroy=function(e){v.destroy(e)},this.onAdBreakStarted=function(e){if(e.adBreak.scheduleTime===1/0)return v.debugLog("[ ConvivaAnalytics ] detected post-roll ad ... Ending session"),void v.onPlaybackFinished({timestamp:Date.now(),type:v.events.PlaybackFinished});v.isSessionActive()?v.trackAdBreakStarted(e):v.adBreakStartedToFire=e},"undefined"!=typeof Conviva)if(t.getSource())console.error("Bitmovin Conviva integration must be instantiated before calling player.load()");else{this.player=t,this.events=t.exports.PlayerEvent,this.handlers=new f(t),this.config=a,this.config.debugLoggingEnabled=this.config.debugLoggingEnabled||!1,this.logger=new o.Html5Logging,this.sessionKey=Conviva.Client.NO_SESSION_KEY,this.isAd=!1;var p=new Conviva.SystemInterface(new l.Html5Time,new d.Html5Timer,new i.Html5Http,new r.Html5Storage,new s.Html5Metadata,this.logger),y=new Conviva.SystemSettings;this.systemFactory=new Conviva.SystemFactory(p,y);var g=new Conviva.ClientSettings(n);a.gatewayUrl&&(g.gatewayUrl=a.gatewayUrl),this.client=new Conviva.Client(g,this.systemFactory),this.contentMetadataBuilder=new u.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 e.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}},e.prototype.endSession=function(){this.isSessionActive()&&(this.internalEndSession(),this.sessionEndedExternally=!0)},e.prototype.sendCustomApplicationEvent=function(e,t){void 0===t&&(t={}),this.client.sendCustomEvent(Conviva.Client.NO_SESSION_KEY,e,t)},e.prototype.sendCustomPlaybackEvent=function(e,t){void 0===t&&(t={}),this.isSessionActive()?this.client.sendCustomEvent(this.sessionKey,e,t):this.logger.consoleLog("cannot send playback event, no active monitoring session",Conviva.SystemSettings.LogLevel.WARNING)},e.prototype.updateContentMetadata=function(e){this.contentMetadataBuilder.setOverrides(e),this.isSessionActive()?(this.buildContentMetadata(),this.updateSession()):this.logger.consoleLog("[ ConvivaAnalytics ] no active session; Don't propagate content metadata to conviva.",Conviva.SystemSettings.LogLevel.WARNING)},e.prototype.reportPlaybackDeficiency=function(e,t,n){void 0===n&&(n=!0),this.isSessionActive()&&(this.client.reportError(this.sessionKey,e,t),n&&this.internalEndSession())},e.prototype.pauseTracking=function(){this.client.adStart(this.sessionKey,Conviva.Client.AdStream.SEPARATE,Conviva.Client.AdPlayer.SEPARATE,Conviva.Client.AdPosition.PREROLL),this.client.detachPlayer(this.sessionKey),this.debugLog("Tracking paused.")},e.prototype.resumeTracking=function(){this.client.attachPlayer(this.sessionKey,this.playerStateManager),this.client.adEnd(this.sessionKey),this.debugLog("Tracking resumed.")},e.prototype.release=function(){this.destroy()},e.prototype.destroy=function(e){this.unregisterPlayerEvents(),this.internalEndSession(e),this.client.release(),this.systemFactory.release()},e.prototype.debugLog=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.config.debugLoggingEnabled&&console.log.apply(console,arguments)},e.prototype.getUrlFromSource=function(e){switch(this.player.getStreamType()){case"dash":return e.dash;case"hls":return e.hls;case"progressive":return Array.isArray(e.progressive)?e.progressive[0].url:e.progressive}},e.prototype.internalInitializeSession=function(){this.playerStateManager=this.client.getPlayerStateManager(),this.playerStateManager.setPlayerType("Bitmovin Player"),this.playerStateManager.setPlayerVersion(this.player.version),this.buildContentMetadata(),this.sessionKey=this.client.createSession(this.contentMetadataBuilder.build()),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.playerStateManager.setPlayerState(Conviva.PlayerStateManager.PlayerState.STOPPED),this.client.attachPlayer(this.sessionKey,this.playerStateManager),this.lastSeenBitrate&&this.playerStateManager.setBitrateKbps(this.lastSeenBitrate)},e.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:g.getAutoplayConfig(this.player)+"",preload:g.getPreloadConfig(this.player)+"",integrationVersion:e.VERSION};var t=this.player.getSource();t&&this.buildSourceRelatedMetadata(t)},e.prototype.buildSourceRelatedMetadata=function(e){this.contentMetadataBuilder.assetName=this.getAssetNameFromSource(e),this.contentMetadataBuilder.viewerId=this.contentMetadataBuilder.viewerId,this.contentMetadataBuilder.custom=a({},this.contentMetadataBuilder.custom,{playerType:this.player.getPlayerType(),streamType:this.player.getStreamType(),vrContentType:e.vr&&e.vr.contentType}),this.contentMetadataBuilder.streamUrl=this.getUrlFromSource(e)},e.prototype.updateSession=function(){this.isSessionActive()&&this.client.updateContentMetadata(this.sessionKey,this.contentMetadataBuilder.build())},e.prototype.getAssetNameFromSource=function(e){var t=e.title;return t||"Untitled (no source.title set)"},e.prototype.isSessionActive=function(){return this.sessionKey!==Conviva.Client.NO_SESSION_KEY},e.prototype.mapAdPosition=function(e){return e.scheduleTime<=0?Conviva.Client.AdPosition.PREROLL:e.scheduleTime>=this.player.getDuration()?Conviva.Client.AdPosition.POSTROLL:Conviva.Client.AdPosition.MIDROLL},e.prototype.trackSeekStart=function(e){this.playerStateManager.setPlayerSeekStart(Math.round(e))},e.prototype.trackSeekEnd=function(){this.playerStateManager.setPlayerSeekEnd()},e.prototype.registerPlayerEvents=function(){var e=this.handlers;e.add(this.events.SourceLoaded,this.onSourceLoaded),e.add(this.events.Play,this.onPlay),e.add(this.events.Playing,this.onPlaying),e.add(this.events.Paused,this.onPlaybackStateChanged),e.add(this.events.StallStarted,this.onPlaybackStateChanged),e.add(this.events.StallEnded,this.onPlaybackStateChanged),e.add(this.events.PlaybackFinished,this.onPlaybackFinished),e.add(this.events.VideoPlaybackQualityChanged,this.onVideoQualityChanged),e.add(this.events.AudioPlaybackQualityChanged,this.onCustomEvent),e.add(this.events.Muted,this.onCustomEvent),e.add(this.events.Unmuted,this.onCustomEvent),e.add(this.events.ViewModeChanged,this.onCustomEvent),e.add(this.events.CastStarted,this.onCustomEvent),e.add(this.events.CastStopped,this.onCustomEvent),e.add(this.events.AdBreakStarted,this.onAdBreakStarted),e.add(this.events.AdBreakFinished,this.onAdBreakFinished),e.add(this.events.AdSkipped,this.onAdSkipped),e.add(this.events.AdError,this.onAdError),e.add(this.events.SourceUnloaded,this.onSourceUnloaded),e.add(this.events.Error,this.onError),e.add(this.events.Destroy,this.onDestroy),e.add(this.events.Seek,this.onSeek),e.add(this.events.Seeked,this.onSeeked),e.add(this.events.TimeShift,this.onTimeShift),e.add(this.events.TimeShifted,this.onTimeShifted)},e.prototype.unregisterPlayerEvents=function(){this.handlers.clear()},Object.defineProperty(e,"version",{get:function(){return e.VERSION},enumerable:!0,configurable:!0}),e.VERSION="3.0.2",e.STALL_TRACKING_DELAY_MS=100,e}();t.ConvivaAnalytics=p;var y,h,g=function(){function e(){}return e.getAutoplayConfig=function(t){var n=t.getConfig();return n.playback&&void 0!==n.playback.autoplay?n.playback.autoplay:e.AUTOPLAY_DEFAULT_CONFIG},e.getPreloadConfig=function(e){var t=e.getConfig();if(v.BrowserUtils.isMobile()){if(t.adaptation&&t.adaptation.mobile&&void 0!==t.adaptation.mobile.preload)return t.adaptation.mobile.preload}else if(t.adaptation&&t.adaptation.desktop&&void 0!==t.adaptation.desktop.preload)return t.adaptation.desktop.preload;return t.adaptation&&void 0!==t.adaptation.preload?t.adaptation.preload:!e.isLive()},e.AUTOPLAY_DEFAULT_CONFIG=!1,e}(),f=function(){function e(e){this.player=e,this.eventHandlers={}}return e.prototype.add=function(e,t){this.player.on(e,t),this.eventHandlers[e]||(this.eventHandlers[e]=[]),this.eventHandlers[e].push(t)},e.prototype.remove=function(e,t){this.player.off(e,t),this.eventHandlers[e]&&y.remove(this.eventHandlers[e],t)},e.prototype.clear=function(){for(var e in this.eventHandlers)for(var t=0,n=this.eventHandlers[e];t<n.length;t++){var a=n[t];this.remove(e,a)}},e}();!function(e){e.remove=function(e,t){var n=e.indexOf(t);return n>-1?e.splice(n,1)[0]:null}}(y||(y={})),function(e){e.flatten=function(e,t){void 0===t&&(t="");var n={};return n}}(h||(h={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.prototype.makeRequest=function(e,t,n,a,i,o){return this.makeRequestStandard.apply(this,arguments)},e.prototype.release=function(){},e.prototype.makeRequestStandard=function(e,t,n,a,i,o){var s=new XMLHttpRequest;return s.open(e,t,!0),a&&s.overrideMimeType&&s.overrideMimeType(a),a&&s.setRequestHeader&&s.setRequestHeader("Content-Type",a),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(n),null},e}();t.Html5Http=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.prototype.consoleLog=function(e,t){"undefined"!=typeof console&&(console.log&&t===Conviva.SystemSettings.LogLevel.DEBUG||t===Conviva.SystemSettings.LogLevel.INFO?console.log(e):console.warn&&t===Conviva.SystemSettings.LogLevel.WARNING?console.warn(e):console.error&&t===Conviva.SystemSettings.LogLevel.ERROR&&console.error(e))},e.prototype.release=function(){},e}();t.Html5Logging=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.prototype.getBrowserName=function(){return null},e.prototype.getBrowserVersion=function(){return null},e.prototype.getDeviceBrand=function(){return null},e.prototype.getDeviceManufacturer=function(){return null},e.prototype.getDeviceModel=function(){return null},e.prototype.getDeviceType=function(){return null},e.prototype.getDeviceVersion=function(){return null},e.prototype.getFrameworkName=function(){return"HTML5"},e.prototype.getFrameworkVersion=function(){return null},e.prototype.getOperatingSystemName=function(){return null},e.prototype.getOperatingSystemVersion=function(){return null},e.prototype.getDeviceCategory=function(){return null},e.prototype.release=function(){},e}();t.Html5Metadata=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.prototype.saveData=function(e,t,n,a){var i=e+"."+t;try{localStorage.setItem(i,n),a(!0,null)}catch(e){a(!1,e.toString())}},e.prototype.loadData=function(e,t,n){var a=e+"."+t;try{n(!0,localStorage.getItem(a))}catch(e){n(!1,e.toString())}},e.prototype.release=function(){},e}();t.Html5Storage=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.prototype.getEpochTimeMs=function(){return(new Date).getTime()},e.prototype.release=function(){},e}();t.Html5Time=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.prototype.createTimer=function(e,t,n){var a=setInterval(e,t);return function(){-1!==a&&(clearInterval(a),a=-1)}},e.prototype.release=function(){},e}();t.Html5Timer=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t,n){void 0===n&&(n=!1),this.delay=e,this.callback=t,this.repeat=n,this.timeoutOrIntervalId=0}return e.prototype.start=function(){return this.reset(),this},e.prototype.clear=function(){this.clearInternal()},e.prototype.reset=function(){this.clearInternal(),this.repeat?this.timeoutOrIntervalId=setInterval(this.callback,this.delay):this.timeoutOrIntervalId=setTimeout(this.callback,this.delay)},e.prototype.clearInternal=function(){this.repeat?clearInterval(this.timeoutOrIntervalId):clearTimeout(this.timeoutOrIntervalId)},e}();t.Timeout=a},function(e,t,n){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){this.metadataOverrides={},this.metadata={},this.playbackStarted=!1,this.logger=e,this.contentMetadata=new Conviva.ContentMetadata}return e.prototype.setOverrides=function(e){this.playbackStarted&&this.logger.consoleLog("[ Conviva Analytics ] Playback has started. Only some metadata attributes will be updated",Conviva.SystemSettings.LogLevel.WARNING),this.metadataOverrides=e},e.prototype.setPlaybackStarted=function(e){this.playbackStarted=e},e.prototype.build=function(){return 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.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,this.contentMetadata},Object.defineProperty(e.prototype,"assetName",{get:function(){return this.metadataOverrides.assetName||this.metadata.assetName},set:function(e){this.metadata.assetName=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewerId",{get:function(){return this.metadataOverrides.viewerId||this.metadata.viewerId},set:function(e){this.metadata.viewerId=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"streamType",{set:function(e){this.metadata.streamType=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"applicationName",{set:function(e){this.metadata.applicationName=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"custom",{get:function(){return a({},this.metadataOverrides.custom,this.metadata.custom)},set:function(e){this.metadata.custom=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"duration",{set:function(e){this.metadata.duration=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"encodedFrameRate",{set:function(e){this.metadata.encodedFrameRate=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultResource",{set:function(e){this.metadata.defaultResource=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"streamUrl",{set:function(e){this.metadata.streamUrl=e},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this.metadataOverrides={},this.metadata={},this.playbackStarted=!1,this.contentMetadata=new Conviva.ContentMetadata},e}();t.ContentMetadataBuilder=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.isMobile=function(){var e=/Android/i.test(navigator.userAgent),t=/IEMobile/i.test(navigator.userAgent),n=/Windows Phone 10.0/i.test(navigator.userAgent),a=/Safari/i.test(navigator.userAgent)&&/Mobile/i.test(navigator.userAgent);return e||t||n||a},e}();t.BrowserUtils=a}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("bitmovin-player-analytics-conviva",[],t):"object"==typeof exports?exports["bitmovin-player-analytics-conviva"]=t():(e.bitmovin=e.bitmovin||{},e.bitmovin.player=e.bitmovin.player||{},e.bitmovin.player.analytics=t())}(window,function(){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(a,i,function(t){return e[t]}.bind(null,i));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1);t.ConvivaAnalytics=a.ConvivaAnalytics},function(e,t,n){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(3),s=n(4),r=n(5),l=n(6),d=n(7),c=n(8),u=n(9),v=n(10),y=function(){function e(t,n,a){void 0===a&&(a={});var v=this;if(this.stallTrackingTimout=new c.Timeout(e.STALL_TRACKING_DELAY_MS,function(){v.playerStateManager.setPlayerState(Conviva.PlayerStateManager.PlayerState.BUFFERING)}),this.sessionEndedExternally=!1,this.internalEndSession=function(e){v.debugLog("[ ConvivaAnalytics ] end session",v.sessionKey,e),v.client.detachPlayer(v.sessionKey),v.client.cleanupSession(v.sessionKey),v.client.releasePlayerStateManager(v.playerStateManager),v.sessionKey=Conviva.Client.NO_SESSION_KEY,v.contentMetadataBuilder.reset(),v.lastSeenBitrate=null},this.onPlaybackStateChanged=function(e){if(!v.isAd&&v.isSessionActive()){var t;switch(e.type){case v.events.Play:case v.events.Seek:case v.events.TimeShift:v.stallTrackingTimout.start();break;case v.events.StallStarted:v.stallTrackingTimout.clear(),t=Conviva.PlayerStateManager.PlayerState.BUFFERING;break;case v.events.Playing:v.stallTrackingTimout.clear(),v.adBreakStartedToFire&&(v.trackAdBreakStarted(v.adBreakStartedToFire),v.adBreakStartedToFire=null),t=Conviva.PlayerStateManager.PlayerState.PLAYING;break;case v.events.Paused:v.stallTrackingTimout.clear(),t=Conviva.PlayerStateManager.PlayerState.PAUSED;break;case v.events.Seeked:case v.events.TimeShifted:case v.events.StallEnded:v.stallTrackingTimout.clear(),t=v.player.isPlaying()?Conviva.PlayerStateManager.PlayerState.PLAYING:Conviva.PlayerStateManager.PlayerState.PAUSED;break;case v.events.PlaybackFinished:v.stallTrackingTimout.clear(),t=Conviva.PlayerStateManager.PlayerState.STOPPED}t&&(v.debugLog("[ ConvivaAnalytics ] report playback state",t),v.playerStateManager.setPlayerState(t))}},this.onSourceLoaded=function(e){v.isSessionActive()&&(v.buildSourceRelatedMetadata(v.player.getSource()),v.updateSession())},this.onPlay=function(e){v.debugLog("[ Player Event ] play",e),v.isAd||(v.isSessionActive()||v.sessionEndedExternally||v.internalInitializeSession(),v.onPlaybackStateChanged(e))},this.onPlaying=function(e){v.contentMetadataBuilder.setPlaybackStarted(!0),v.debugLog("[ Player Event ] playing",e),v.updateSession(),v.onPlaybackStateChanged(e)},this.onPlaybackFinished=function(e){v.debugLog("[ Player Event ] playback finished",e),v.isSessionActive()&&(v.onPlaybackStateChanged(e),v.internalEndSession(e))},this.onVideoQualityChanged=function(e){var t=Math.round(e.targetQuality.bitrate/1e3);v.isSessionActive()?(v.lastSeenBitrate=null,v.playerStateManager.setBitrateKbps(t)):v.lastSeenBitrate=t},this.onCustomEvent=function(e){if(v.isSessionActive()){var t=h.flatten(e);v.sendCustomPlaybackEvent(e.type,t)}else v.debugLog("skip custom event, no session existing",e)},this.trackAdBreakStarted=function(e){v.debugLog("[ ConvivaAnalytics ] adbreak started",e),v.isAd=!0;var t=v.mapAdPosition(e.adBreak);v.isSessionActive()&&v.client.adStart(v.sessionKey,Conviva.Client.AdStream.SEPARATE,Conviva.Client.AdPlayer.CONTENT,t)},this.onAdBreakFinished=function(e){v.debugLog("[ ConvivaAnalytics ] adbreak finished",e),v.isAd=!1,v.isSessionActive()&&v.client.adEnd(v.sessionKey)},this.onAdSkipped=function(e){v.onCustomEvent(e)},this.onAdError=function(e){v.onCustomEvent(e)},this.onSeek=function(e){v.isSessionActive()&&(v.trackSeekStart(e.seekTarget),v.onPlaybackStateChanged(e))},this.onSeeked=function(e){v.isSessionActive()&&(v.trackSeekEnd(),v.onPlaybackStateChanged(e))},this.onTimeShift=function(e){v.isSessionActive()&&(v.trackSeekStart(-1),v.onPlaybackStateChanged(e))},this.onTimeShifted=function(e){v.isSessionActive()&&(v.trackSeekEnd(),v.onPlaybackStateChanged(e))},this.onError=function(e){v.isSessionActive()||v.sessionEndedExternally||v.internalInitializeSession(),v.reportPlaybackDeficiency(String(e.code)+" "+e.name,Conviva.Client.ErrorSeverity.FATAL)},this.onSourceUnloaded=function(e){v.isAd||v.internalEndSession(e)},this.onDestroy=function(e){v.destroy(e)},this.onAdBreakStarted=function(e){if(e.adBreak.scheduleTime===1/0)return v.debugLog("[ ConvivaAnalytics ] detected post-roll ad ... Ending session"),void v.onPlaybackFinished({timestamp:Date.now(),type:v.events.PlaybackFinished});v.isSessionActive()?v.trackAdBreakStarted(e):v.adBreakStartedToFire=e},"undefined"!=typeof Conviva)if(t.getSource())console.error("Bitmovin Conviva integration must be instantiated before calling player.load()");else{this.player=t,this.events=t.exports.PlayerEvent,this.handlers=new f(t),this.config=a,this.config.debugLoggingEnabled=this.config.debugLoggingEnabled||!1,this.config.deviceCategory=this.config.deviceCategory||Conviva.Client.DeviceCategory.WEB,this.logger=new o.Html5Logging,this.sessionKey=Conviva.Client.NO_SESSION_KEY,this.isAd=!1;var y={deviceCategory:this.config.deviceCategory},p=new Conviva.SystemInterface(new l.Html5Time,new d.Html5Timer,new i.Html5Http,new r.Html5Storage,new s.Html5Metadata(y),this.logger),g=new Conviva.SystemSettings;this.systemFactory=new Conviva.SystemFactory(p,g);var S=new Conviva.ClientSettings(n);a.gatewayUrl&&(S.gatewayUrl=a.gatewayUrl),this.client=new Conviva.Client(S,this.systemFactory),this.contentMetadataBuilder=new u.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 e.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}},e.prototype.endSession=function(){this.isSessionActive()&&(this.internalEndSession(),this.sessionEndedExternally=!0)},e.prototype.sendCustomApplicationEvent=function(e,t){void 0===t&&(t={}),this.client.sendCustomEvent(Conviva.Client.NO_SESSION_KEY,e,t)},e.prototype.sendCustomPlaybackEvent=function(e,t){void 0===t&&(t={}),this.isSessionActive()?this.client.sendCustomEvent(this.sessionKey,e,t):this.logger.consoleLog("cannot send playback event, no active monitoring session",Conviva.SystemSettings.LogLevel.WARNING)},e.prototype.updateContentMetadata=function(e){this.contentMetadataBuilder.setOverrides(e),this.isSessionActive()?(this.buildContentMetadata(),this.updateSession()):this.logger.consoleLog("[ ConvivaAnalytics ] no active session; Don't propagate content metadata to conviva.",Conviva.SystemSettings.LogLevel.WARNING)},e.prototype.reportPlaybackDeficiency=function(e,t,n){void 0===n&&(n=!0),this.isSessionActive()&&(this.client.reportError(this.sessionKey,e,t),n&&this.internalEndSession())},e.prototype.pauseTracking=function(){this.client.adStart(this.sessionKey,Conviva.Client.AdStream.SEPARATE,Conviva.Client.AdPlayer.SEPARATE,Conviva.Client.AdPosition.PREROLL),this.client.detachPlayer(this.sessionKey),this.debugLog("Tracking paused.")},e.prototype.resumeTracking=function(){this.client.attachPlayer(this.sessionKey,this.playerStateManager),this.client.adEnd(this.sessionKey),this.debugLog("Tracking resumed.")},e.prototype.release=function(){this.destroy()},e.prototype.destroy=function(e){this.unregisterPlayerEvents(),this.internalEndSession(e),this.client.release(),this.systemFactory.release()},e.prototype.debugLog=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.config.debugLoggingEnabled&&console.log.apply(console,arguments)},e.prototype.getUrlFromSource=function(e){switch(this.player.getStreamType()){case"dash":return e.dash;case"hls":return e.hls;case"progressive":return Array.isArray(e.progressive)?e.progressive[0].url:e.progressive}},e.prototype.internalInitializeSession=function(){this.playerStateManager=this.client.getPlayerStateManager(),this.playerStateManager.setPlayerType("Bitmovin Player"),this.playerStateManager.setPlayerVersion(this.player.version),this.buildContentMetadata(),this.sessionKey=this.client.createSession(this.contentMetadataBuilder.build()),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.playerStateManager.setPlayerState(Conviva.PlayerStateManager.PlayerState.STOPPED),this.client.attachPlayer(this.sessionKey,this.playerStateManager),this.lastSeenBitrate&&this.playerStateManager.setBitrateKbps(this.lastSeenBitrate)},e.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:g.getAutoplayConfig(this.player)+"",preload:g.getPreloadConfig(this.player)+"",integrationVersion:e.VERSION};var t=this.player.getSource();t&&this.buildSourceRelatedMetadata(t)},e.prototype.buildSourceRelatedMetadata=function(e){this.contentMetadataBuilder.assetName=this.getAssetNameFromSource(e),this.contentMetadataBuilder.viewerId=this.contentMetadataBuilder.viewerId,this.contentMetadataBuilder.custom=a({},this.contentMetadataBuilder.custom,{playerType:this.player.getPlayerType(),streamType:this.player.getStreamType(),vrContentType:e.vr&&e.vr.contentType}),this.contentMetadataBuilder.streamUrl=this.getUrlFromSource(e)},e.prototype.updateSession=function(){this.isSessionActive()&&this.client.updateContentMetadata(this.sessionKey,this.contentMetadataBuilder.build())},e.prototype.getAssetNameFromSource=function(e){var t=e.title;return t||"Untitled (no source.title set)"},e.prototype.isSessionActive=function(){return this.sessionKey!==Conviva.Client.NO_SESSION_KEY},e.prototype.mapAdPosition=function(e){return e.scheduleTime<=0?Conviva.Client.AdPosition.PREROLL:e.scheduleTime>=this.player.getDuration()?Conviva.Client.AdPosition.POSTROLL:Conviva.Client.AdPosition.MIDROLL},e.prototype.trackSeekStart=function(e){this.playerStateManager.setPlayerSeekStart(Math.round(e))},e.prototype.trackSeekEnd=function(){this.playerStateManager.setPlayerSeekEnd()},e.prototype.registerPlayerEvents=function(){var e=this.handlers;e.add(this.events.SourceLoaded,this.onSourceLoaded),e.add(this.events.Play,this.onPlay),e.add(this.events.Playing,this.onPlaying),e.add(this.events.Paused,this.onPlaybackStateChanged),e.add(this.events.StallStarted,this.onPlaybackStateChanged),e.add(this.events.StallEnded,this.onPlaybackStateChanged),e.add(this.events.PlaybackFinished,this.onPlaybackFinished),e.add(this.events.VideoPlaybackQualityChanged,this.onVideoQualityChanged),e.add(this.events.AudioPlaybackQualityChanged,this.onCustomEvent),e.add(this.events.Muted,this.onCustomEvent),e.add(this.events.Unmuted,this.onCustomEvent),e.add(this.events.ViewModeChanged,this.onCustomEvent),e.add(this.events.CastStarted,this.onCustomEvent),e.add(this.events.CastStopped,this.onCustomEvent),e.add(this.events.AdBreakStarted,this.onAdBreakStarted),e.add(this.events.AdBreakFinished,this.onAdBreakFinished),e.add(this.events.AdSkipped,this.onAdSkipped),e.add(this.events.AdError,this.onAdError),e.add(this.events.SourceUnloaded,this.onSourceUnloaded),e.add(this.events.Error,this.onError),e.add(this.events.Destroy,this.onDestroy),e.add(this.events.Seek,this.onSeek),e.add(this.events.Seeked,this.onSeeked),e.add(this.events.TimeShift,this.onTimeShift),e.add(this.events.TimeShifted,this.onTimeShifted)},e.prototype.unregisterPlayerEvents=function(){this.handlers.clear()},Object.defineProperty(e,"version",{get:function(){return e.VERSION},enumerable:!0,configurable:!0}),e.VERSION="3.0.3",e.STALL_TRACKING_DELAY_MS=100,e}();t.ConvivaAnalytics=y;var p,h,g=function(){function e(){}return e.getAutoplayConfig=function(t){var n=t.getConfig();return n.playback&&void 0!==n.playback.autoplay?n.playback.autoplay:e.AUTOPLAY_DEFAULT_CONFIG},e.getPreloadConfig=function(e){var t=e.getConfig();if(v.BrowserUtils.isMobile()){if(t.adaptation&&t.adaptation.mobile&&void 0!==t.adaptation.mobile.preload)return t.adaptation.mobile.preload}else if(t.adaptation&&t.adaptation.desktop&&void 0!==t.adaptation.desktop.preload)return t.adaptation.desktop.preload;return t.adaptation&&void 0!==t.adaptation.preload?t.adaptation.preload:!e.isLive()},e.AUTOPLAY_DEFAULT_CONFIG=!1,e}(),f=function(){function e(e){this.player=e,this.eventHandlers={}}return e.prototype.add=function(e,t){this.player.on(e,t),this.eventHandlers[e]||(this.eventHandlers[e]=[]),this.eventHandlers[e].push(t)},e.prototype.remove=function(e,t){this.player.off(e,t),this.eventHandlers[e]&&p.remove(this.eventHandlers[e],t)},e.prototype.clear=function(){for(var e in this.eventHandlers)for(var t=0,n=this.eventHandlers[e];t<n.length;t++){var a=n[t];this.remove(e,a)}},e}();!function(e){e.remove=function(e,t){var n=e.indexOf(t);return n>-1?e.splice(n,1)[0]:null}}(p||(p={})),function(e){e.flatten=function(e,t){void 0===t&&(t="");var n={};return n}}(h||(h={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.prototype.makeRequest=function(e,t,n,a,i,o){return this.makeRequestStandard.apply(this,arguments)},e.prototype.release=function(){},e.prototype.makeRequestStandard=function(e,t,n,a,i,o){var s=new XMLHttpRequest;return s.open(e,t,!0),a&&s.overrideMimeType&&s.overrideMimeType(a),a&&s.setRequestHeader&&s.setRequestHeader("Content-Type",a),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(n),null},e}();t.Html5Http=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.prototype.consoleLog=function(e,t){"undefined"!=typeof console&&(console.log&&t===Conviva.SystemSettings.LogLevel.DEBUG||t===Conviva.SystemSettings.LogLevel.INFO?console.log(e):console.warn&&t===Conviva.SystemSettings.LogLevel.WARNING?console.warn(e):console.error&&t===Conviva.SystemSettings.LogLevel.ERROR&&console.error(e))},e.prototype.release=function(){},e}();t.Html5Logging=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e){this.metadata=e}return e.prototype.getBrowserName=function(){return null},e.prototype.getBrowserVersion=function(){return null},e.prototype.getDeviceBrand=function(){return null},e.prototype.getDeviceManufacturer=function(){return null},e.prototype.getDeviceModel=function(){return null},e.prototype.getDeviceType=function(){return null},e.prototype.getDeviceVersion=function(){return null},e.prototype.getFrameworkName=function(){return"HTML5"},e.prototype.getFrameworkVersion=function(){return null},e.prototype.getOperatingSystemName=function(){return null},e.prototype.getOperatingSystemVersion=function(){return null},e.prototype.getDeviceCategory=function(){return this.metadata.deviceCategory},e.prototype.release=function(){},e}();t.Html5Metadata=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.prototype.saveData=function(e,t,n,a){var i=e+"."+t;try{localStorage.setItem(i,n),a(!0,null)}catch(e){a(!1,e.toString())}},e.prototype.loadData=function(e,t,n){var a=e+"."+t;try{n(!0,localStorage.getItem(a))}catch(e){n(!1,e.toString())}},e.prototype.release=function(){},e}();t.Html5Storage=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.prototype.getEpochTimeMs=function(){return(new Date).getTime()},e.prototype.release=function(){},e}();t.Html5Time=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.prototype.createTimer=function(e,t,n){var a=setInterval(e,t);return function(){-1!==a&&(clearInterval(a),a=-1)}},e.prototype.release=function(){},e}();t.Html5Timer=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t,n){void 0===n&&(n=!1),this.delay=e,this.callback=t,this.repeat=n,this.timeoutOrIntervalId=0}return e.prototype.start=function(){return this.reset(),this},e.prototype.clear=function(){this.clearInternal()},e.prototype.reset=function(){this.clearInternal(),this.repeat?this.timeoutOrIntervalId=setInterval(this.callback,this.delay):this.timeoutOrIntervalId=setTimeout(this.callback,this.delay)},e.prototype.clearInternal=function(){this.repeat?clearInterval(this.timeoutOrIntervalId):clearTimeout(this.timeoutOrIntervalId)},e}();t.Timeout=a},function(e,t,n){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){this.metadataOverrides={},this.metadata={},this.playbackStarted=!1,this.logger=e,this.contentMetadata=new Conviva.ContentMetadata}return e.prototype.setOverrides=function(e){this.playbackStarted&&this.logger.consoleLog("[ Conviva Analytics ] Playback has started. Only some metadata attributes will be updated",Conviva.SystemSettings.LogLevel.WARNING),this.metadataOverrides=e},e.prototype.setPlaybackStarted=function(e){this.playbackStarted=e},e.prototype.build=function(){return 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.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,this.contentMetadata},Object.defineProperty(e.prototype,"assetName",{get:function(){return this.metadataOverrides.assetName||this.metadata.assetName},set:function(e){this.metadata.assetName=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewerId",{get:function(){return this.metadataOverrides.viewerId||this.metadata.viewerId},set:function(e){this.metadata.viewerId=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"streamType",{set:function(e){this.metadata.streamType=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"applicationName",{set:function(e){this.metadata.applicationName=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"custom",{get:function(){return a({},this.metadataOverrides.custom,this.metadata.custom)},set:function(e){this.metadata.custom=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"duration",{set:function(e){this.metadata.duration=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"encodedFrameRate",{set:function(e){this.metadata.encodedFrameRate=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultResource",{set:function(e){this.metadata.defaultResource=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"streamUrl",{set:function(e){this.metadata.streamUrl=e},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this.metadataOverrides={},this.metadata={},this.playbackStarted=!1,this.contentMetadata=new Conviva.ContentMetadata},e}();t.ContentMetadataBuilder=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.isMobile=function(){var e=/Android/i.test(navigator.userAgent),t=/IEMobile/i.test(navigator.userAgent),n=/Windows Phone 10.0/i.test(navigator.userAgent),a=/Safari/i.test(navigator.userAgent)&&/Mobile/i.test(navigator.userAgent);return e||t||n||a},e}();t.BrowserUtils=a}])}); | ||
//# sourceMappingURL=bitmovin-player-analytics-conviva.js.map |
@@ -14,2 +14,7 @@ import { PlayerAPI } from 'bitmovin-player'; | ||
gatewayUrl?: string; | ||
/** | ||
* Option to set the Conviva Device Category, which is used to assist with | ||
* user agent string parsing by the Conviva SDK. (default: WEB) | ||
*/ | ||
deviceCategory?: Conviva.Client.DeviceCategory; | ||
} | ||
@@ -16,0 +21,0 @@ export interface EventAttributes { |
@@ -273,6 +273,10 @@ "use strict"; | ||
this.config.debugLoggingEnabled = this.config.debugLoggingEnabled || false; | ||
this.config.deviceCategory = this.config.deviceCategory || Conviva.Client.DeviceCategory.WEB; | ||
this.logger = new Html5Logging_1.Html5Logging(); | ||
this.sessionKey = Conviva.Client.NO_SESSION_KEY; | ||
this.isAd = false; | ||
var systemInterface = new Conviva.SystemInterface(new Html5Time_1.Html5Time(), new Html5Timer_1.Html5Timer(), new Html5Http_1.Html5Http(), new Html5Storage_1.Html5Storage(), new Html5Metadata_1.Html5Metadata(), this.logger); | ||
var deviceMetadata = { | ||
deviceCategory: this.config.deviceCategory, | ||
}; | ||
var systemInterface = new Conviva.SystemInterface(new Html5Time_1.Html5Time(), new Html5Timer_1.Html5Timer(), new Html5Http_1.Html5Http(), new Html5Storage_1.Html5Storage(), new Html5Metadata_1.Html5Metadata(deviceMetadata), this.logger); | ||
var systemSettings = new Conviva.SystemSettings(); | ||
@@ -279,0 +283,0 @@ this.systemFactory = new Conviva.SystemFactory(systemInterface, systemSettings); |
import Client = Conviva.Client; | ||
export interface DeviceMetadata { | ||
deviceCategory: Conviva.Client.DeviceCategory; | ||
} | ||
export declare class Html5Metadata implements Conviva.MetadataInterface { | ||
metadata: DeviceMetadata; | ||
constructor(metadata: DeviceMetadata); | ||
getBrowserName(): string | null; | ||
@@ -4,0 +9,0 @@ getBrowserVersion(): string | null; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Html5Metadata = /** @class */ (function () { | ||
function Html5Metadata() { | ||
function Html5Metadata(metadata) { | ||
this.metadata = metadata; | ||
} | ||
@@ -52,3 +53,3 @@ // Relying on HTTP user agent string parsing on the Conviva Platform. | ||
Html5Metadata.prototype.getDeviceCategory = function () { | ||
return null; | ||
return this.metadata.deviceCategory; | ||
}; | ||
@@ -55,0 +56,0 @@ Html5Metadata.prototype.release = function () { |
{ | ||
"name": "@bitmovin/player-integration-conviva", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Conviva analytics integration for the Bitmovin Player", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -37,2 +37,3 @@ # Bitmovin Player Conviva Analytics Integration | ||
gatewayUrl: 'https://youraccount-test.testonly.conviva.com', // optional, TOUCHSTONE_SERVICE_URL for testing | ||
deviceCategory: Conviva.Client.DeviceCategory.WEB // optional, (default: WEB) | ||
}); | ||
@@ -39,0 +40,0 @@ |
@@ -14,2 +14,3 @@ import { | ||
import { BrowserUtils } from './BrowserUtils'; | ||
import { DeviceMetadata } from './Html5Metadata'; | ||
@@ -28,2 +29,7 @@ type Player = PlayerAPI; | ||
gatewayUrl?: string; | ||
/** | ||
* Option to set the Conviva Device Category, which is used to assist with | ||
* user agent string parsing by the Conviva SDK. (default: WEB) | ||
*/ | ||
deviceCategory?: Conviva.Client.DeviceCategory; | ||
} | ||
@@ -105,2 +111,3 @@ | ||
this.config.debugLoggingEnabled = this.config.debugLoggingEnabled || false; | ||
this.config.deviceCategory = this.config.deviceCategory || Conviva.Client.DeviceCategory.WEB; | ||
@@ -111,2 +118,6 @@ this.logger = new Html5Logging(); | ||
const deviceMetadata: DeviceMetadata = { | ||
deviceCategory: this.config.deviceCategory, | ||
}; | ||
const systemInterface = new Conviva.SystemInterface( | ||
@@ -117,3 +128,3 @@ new Html5Time(), | ||
new Html5Storage(), | ||
new Html5Metadata(), | ||
new Html5Metadata(deviceMetadata), | ||
this.logger, | ||
@@ -120,0 +131,0 @@ ); |
import Client = Conviva.Client; | ||
export interface DeviceMetadata { | ||
deviceCategory: Conviva.Client.DeviceCategory; | ||
} | ||
export class Html5Metadata implements Conviva.MetadataInterface { | ||
metadata: DeviceMetadata; | ||
constructor(metadata: DeviceMetadata) { | ||
this.metadata = metadata; | ||
} | ||
// Relying on HTTP user agent string parsing on the Conviva Platform. | ||
@@ -62,3 +71,3 @@ public getBrowserName(): string | null { | ||
getDeviceCategory(): Conviva.Client.DeviceCategory { | ||
return null; | ||
return this.metadata.deviceCategory; | ||
} | ||
@@ -65,0 +74,0 @@ |
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
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
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
2770
102
0
238798
50