@bitmovin/player-integration-conviva
Advanced tools
Comparing version 3.0.5 to 3.0.6
@@ -7,2 +7,7 @@ # Changelog | ||
## [3.0.6] | ||
### Fixed | ||
- Prefer `window.setInterval()` in `Html5Timer.ts` instead of the NodeJS definition. | ||
## [3.0.5] | ||
@@ -66,2 +71,3 @@ | ||
[3.0.6]: https://github.com/bitmovin/bitmovin-player-analytics-conviva/compare/v3.0.5...v3.0.6 | ||
[3.0.5]: https://github.com/bitmovin/bitmovin-player-analytics-conviva/compare/v3.0.4...v3.0.5 | ||
@@ -68,0 +74,0 @@ [3.0.4]: https://github.com/bitmovin/bitmovin-player-analytics-conviva/compare/v3.0.3...v3.0.4 |
@@ -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),r=n(4),s=n(5),l=n(6),d=n(7),c=n(8),u=n(9),v=n(10),y=n(11),p=n(12),h=n(13),f=function(){function e(t,n,a){void 0===a&&(a={});var y=this;if(this.stallTrackingTimout=new c.Timeout(e.STALL_TRACKING_DELAY_MS,function(){y.playerStateManager.setPlayerState(Conviva.PlayerStateManager.PlayerState.BUFFERING)}),this.sessionEndedExternally=!1,this.internalEndSession=function(e){y.isSessionActive()&&(y.debugLog("[ ConvivaAnalytics ] end session",y.sessionKey,e),y.client.detachPlayer(y.sessionKey),y.client.cleanupSession(y.sessionKey),y.client.releasePlayerStateManager(y.playerStateManager),y.sessionKey=Conviva.Client.NO_SESSION_KEY,y.lastSeenBitrate=null)},this.onPlaybackStateChanged=function(e){if(!y.isAd&&y.isSessionActive()){var t;switch(e.type){case y.events.Play:case y.events.Seek:case y.events.TimeShift:y.stallTrackingTimout.start();break;case y.events.StallStarted:y.stallTrackingTimout.clear(),t=Conviva.PlayerStateManager.PlayerState.BUFFERING;break;case y.events.Playing:y.stallTrackingTimout.clear(),y.adBreakStartedToFire&&(y.trackAdBreakStarted(y.adBreakStartedToFire),y.adBreakStartedToFire=null),t=Conviva.PlayerStateManager.PlayerState.PLAYING;break;case y.events.Paused:y.stallTrackingTimout.clear(),t=Conviva.PlayerStateManager.PlayerState.PAUSED;break;case y.events.Seeked:case y.events.TimeShifted:case y.events.StallEnded:y.stallTrackingTimout.clear(),t=y.player.isPlaying()?Conviva.PlayerStateManager.PlayerState.PLAYING:Conviva.PlayerStateManager.PlayerState.PAUSED;break;case y.events.PlaybackFinished:y.stallTrackingTimout.clear(),t=Conviva.PlayerStateManager.PlayerState.STOPPED}t&&(y.debugLog("[ ConvivaAnalytics ] report playback state",t),y.playerStateManager.setPlayerState(t))}},this.onSourceLoaded=function(e){y.isSessionActive()&&(y.buildSourceRelatedMetadata(y.player.getSource()),y.updateSession())},this.onPlay=function(e){y.debugLog("[ Player Event ] play",e),y.isAd||(y.isSessionActive()||y.sessionEndedExternally||y.internalInitializeSession(),y.onPlaybackStateChanged(e))},this.onPlaying=function(e){y.contentMetadataBuilder.setPlaybackStarted(!0),y.debugLog("[ Player Event ] playing",e),y.updateSession(),y.onPlaybackStateChanged(e)},this.onPlaybackFinished=function(e){y.debugLog("[ Player Event ] playback finished",e),y.isSessionActive()&&(y.onPlaybackStateChanged(e),y.internalEndSession(e),y.resetContentMetadata())},this.onVideoQualityChanged=function(e){var t=Math.round(e.targetQuality.bitrate/1e3);y.isSessionActive()?(y.lastSeenBitrate=null,y.playerStateManager.setBitrateKbps(t)):y.lastSeenBitrate=t},this.onCustomEvent=function(e){if(y.isSessionActive()){var t=v.ObjectUtils.flatten(e);y.sendCustomPlaybackEvent(e.type,t)}else y.debugLog("skip custom event, no session existing",e)},this.trackAdBreakStarted=function(e){y.debugLog("[ ConvivaAnalytics ] adbreak started",e),y.isAd=!0;var t=h.AdBreakHelper.mapAdPosition(e.adBreak,y.player);y.isSessionActive()&&y.client.adStart(y.sessionKey,Conviva.Client.AdStream.SEPARATE,Conviva.Client.AdPlayer.CONTENT,t)},this.onAdBreakFinished=function(e){y.debugLog("[ ConvivaAnalytics ] adbreak finished",e),y.isAd=!1,y.isSessionActive()&&(y.client.adEnd(y.sessionKey),y.playerStateManager.setPlayerState(Conviva.PlayerStateManager.PlayerState.PLAYING))},this.onAdSkipped=function(e){y.onCustomEvent(e)},this.onAdError=function(e){y.onCustomEvent(e)},this.onSeek=function(e){y.isSessionActive()&&(y.trackSeekStart(e.seekTarget),y.onPlaybackStateChanged(e))},this.onSeeked=function(e){y.isSessionActive()&&(y.trackSeekEnd(),y.onPlaybackStateChanged(e))},this.onTimeShift=function(e){y.isSessionActive()&&(y.trackSeekStart(-1),y.onPlaybackStateChanged(e))},this.onTimeShifted=function(e){y.isSessionActive()&&(y.trackSeekEnd(),y.onPlaybackStateChanged(e))},this.onError=function(e){y.isSessionActive()||y.sessionEndedExternally||y.internalInitializeSession(),y.reportPlaybackDeficiency(String(e.code)+" "+e.name,Conviva.Client.ErrorSeverity.FATAL)},this.onSourceUnloaded=function(e){y.isAd||(y.internalEndSession(e),y.resetContentMetadata())},this.onDestroy=function(e){y.destroy(e)},this.onAdBreakStarted=function(e){if(e.adBreak.scheduleTime===1/0)return y.debugLog("[ ConvivaAnalytics ] detected post-roll ad ... Ending session"),void y.onPlaybackFinished({timestamp:Date.now(),type:y.events.PlaybackFinished});y.isSessionActive()?y.trackAdBreakStarted(e):y.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 S(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 p={deviceCategory:this.config.deviceCategory},f=new Conviva.SystemInterface(new l.Html5Time,new d.Html5Timer,new i.Html5Http,new s.Html5Storage,new r.Html5Metadata(p),this.logger),g=new Conviva.SystemSettings;this.systemFactory=new Conviva.SystemFactory(f,g);var m=new Conviva.ClientSettings(n);a.gatewayUrl&&(m.gatewayUrl=a.gatewayUrl),this.client=new Conviva.Client(m,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.resetContentMetadata(),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.internalUpdateContentMetadata(e)},e.prototype.reportPlaybackDeficiency=function(e,t,n){void 0===n&&(n=!0),this.isSessionActive()&&(this.client.reportError(this.sessionKey,e,t),n&&(this.internalEndSession(),this.resetContentMetadata()))},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.internalUpdateContentMetadata=function(e){this.contentMetadataBuilder.setOverrides(e),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)},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.resetContentMetadata=function(){this.contentMetadataBuilder.reset()},e.prototype.isSessionActive=function(){return this.sessionKey!==Conviva.Client.NO_SESSION_KEY},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.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.add(this.events.CastStarted,this.onCustomEvent),e.add(this.events.CastStopped,this.onCustomEvent)},e.prototype.unregisterPlayerEvents=function(){this.handlers.clear()},Object.defineProperty(e,"version",{get:function(){return e.VERSION},enumerable:!0,configurable:!0}),e.VERSION="3.0.5",e.STALL_TRACKING_DELAY_MS=100,e}();t.ConvivaAnalytics=f;var 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(y.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}(),S=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.ArrayUtils.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,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 r=new XMLHttpRequest;return r.open(e,t,!0),a&&r.overrideMimeType&&r.overrideMimeType(a),a&&r.setRequestHeader&&r.setRequestHeader("Content-Type",a),i>0&&(r.timeout=i,r.ontimeout=function(){r.ontimeout=r.onreadystatechange=null,o&&o(!1,"timeout after "+i+" ms")}),r.onreadystatechange=function(){4===r.readyState&&(r.ontimeout=r.onreadystatechange=null,200===r.status?o&&o(!0,r.responseText):o&&o(!1,"http status "+r.status))},r.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=a({},this.metadataOverrides,e)},e.prototype.getOverrides=function(){return this.metadataOverrides},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}),function(e){e.flatten=function(e,t){void 0===t&&(t="");var n={},a=function(e,t){for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];"object"==typeof o?a(o,t+i+"."):n[t+i]=String(o)}};return a(e,t),n}}(t.ObjectUtils||(t.ObjectUtils={}))},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,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.remove=function(e,t){var n=e.indexOf(t);return n>-1?e.splice(n,1)[0]:null}}(t.ArrayUtils||(t.ArrayUtils={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.mapAdPosition=function(e,t){return e.scheduleTime<=0?Conviva.Client.AdPosition.PREROLL:e.scheduleTime>=t.getDuration()?Conviva.Client.AdPosition.POSTROLL:Conviva.Client.AdPosition.MIDROLL},e}();t.AdBreakHelper=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),r=n(4),s=n(5),l=n(6),d=n(7),c=n(8),u=n(9),v=n(10),y=n(11),p=n(12),h=n(13),f=function(){function e(t,n,a){void 0===a&&(a={});var y=this;if(this.stallTrackingTimout=new c.Timeout(e.STALL_TRACKING_DELAY_MS,function(){y.playerStateManager.setPlayerState(Conviva.PlayerStateManager.PlayerState.BUFFERING)}),this.sessionEndedExternally=!1,this.internalEndSession=function(e){y.isSessionActive()&&(y.debugLog("[ ConvivaAnalytics ] end session",y.sessionKey,e),y.client.detachPlayer(y.sessionKey),y.client.cleanupSession(y.sessionKey),y.client.releasePlayerStateManager(y.playerStateManager),y.sessionKey=Conviva.Client.NO_SESSION_KEY,y.lastSeenBitrate=null)},this.onPlaybackStateChanged=function(e){if(!y.isAd&&y.isSessionActive()){var t;switch(e.type){case y.events.Play:case y.events.Seek:case y.events.TimeShift:y.stallTrackingTimout.start();break;case y.events.StallStarted:y.stallTrackingTimout.clear(),t=Conviva.PlayerStateManager.PlayerState.BUFFERING;break;case y.events.Playing:y.stallTrackingTimout.clear(),y.adBreakStartedToFire&&(y.trackAdBreakStarted(y.adBreakStartedToFire),y.adBreakStartedToFire=null),t=Conviva.PlayerStateManager.PlayerState.PLAYING;break;case y.events.Paused:y.stallTrackingTimout.clear(),t=Conviva.PlayerStateManager.PlayerState.PAUSED;break;case y.events.Seeked:case y.events.TimeShifted:case y.events.StallEnded:y.stallTrackingTimout.clear(),t=y.player.isPlaying()?Conviva.PlayerStateManager.PlayerState.PLAYING:Conviva.PlayerStateManager.PlayerState.PAUSED;break;case y.events.PlaybackFinished:y.stallTrackingTimout.clear(),t=Conviva.PlayerStateManager.PlayerState.STOPPED}t&&(y.debugLog("[ ConvivaAnalytics ] report playback state",t),y.playerStateManager.setPlayerState(t))}},this.onSourceLoaded=function(e){y.isSessionActive()&&(y.buildSourceRelatedMetadata(y.player.getSource()),y.updateSession())},this.onPlay=function(e){y.debugLog("[ Player Event ] play",e),y.isAd||(y.isSessionActive()||y.sessionEndedExternally||y.internalInitializeSession(),y.onPlaybackStateChanged(e))},this.onPlaying=function(e){y.contentMetadataBuilder.setPlaybackStarted(!0),y.debugLog("[ Player Event ] playing",e),y.updateSession(),y.onPlaybackStateChanged(e)},this.onPlaybackFinished=function(e){y.debugLog("[ Player Event ] playback finished",e),y.isSessionActive()&&(y.onPlaybackStateChanged(e),y.internalEndSession(e),y.resetContentMetadata())},this.onVideoQualityChanged=function(e){var t=Math.round(e.targetQuality.bitrate/1e3);y.isSessionActive()?(y.lastSeenBitrate=null,y.playerStateManager.setBitrateKbps(t)):y.lastSeenBitrate=t},this.onCustomEvent=function(e){if(y.isSessionActive()){var t=v.ObjectUtils.flatten(e);y.sendCustomPlaybackEvent(e.type,t)}else y.debugLog("skip custom event, no session existing",e)},this.trackAdBreakStarted=function(e){y.debugLog("[ ConvivaAnalytics ] adbreak started",e),y.isAd=!0;var t=h.AdBreakHelper.mapAdPosition(e.adBreak,y.player);y.isSessionActive()&&y.client.adStart(y.sessionKey,Conviva.Client.AdStream.SEPARATE,Conviva.Client.AdPlayer.CONTENT,t)},this.onAdBreakFinished=function(e){y.debugLog("[ ConvivaAnalytics ] adbreak finished",e),y.isAd=!1,y.isSessionActive()&&(y.client.adEnd(y.sessionKey),y.playerStateManager.setPlayerState(Conviva.PlayerStateManager.PlayerState.PLAYING))},this.onAdSkipped=function(e){y.onCustomEvent(e)},this.onAdError=function(e){y.onCustomEvent(e)},this.onSeek=function(e){y.isSessionActive()&&(y.trackSeekStart(e.seekTarget),y.onPlaybackStateChanged(e))},this.onSeeked=function(e){y.isSessionActive()&&(y.trackSeekEnd(),y.onPlaybackStateChanged(e))},this.onTimeShift=function(e){y.isSessionActive()&&(y.trackSeekStart(-1),y.onPlaybackStateChanged(e))},this.onTimeShifted=function(e){y.isSessionActive()&&(y.trackSeekEnd(),y.onPlaybackStateChanged(e))},this.onError=function(e){y.isSessionActive()||y.sessionEndedExternally||y.internalInitializeSession(),y.reportPlaybackDeficiency(String(e.code)+" "+e.name,Conviva.Client.ErrorSeverity.FATAL)},this.onSourceUnloaded=function(e){y.isAd||(y.internalEndSession(e),y.resetContentMetadata())},this.onDestroy=function(e){y.destroy(e)},this.onAdBreakStarted=function(e){if(e.adBreak.scheduleTime===1/0)return y.debugLog("[ ConvivaAnalytics ] detected post-roll ad ... Ending session"),void y.onPlaybackFinished({timestamp:Date.now(),type:y.events.PlaybackFinished});y.isSessionActive()?y.trackAdBreakStarted(e):y.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 S(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 p={deviceCategory:this.config.deviceCategory},f=new Conviva.SystemInterface(new l.Html5Time,new d.Html5Timer,new i.Html5Http,new s.Html5Storage,new r.Html5Metadata(p),this.logger),g=new Conviva.SystemSettings;this.systemFactory=new Conviva.SystemFactory(f,g);var m=new Conviva.ClientSettings(n);a.gatewayUrl&&(m.gatewayUrl=a.gatewayUrl),this.client=new Conviva.Client(m,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.resetContentMetadata(),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.internalUpdateContentMetadata(e)},e.prototype.reportPlaybackDeficiency=function(e,t,n){void 0===n&&(n=!0),this.isSessionActive()&&(this.client.reportError(this.sessionKey,e,t),n&&(this.internalEndSession(),this.resetContentMetadata()))},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.internalUpdateContentMetadata=function(e){this.contentMetadataBuilder.setOverrides(e),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)},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.resetContentMetadata=function(){this.contentMetadataBuilder.reset()},e.prototype.isSessionActive=function(){return this.sessionKey!==Conviva.Client.NO_SESSION_KEY},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.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.add(this.events.CastStarted,this.onCustomEvent),e.add(this.events.CastStopped,this.onCustomEvent)},e.prototype.unregisterPlayerEvents=function(){this.handlers.clear()},Object.defineProperty(e,"version",{get:function(){return e.VERSION},enumerable:!0,configurable:!0}),e.VERSION="3.0.6",e.STALL_TRACKING_DELAY_MS=100,e}();t.ConvivaAnalytics=f;var 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(y.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}(),S=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.ArrayUtils.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,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 r=new XMLHttpRequest;return r.open(e,t,!0),a&&r.overrideMimeType&&r.overrideMimeType(a),a&&r.setRequestHeader&&r.setRequestHeader("Content-Type",a),i>0&&(r.timeout=i,r.ontimeout=function(){r.ontimeout=r.onreadystatechange=null,o&&o(!1,"timeout after "+i+" ms")}),r.onreadystatechange=function(){4===r.readyState&&(r.ontimeout=r.onreadystatechange=null,200===r.status?o&&o(!0,r.responseText):o&&o(!1,"http status "+r.status))},r.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=window.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=a({},this.metadataOverrides,e)},e.prototype.getOverrides=function(){return this.metadataOverrides},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}),function(e){e.flatten=function(e,t){void 0===t&&(t="");var n={},a=function(e,t){for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];"object"==typeof o?a(o,t+i+"."):n[t+i]=String(o)}};return a(e,t),n}}(t.ObjectUtils||(t.ObjectUtils={}))},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,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.remove=function(e,t){var n=e.indexOf(t);return n>-1?e.splice(n,1)[0]:null}}(t.ArrayUtils||(t.ArrayUtils={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.mapAdPosition=function(e,t){return e.scheduleTime<=0?Conviva.Client.AdPosition.PREROLL:e.scheduleTime>=t.getDuration()?Conviva.Client.AdPosition.POSTROLL:Conviva.Client.AdPosition.MIDROLL},e}();t.AdBreakHelper=a}])}); | ||
//# sourceMappingURL=bitmovin-player-analytics-conviva.js.map |
@@ -7,3 +7,3 @@ "use strict"; | ||
Html5Timer.prototype.createTimer = function (timerAction, intervalMs, actionName) { | ||
var timerId = setInterval(timerAction, intervalMs); | ||
var timerId = window.setInterval(timerAction, intervalMs); | ||
return (function () { | ||
@@ -10,0 +10,0 @@ if (timerId !== -1) { |
{ | ||
"name": "@bitmovin/player-integration-conviva", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"description": "Conviva analytics integration for the Bitmovin Player", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -7,3 +7,3 @@ import TimerCancelFunction = Conviva.TimerCancelFunction; | ||
public createTimer(timerAction: TimerAction, intervalMs: number, actionName?: string | null): TimerCancelFunction { | ||
let timerId = setInterval(timerAction, intervalMs); | ||
let timerId = window.setInterval(timerAction, intervalMs); | ||
return (function() { | ||
@@ -10,0 +10,0 @@ if (timerId !== -1) { |
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
246800