videojs-vast-vpaid
Version:
VAST plugin to use with video.js
18 lines (13 loc) • 465 B
JavaScript
const xml = require('../../utils/xml');
const parsers = require('./parsers');
function TrackingEvent (trackingJTree, duration) {
if (!(this instanceof TrackingEvent)) {
return new TrackingEvent(trackingJTree, duration);
}
this.name = trackingJTree.attr('event');
this.uri = xml.keyValue(trackingJTree);
if ('progress' === this.name) {
this.offset = parsers.offset(trackingJTree.attr('offset'), duration);
}
}
module.exports = TrackingEvent;