'use strict';
var xml = require('../../utils/xml');
var vastUtil = require('./vastUtil');
var attributesList = [
//Required attributes
'delivery',
'type',
'width',
'height',
//Optional attributes
'codec',
'id',
'bitrate',
'minBitrate',
'maxBitrate',
'scalable',
'maintainAspectRatio',
'apiFramework'
];
function MediaFile(mediaFileJTree) {
Iif (!(this instanceof MediaFile)) {
return new MediaFile(mediaFileJTree);
}
//Required attributes
this.src = xml.keyValue(mediaFileJTree);
for(var x=0; x<attributesList.length; x++) {
var attribute = attributesList[x];
this[attribute] = mediaFileJTree.attr(attribute);
}
}
MediaFile.prototype.isSupported = function(){
if(vastUtil.isVPAID(this)) {
return !!vastUtil.findSupportedVPAIDTech(this.type);
}
if (this.type === 'video/x-flv') {
return vastUtil.isFlashSupported();
}
return true;
};
module.exports = MediaFile;
|