Expand my Community achievements bar.

Join us for the next Community Q&A Coffee Break on Tuesday April 23, 2024 with Eric Matisoff, Principal Evangelist, Analytics & Data Science, who will join us to discuss all the big news and announcements from Summit 2024!
SOLVED

Track events such as pause or ended with VideoViewer

Avatar

Level 1

I have implemented videoviewer in my site, and I want to listen to events such as pause, play ended etc. The documentation doesn't really explain how this is done.

My code to implement video is as follows:

 

  var videoViewer = new s7viewers.VideoViewer({
    "containerId":"s7viewer",
    "params":{
          "asset":"Scene7SharedAssets/Glacier_Climber_MP4",
          "serverurl":"http://s7d1.scene7.com/is/image/",
          "videoserverurl":"http://s7d1.scene7.com/is/content/"
            },

          "handlers":{
                "initComplete":function() {
                      console.log("init complete");
                      var test = s7viewer.playback;
                      console.log(test);
                },
  "trackEvent":function(objID, compClass, instName, timeStamp, eventInfo) {
    //identify event type
    var eventType = eventInfo.split(",")[0];
    console.log(instName)
    switch (eventType) {
      case "LOAD":
        //custom event processing code
        console.log("loaded")

        break;
      //additional cases for other events
}
}
            }
    })

    videoViewer.setHandlers({
          "initComplete":function() {
                 console.log("init complete 2");
          },
          "trackEvent":function(objID, compClass, instName, timeStamp, eventInfo) {
                 console.log(objID);
                 console.log(compClass);
                 console.log(instName);
                 console.log(eventInfo);
                 console.log(timeStamp);
          },
    })
    videoViewer.init();

 

When you pause the video eventInfo has no value, how can I detect when video has been paused. here is the documentation:

https://marketing.adobe.com/resources/help/en_US/s7/viewers_ref/r_html5_video_viewer_20_sitecatalyst...

 

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi, 

I think you would have to change the parameters all over the code to your own video (some are bolded below). The code given in the documentation is only an example. 

"params":{ "asset":"Scene7SharedAssets/Glacier_Climber_MP4", "serverurl":"http://s7d1.scene7.com/is/image/", "videoserverurl":"http://s7d1.scene7.com/is/content/"

let me know if this helps.

Regards,

TM

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi, 

I think you would have to change the parameters all over the code to your own video (some are bolded below). The code given in the documentation is only an example. 

"params":{ "asset":"Scene7SharedAssets/Glacier_Climber_MP4", "serverurl":"http://s7d1.scene7.com/is/image/", "videoserverurl":"http://s7d1.scene7.com/is/content/"

let me know if this helps.

Regards,

TM