You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The migration from VHL 1.x to VHL 2.x is straightforward, with the new version featuring simplified APIs for initialization, configuration, and player delegates.
Here are the primary differences between 1.x and 2.x:
Plugins and delegates: You no longer need to implement plugins and delegates for Analytics, VideoPlayer, and Heartbeat.
Configuration: You no longer need to instantiate configurations for the 1.x plugins.
Benefits of 2.x
All of the public methods are consolidated into the MediaHeartbeat class to make implementation easier on developers.
All configs are now consolidated into the MediaHeartbeatConfig class.
You no longer need to instantiate configs for the Analytics, VideoPlayer, and Heartbeat plugins. You only need to instantiate the MediaHeartbeat class with MediaHeartbeatDelegate and MediaHeartbeatConfig instances. This is the only implementation that is required to initialize Media Analytics.
With the initialization of MediaHeartbeat, you can safely delete all of the implementation for Analytics Plugin, VideoPlayer Plugin, and Heartbeat Plugin. Also, remove all the existing implementation for initialization that takes in an array of plugins as an input.
Code Comparison
All of the configuration parameters and tracking APIs are now consolidated into the MediaHeartbeats and MediaHeartbeatConfig classes.
Configuration API changes:
AdobeHeartbeatPluginConfig.sdk: Renamed to MediaConfig.appVersion
MediaHeartbeatConfig.playerName: Now set through MediaHeartbeatConfig instead of VideoPlayerPluginDelegate
The AppMeasurement instance (JavaScript only): Now sent through the MediaHeartbeat constructor.
Configuration properties changes:
sdk: Renamed to appVersion
publisher: Removed; IMS Org ID is used instead as a publisher
The following sections provide code comparisons between 1.x and 2.x, covering Initialization, Core Playback, Ad Playback, Chapter Playback, and some additional events.
VHL Code Comparison: INITIALIZATION
Object Initialization
1.x API
2.x API
Heartbeat()
MediaHeartbeat()
VideoPlayerPlugin()
MediaHeartbeatConfig()
AdobeAnalyticsPlugin()
HeartbeatPlugin()
Video player plugin initialization (1.x)
this._playerPlugin=newVideoPlayerPlugin(newSampleVideoPlayerPluginDelegate(this._player));varplayerPluginConfig=newVideoPlayerPluginConfig();playerPluginConfig.debugLogging=true;// Set up the AppMeasurement pluginthis._aaPlugin=newAdobeAnalyticsPlugin(appMeasurement,newSampleAdobeAnalyticsPluginDelegate());varaaPluginConfig=newAdobeAnalyticsPluginConfig();aaPluginConfig.channel=Configuration.HEARTBEAT.CHANNEL;aaPluginConfig.debuglogging=true;this._aaPlugin.configure(aaPluginConfig);// Set up the AdobeHeartbeat pluginvarahPlugin=newAdobeHeartbeatPlugin(newSampleAdobeHeartbeatPluginDelegate());varahPluginConfig=newAdobeHeartbeatPluginConfig(configuration.HEARTBEAT.TRACKING_SERVER,configuration.HEARTBEAT.PUBLISHER);ahPluginConfig.ovp=configuration.HEARTBEAT.OVP;ahPluginConfig.sdk=configuration.HEARTBEAT.SDK;ahPluginConfig.debugLogging=true;ahPlugin.configure(ahPluginConfig);varplugins=[this._playerPlugin,this._aaPlugin,ahPlugin];// Set up and configure the heartbeat librarythis._heartbeat=newHeartbeat(newSampleHeartbeatDelegate(),plugins);varconfigData=newHeartbeatConfig();configData.debugLogging=true;this._heartbeat.configure(configData);
VideoAnalyticsProvider.prototype._onLoad=function(){varcontextData={};// Setting Standard Video MetadatacontextData[VideoMetadataKeys.SEASON]="sample season";contextData[VideoMetadataKeys.SHOW]="sample show";contextData[VideoMetadataKeys.EPISODE]="sample episode";contextData[VideoMetadataKeys.ASSET_ID]="sample asset id";contextData[VideoMetadataKeys.GENRE]="sample genre";contextData[VideoMetadataKeys.FIRST_AIR_DATE]="sample air date";this._aaPlugin.setVideoMetadata(contextData);this._playerPlugin.trackVideoLoad();};
Standard Metadata (2.x)
VideoAnalyticsProvider.prototype._onLoad=function(){varcontextData={};varmediaInfo=MediaHeartbeat.createMediaObject(videoInfo.name,videoInfo.id,videoInfo.length,videoInfo.streamType);// Set standard Video MetadatavarstandardVideoMetadata={};standardVideoMetadata[VideoMetadataKeys.SEASON]="sample season";standardVideoMetadata[VideoMetadataKeys.SHOW]="sample show";standardVideoMetadata[VideoMetadataKeys.EPISODE]="sample episode";standardVideoMetadata[VideoMetadataKeys.ASSET_ID]="sample asset id";standardVideoMetadata[VideoMetadataKeys.GENRE]="sample genre";standardVideoMetadata[VideoMetadataKeys.FIRST_AIR_DATE]="sample air date";mediaInfo.setValue(MediaHeartbeat.MediaObjectKey.StandardVideoMetadata,standardVideoMetadata);this._mediaHeartbeat.trackSessionStart(mediaInfo,contextData);};
Instead of setting the Standard Video Metadata through the AdobeAnalyticsPlugin.setVideoMetadata() API, in VHL 2.0, the Standard Video Metadata is set through the MediaObject key MediaObject.MediaObjectKey.StandardVideoMetadata().
Custom Video Metadata
1.x API
2.x API
VideoMetadataKeys()
MediaHeartbeat.createMediaObject()
AdobeAnalyticsPlugin.setVideoMetadata()
MediaHeartbeat.trackSessionStart()
Custom Metadata (1.x)
VideoAnalyticsProvider.prototype._onLoad=function(){varcontextData={isUserLoggedIn: "false",tvStation: "Sample TV station",programmer: "Sample programmer"};this._aaPlugin.setVideoMetadata(contextData);this._playerPlugin.trackVideoLoad();};
Custom Metadata (2.x)
VideoAnalyticsProvider.prototype._onLoad=function(){varcontextData={isUserLoggedIn: "false",tvStation: "Sample TV station",programmer: "Sample programmer"};varvideoInfo=this._player.getVideoInfo();varmediaInfo=MediaHeartbeat.createMediaObject(videoInfo.name,videoInfo.id,videoInfo.length,videoInfo.streamType);mediaInfo.setValue(MediaHeartbeat.MediaObjectKey.StandardVideoMetadata,standardVideoMetadata);this._mediaHeartbeat.trackSessionStart(mediaInfo,contextData);};
Instead of setting the Custom Video Metadata through the AdobeAnalyticsPlugin.setVideoMetadata() API, in VHL 2.0, the Standard Video Metadata is set through the MediaHeartbeat.trackSessionStart() API.
VideoAnalyticsProvider.prototype._onComplete=function(){this._playerPlugin.trackComplete(function(){console.log("The completion of the content has been tracked.");});};
Instead of setting the Standard Ad Metadata through the AdobeAnalyticsPlugin.setVideoMetadata() API, in VHL 2.0, the Standard Ad Metadata is set through the AdMetadata key MediaObject.MediaObjectKey.StandardVideoMetadata.
Custom Ad Metadata
1.x API
2.x API
AdobeAnalyticsPlugin.setAdMetadata()
MediaHeartbeat.createAdObject()
MediaHeartbeat.trackAdStart()
Custom Ad Metadata (2.x)
VideoAnalyticsProvider.prototype._onAdStart=function(){varadContextData={affiliate: "Sample affiliate",campaign: "Sample ad campaign"};var_adBreakInfo=this._player.getAdBreakInfo();varadBreakInfo=MediaHeartbeat.createAdBreakObject(_adBreakInfo.name,_adBreakInfo.position,_adBreakInfo.startTime);var_adInfo=this._player.getAdInfo();varadInfo=MediaHeartbeat.createAdObject(_adInfo.name,_adInfo.id,_adInfo.position,_adInfo.length);this._mediaHeartbeat.trackEvent(MediaHeartbeat.Event.AdBreakStart,adBreakInfo);this._mediaHeartbeat.trackEvent(MediaHeartbeat.Event.AdStart,adInfo,adContextData);};
Instead of setting the Custom Ad Metadata through the AdobeAnalyticsPlugin.setVideoMetadata API, in VHL 2.0, the Standard Ad Metadata is set through the MediaHeartbeat.trackAdStart() API.
VideoAnalyticsProvider.prototype._onBitrateChange=function(){// Update getQosInfo to return the updated bitratethis._playerPlugin.trackBitrateChange();};
Bitrate Change (2.x)
VideoAnalyticsProvider.prototype._onBitrateChange=function(){// Update getQosObject to return the updated bitratethis._mediaHeartbeat.trackEvent(MediaHeartbeat.Event.BitrateChange);};
All of the optional tracking APIs such as (Ads, Chapters, Bitrate change, Seeking, and Buffering) are now part of a single trackEvent API. The trackEvent API receives a constant parameter that represents the type of event that it is intended to track:
Optional trackEvent APIs
VHL 1.x
VHL 2.x
Return a valid AdBreakInfo in VideoPlayerPlugin.getAdBreakInfo()