Expand my Community achievements bar.

Announcement: Calling all learners and mentors! Applications are now open for the Adobe Analytics 2024 Mentorship Program! Come learn from the best to prepare for an official certification in Adobe Analytics.

Launch Video Heartbeat integration with Vimeo


Level 1

Being fairly new to Adobe analytics and video heartbeat (via the Adobe Media Analytics Extension), I've managed to cobble together a rudimentary integration with Vimeo. However, I've reached the limit of my skill. I'm a backend developer by trade with basic-intermediate knowledge of javascript.

I'm having an issue with the mediaDelegate object and getCurrentPlaybackTime. The cut-down code I've got is as follows:

var mediaDelegate = new MAO.MediaHeartbeatDelegate();

var mediaObject = MAO.MediaHeartbeat.createMediaObject(videoTitle, videoId, duration, "VOD", "Video");

mediaDelegate.getCurrentPlaybackTimefunction() {  return 10; };


MAO.MediaHeartbeat.getInstance(mediaDelegate, { playerName: playerName })

.then(function (instance) {

  self._mediaHeartbeat = instance;

  instance.trackSessionStart(mediaObject, {});


The problem I'm having is with the line mediaDelegate.getCurrentPlaybackTimefunction() {  return 10; };

With youtube, it was simple, I call mediaDelegate.getCurrentPlaybackTime = function () { return player.getCurrentTime(); };

With Vimeo, it uses async promises, but I can't call mediaDelegate.getCurrentPlaybackTimefunction() {  player.getCurrentTime().then(function(seconds) { return seconds; }); }; - this just chokes with:

[INFO] [plugin::player] Data from delegate > VideoInfo: playerName=Vimeo Player, id=6370469, name=my video, length=30, playhead=undefined, mediaType=video, streamType=VOD, resumed=false

playhead is undefined instead of the current playtime (like it does with Youtube).

Any help is appreciated.



Okay, nvrmind, managed to fix this by tapping into the timeupdate event of the vimeo api and constantly setting the delegate's method...

player.on('timeupdate', function (data) {

  player.getVideoId().then(function (id) {

     analyticsProvider[0].provider._mediaDelegate.getCurrentPlaybackTime = function () { return data.seconds; };



0 Replies