videojs-vast-vpaid
Advanced tools
Comparing version 0.1.7 to 0.1.9
{ | ||
"name": "VPAIDFLASHClient", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"authors": [ | ||
@@ -32,11 +32,11 @@ "Luis Silva <luis.dasilva@mailonline.co.uk>" | ||
], | ||
"_release": "0.1.7", | ||
"_release": "0.1.8", | ||
"_resolution": { | ||
"type": "version", | ||
"tag": "0.1.7", | ||
"commit": "d5253eb648377de011bb887add2f672925c8da54" | ||
"tag": "0.1.8", | ||
"commit": "31d9222bd0c29e84d21da81d5be7b6c713ec70ab" | ||
}, | ||
"_source": "git://github.com/MailOnline/VPAIDFLASHClient.git", | ||
"_target": "0.1.7", | ||
"_target": "0.1.8", | ||
"_originalSource": "VPAIDFLASHClient" | ||
} |
@@ -31,6 +31,6 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
//width and height is not in the beginning because we will use the default width/height used in the constructor | ||
//creativeData is an object to be consistent with VPAIDHTML | ||
value: function initAd(width, height, viewMode, desiredBitrate) { | ||
var creativeData = arguments[4] === undefined ? '' : arguments[4]; | ||
var environmentVars = arguments[5] === undefined ? '' : arguments[5]; | ||
var creativeData = arguments[4] === undefined ? { AdParameters: '' } : arguments[4]; | ||
var environmentVars = arguments[5] === undefined ? { flashVars: '' } : arguments[5]; | ||
var callback = arguments[6] === undefined ? undefined : arguments[6]; | ||
@@ -207,4 +207,4 @@ } | ||
value: function initAd(width, height, viewMode, desiredBitrate) { | ||
var creativeData = arguments[4] === undefined ? '' : arguments[4]; | ||
var environmentVars = arguments[5] === undefined ? '' : arguments[5]; | ||
var creativeData = arguments[4] === undefined ? { AdParameters: '' } : arguments[4]; | ||
var environmentVars = arguments[5] === undefined ? { flashVars: '' } : arguments[5]; | ||
var callback = arguments[6] === undefined ? undefined : arguments[6]; | ||
@@ -214,4 +214,6 @@ | ||
this._flash.setSize(width, height); | ||
creativeData = creativeData || { AdParameters: '' }; | ||
environmentVars = environmentVars || { flashVars: '' }; | ||
this._flash.callFlashMethod('initAd', [this._flash.getWidth(), this._flash.getHeight(), viewMode, desiredBitrate, creativeData, environmentVars], callback); | ||
this._flash.callFlashMethod('initAd', [this._flash.getWidth(), this._flash.getHeight(), viewMode, desiredBitrate, creativeData.AdParameters || '', environmentVars.flashVars || ''], callback); | ||
} | ||
@@ -769,12 +771,22 @@ }, { | ||
window[VPAID_FLASH_HANDLER] = function (flashID, type, event, callID, error, data) { | ||
/** | ||
* External interface handler | ||
* | ||
* @param {string} flashID identifier of the flash who call this | ||
* @param {string} typeID what type of message is, can be 'event' or 'callback' | ||
* @param {string} typeName if the typeID is a event the typeName will be the eventName, if is a callback the typeID is the methodName that is related this callback | ||
* @param {string} callbackID only applies when the typeID is 'callback', identifier of the callback to call | ||
* @param {object} error error object | ||
* @param {object} data | ||
*/ | ||
window[VPAID_FLASH_HANDLER] = function (flashID, typeID, typeName, callbackID, error, data) { | ||
var instance = registry.getInstanceByID(flashID); | ||
if (!instance) return; | ||
if (event === 'handShake') { | ||
if (typeName === 'handShake') { | ||
instance._handShake(error, data); | ||
} else { | ||
if (type !== 'event') { | ||
instance._callCallback(event, callID, error, data); | ||
if (typeID !== 'event') { | ||
instance._callCallback(typeName, callbackID, error, data); | ||
} else { | ||
instance._trigger(event, data); | ||
instance._trigger(typeName, data); | ||
} | ||
@@ -781,0 +793,0 @@ } |
{ | ||
"name": "VPAIDFLASHClient", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "Luis Silva <luis.dasilva@mailonline.co.uk>" |
@@ -10,4 +10,4 @@ 'use strict'; | ||
//width and height is not in the beginning because we will use the default width/height used in the constructor | ||
initAd (width, height, viewMode, desiredBitrate, creativeData = '', environmentVars = '', callback = undefined) {} | ||
//creativeData is an object to be consistent with VPAIDHTML | ||
initAd (width, height, viewMode, desiredBitrate, creativeData = {AdParameters:''}, environmentVars = {flashVars: ''}, callback = undefined) {} | ||
resizeAd(width, height, viewMode, callback = undefined) {} | ||
@@ -14,0 +14,0 @@ |
@@ -182,12 +182,22 @@ 'use strict'; | ||
window[VPAID_FLASH_HANDLER] = (flashID, type, event, callID, error, data) => { | ||
/** | ||
* External interface handler | ||
* | ||
* @param {string} flashID identifier of the flash who call this | ||
* @param {string} typeID what type of message is, can be 'event' or 'callback' | ||
* @param {string} typeName if the typeID is a event the typeName will be the eventName, if is a callback the typeID is the methodName that is related this callback | ||
* @param {string} callbackID only applies when the typeID is 'callback', identifier of the callback to call | ||
* @param {object} error error object | ||
* @param {object} data | ||
*/ | ||
window[VPAID_FLASH_HANDLER] = (flashID, typeID, typeName, callbackID, error, data) => { | ||
let instance = registry.getInstanceByID(flashID); | ||
if (!instance) return; | ||
if (event === 'handShake') { | ||
if (typeName === 'handShake') { | ||
instance._handShake(error, data); | ||
} else { | ||
if (type !== 'event') { | ||
instance._callCallback(event, callID, error, data); | ||
if (typeID !== 'event') { | ||
instance._callCallback(typeName, callbackID, error, data); | ||
} else { | ||
instance._trigger(event, data); | ||
instance._trigger(typeName, data); | ||
} | ||
@@ -194,0 +204,0 @@ } |
@@ -43,7 +43,9 @@ 'use strict'; | ||
} | ||
initAd (width, height, viewMode, desiredBitrate, creativeData = '', environmentVars = '', callback = undefined) { | ||
initAd (width, height, viewMode, desiredBitrate, creativeData = {AdParameters: ''}, environmentVars = {flashVars: ''}, callback = undefined) { | ||
//resize element that has the flash object | ||
this._flash.setSize(width, height); | ||
creativeData = creativeData || {AdParameters: ''}; | ||
environmentVars = environmentVars || {flashVars: ''}; | ||
this._flash.callFlashMethod('initAd', [this._flash.getWidth(), this._flash.getHeight(), viewMode, desiredBitrate, creativeData, environmentVars], callback); | ||
this._flash.callFlashMethod('initAd', [this._flash.getWidth(), this._flash.getHeight(), viewMode, desiredBitrate, creativeData.AdParameters || '', environmentVars.flashVars || ''], callback); | ||
} | ||
@@ -50,0 +52,0 @@ resizeAd(width, height, viewMode, callback = undefined) { |
{ | ||
"name": "vpaid-flash-client", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"author": "Luis da Silva <luis.dasilva@mailonline.co.uk>", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/MailOnline/VPAIDFLASHClient", |
{ | ||
"name": "videojs-vast-vpaid", | ||
"version": "0.1.7", | ||
"version": "0.1.9", | ||
"authors": [ | ||
@@ -37,3 +37,3 @@ "Carlos Serrano <carlos.pastor@mailonline.co.uk>" | ||
"dependencies": { | ||
"VPAIDFLASHClient": "0.1.7", | ||
"VPAIDFLASHClient": "0.1.8", | ||
"VPAIDHTML5Client": "0.1.11" | ||
@@ -40,0 +40,0 @@ }, |
@@ -26,7 +26,5 @@ var dom = require('./miniDom'); | ||
dom.onReady(function() { | ||
var vastForm = document.querySelector('form#vast-form'); | ||
var vpaidForm = document.querySelector('form#vpaid-form'); | ||
var vastForm = document.querySelector('form#vast-vpaid-form'); | ||
initForm(vastForm); | ||
initForm(vpaidForm); | ||
@@ -33,0 +31,0 @@ /*** Local functions ***/ |
{ | ||
"name": "videojs-vast-vpaid", | ||
"version": "0.1.7", | ||
"version": "0.1.9", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "Carlos Serrano <carlos.pastor@mailonline.co.uk>" |
@@ -8,4 +8,3 @@ # videojs-vast-plugin | ||
Currently we support VAST and VPAID Flash preroll ads. | ||
We are working to support VPAID HTML5 preroll ads, and we will add more VAST ad types as we need them. | ||
Currently we support VAST and VPAID [Flash](https://github.com/MailOnline/VPAIDFLASHClient) and [HTML5](https://github.com/MailOnline/VPAIDHTML5Client) preroll ads, we will add more VAST ad types as we need them. | ||
@@ -214,6 +213,6 @@ It is important to notice that **VPAID integration is still in beta** and we have not yet released a stable version. | ||
Fired when the video content ends. | ||
### 'vast.reset' event | ||
Trigger the 'vast.reset' event whenever you want to reset the plugin. Beware that if an ad is playing it will be canceled. | ||
## Running the plugin | ||
@@ -253,4 +252,3 @@ If you want to run the plugin you need to clone the repo into your local environment | ||
╟─────────────────────────┼────────────────────────────────────────────────────────────────────────────────╢ | ||
║ release │ Creates a new version of the player and releases it. ║ | ||
║ │ Increasing version, creating new tag and so on (--bump [patch(default)/minor/… ║ | ||
║ deploy-demo │ Builds the demo and deploys it to github pages ║ | ||
╟─────────────────────────┼────────────────────────────────────────────────────────────────────────────────╢ | ||
@@ -257,0 +255,0 @@ ║ watch │ watches for changes on the plugin files and executes the appropriate tasks ║ |
@@ -247,11 +247,9 @@ function VASTClient(options) { | ||
if (progressEvents) { | ||
if (progressEvents.length > 1) { | ||
throw new VASTError("on VASTClient._buildVASTResponse, found more than one progress tracking event in VAST response", 101); | ||
} | ||
if (!isNumber(progressEvents[0].offset)) { | ||
throw new VASTError("on VASTClient._buildVASTResponse, missing offset attribute on progress tracking event", 101); | ||
} | ||
progressEvents.forEach(function(progressEvent){ | ||
if (!isNumber(progressEvent.offset)) { | ||
throw new VASTError("on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event", 101); | ||
} | ||
}); | ||
} | ||
} | ||
}; |
@@ -127,5 +127,13 @@ /** | ||
function trackPause() { | ||
//NOTE: whenever a video ends the video Element triggers a 'pause' event before the 'ended' event. | ||
// We should not track this pause event because it makes the VAST tracking confusing | ||
if(player.currentTime() === player.duration()){ | ||
return; | ||
} | ||
tracker.trackPause(); | ||
player.one('play', function () { | ||
tracker.trackResume(); | ||
playerUtils.once(player, ['play', 'vast.adEnd', 'vast.adsCancel'], function (evt) { | ||
if(evt.type === 'play'){ | ||
tracker.trackResume(); | ||
} | ||
}); | ||
@@ -132,0 +140,0 @@ } |
@@ -69,3 +69,3 @@ function VASTTracker(assetURI, vastResponse) { | ||
addQuartileEvents.call(this, newProgress); | ||
addProgressEvent.call(this, newProgress); | ||
trackProgressEvents.call(this, newProgress); | ||
trackEvents.call(this); | ||
@@ -92,7 +92,18 @@ this.progress = newProgress; | ||
function addProgressEvent(progress) { | ||
var progressEvent = trackingEvents.progress && trackingEvents.progress[0]; | ||
if (progressEvent) { | ||
addTrackEvent('progress', ONCE, progressEvent.offset <= progress); | ||
function trackProgressEvents(progress) { | ||
if (!isArray(trackingEvents.progress)) { | ||
return; //Nothing to track | ||
} | ||
var pendingProgressEvts = []; | ||
var that = this; | ||
trackingEvents.progress.forEach(function (evt) { | ||
if (evt.offset <= progress) { | ||
that.trackURLs([evt.uri]); | ||
} else { | ||
pendingProgressEvts.push(evt); | ||
} | ||
}); | ||
trackingEvents.progress = pendingProgressEvts; | ||
} | ||
@@ -99,0 +110,0 @@ |
@@ -98,4 +98,4 @@ vjs.plugin('vastClient', function VASTPlugin(options) { | ||
async.waterfall([ | ||
preparePlayerForAd, | ||
checkAdsEnabled, | ||
preparePlayerForAd, | ||
playPrerollAd | ||
@@ -119,6 +119,6 @@ ], function (error, response) { | ||
function restoreVideoContent() { | ||
setupContentEvents(); | ||
if (snapshot) { | ||
playerUtils.restorePlayerSnapshot(player, snapshot); | ||
snapshot = null; | ||
setupContentEvents(); | ||
} | ||
@@ -303,2 +303,1 @@ } | ||
}); | ||
@@ -211,3 +211,3 @@ function VPAIDIntegrator(player, settings) { | ||
var dimension = dom.getDimension(tech); | ||
adUnit.initAd(dimension.width, dimension.height, this.VIEW_MODE.NORMAL, -1, vastResponse.adParameters || '', function (error) { | ||
adUnit.initAd(dimension.width, dimension.height, this.VIEW_MODE.NORMAL, -1, {AdParameters: vastResponse.adParameters || ''}, function (error) { | ||
next(error, adUnit, vastResponse); | ||
@@ -214,0 +214,0 @@ }); |
@@ -310,2 +310,3 @@ var playerUtils = {}; | ||
restoreVolumeSnapshot(volumeSnapshot); | ||
volumeSnapshot = null; | ||
} | ||
@@ -370,2 +371,2 @@ } | ||
}); | ||
}; | ||
}; |
@@ -33,3 +33,3 @@ describe("VASTClient", function () { | ||
return '<?xml version="1.0" encoding="utf-8"?>' + | ||
'<VAST version="3.0">' + childNodes + '</VAST>' | ||
'<VAST version="3.0">' + childNodes + '</VAST>'; | ||
} | ||
@@ -559,9 +559,9 @@ | ||
it("must throw a VASTError if there is more than one progress event", function(){ | ||
it("must throw an VASTError if one of the progress events have a wrong offset", function(){ | ||
var linear = inLineAd.inLine.creatives[0].linear; | ||
linear.trackingEvents.push(createProgressTrackEvent('http://foo.url1', '00:00:1')); | ||
linear.trackingEvents.push(createProgressTrackEvent('http://foo.url2', '00:00:1')); | ||
linear.trackingEvents.push(createProgressTrackEvent('http://foo.url2', 'fooo:00:1')); | ||
assertThrowsVASTError(function () { | ||
vast._buildVASTResponse(ads); | ||
}, "on VASTClient._buildVASTResponse, found more than one progress tracking event in VAST response", 101); | ||
}, "on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event", 101); | ||
}); | ||
@@ -574,3 +574,3 @@ | ||
vast._buildVASTResponse(ads); | ||
}, "on VASTClient._buildVASTResponse, missing offset attribute on progress tracking event", 101); | ||
}, "on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event", 101); | ||
}); | ||
@@ -577,0 +577,0 @@ |
@@ -215,2 +215,5 @@ describe("VASTIntegrator", function () { | ||
vastIntegrator._setupEvents(mediaFile, tracker, response, callback); | ||
sinon.stub(player, 'currentTime').returns(1); | ||
sinon.stub(player, 'duration').returns(20); | ||
}); | ||
@@ -244,6 +247,33 @@ | ||
it("must NOT track pause and resume events if the ad has finished playing", function(){ | ||
player.currentTime.returns(20); | ||
player.duration.returns(20); | ||
player.trigger('pause'); | ||
sinon.assert.notCalled(tracker.trackPause); | ||
sinon.assert.notCalled(tracker.trackResume); | ||
player.trigger('play'); | ||
sinon.assert.notCalled(tracker.trackPause); | ||
sinon.assert.notCalled(tracker.trackResume); | ||
}); | ||
it("must not track resume event if the ad gets canceled while paused", function(){ | ||
player.trigger('pause'); | ||
player.trigger('vast.adsCancel'); | ||
player.trigger('play'); | ||
sinon.assert.notCalled(tracker.trackResume); | ||
}); | ||
//This test looks like a contradiction but it test the corner case for browsers whose | ||
//player.duration and player.currentTime do not equal when the video has ended | ||
it("must not track resume event if the ad ends while being paused", function(){ | ||
player.trigger('pause'); | ||
player.trigger('vast.adEnd'); | ||
player.trigger('play'); | ||
sinon.assert.notCalled(tracker.trackResume); | ||
}); | ||
it("must track progress", function () { | ||
player.trigger('timeupdate'); | ||
sinon.assert.calledWithExactly(tracker.trackProgress, 0); | ||
sinon.stub(player, 'currentTime').returns(5); | ||
sinon.assert.calledWithExactly(tracker.trackProgress, 1000); | ||
player.currentTime.returns(5); | ||
player.trigger('timeupdate'); | ||
@@ -524,3 +554,3 @@ sinon.assert.calledWithExactly(tracker.trackProgress, 5000); | ||
anchor.target = "_self"; | ||
anchor.href = "#" | ||
anchor.href = "#"; | ||
} | ||
@@ -527,0 +557,0 @@ |
@@ -27,3 +27,3 @@ describe("VASTTracker", function () { | ||
assert.throws(function () { | ||
new VASTTracker(); | ||
var tracker = new VASTTracker(); | ||
}, VASTError, 'VAST Error: on VASTTracker constructor, missing required the URI of the ad asset being played'); | ||
@@ -34,3 +34,3 @@ }); | ||
assert.throws(function () { | ||
new VASTTracker(ASSET_URI); | ||
var tracker = new VASTTracker(ASSET_URI); | ||
}, VASTError, 'VAST Error: on VASTTracker constructor, missing required VAST response'); | ||
@@ -161,7 +161,9 @@ }); | ||
describe("trackProgress", function () { | ||
var tracker; | ||
var tracker, progressEvent, progressEvent2; | ||
beforeEach(function () { | ||
var progressEvent = createTrackEvent('progress', 'http://progress.track.url'); | ||
progressEvent = createTrackEvent('progress', 'http://progress.track.url'); | ||
progressEvent.offset = 100; | ||
progressEvent2 = createTrackEvent('progress', 'http://progress2.track.url'); | ||
progressEvent2.offset = 150; | ||
response._addTrackingEvents([ | ||
@@ -173,12 +175,10 @@ createTrackEvent('start', 'http://start.track.url'), | ||
createTrackEvent('thirdQuartile', 'http://thirdQuartile.track.url'), | ||
progressEvent | ||
progressEvent, | ||
progressEvent2 | ||
]); | ||
tracker = new VASTTracker(ASSET_URI, response); | ||
sinon.spy(tracker, 'trackEvent'); | ||
sinon.spy(tracker, 'trackURLs'); | ||
}); | ||
it("must be a function", function () { | ||
assert.isFunction(tracker.trackProgress); | ||
}); | ||
it("must set the progress in the tracker", function () { | ||
@@ -235,5 +235,16 @@ tracker.trackProgress(124324); | ||
tracker.trackProgress(95); | ||
sinon.assert.neverCalledWith(tracker.trackEvent, 'progress', true); | ||
sinon.assert.neverCalledWith(tracker.trackURLs, [progressEvent.uri]); | ||
sinon.assert.neverCalledWith(tracker.trackURLs, [progressEvent2.uri]); | ||
tracker.trackProgress(100); | ||
sinon.assert.calledWithExactly(tracker.trackEvent, 'progress', true); | ||
sinon.assert.calledWithExactly(tracker.trackURLs, [progressEvent.uri]); | ||
sinon.assert.neverCalledWith(tracker.trackURLs, [progressEvent2.uri]); | ||
//Second tracking event | ||
tracker.trackURLs.reset(); | ||
sinon.assert.neverCalledWith(tracker.trackURLs, [progressEvent.uri]); | ||
sinon.assert.neverCalledWith(tracker.trackURLs, [progressEvent2.uri]); | ||
tracker.trackProgress(150); | ||
sinon.assert.neverCalledWith(tracker.trackURLs, [progressEvent.uri]); | ||
sinon.assert.calledWithExactly(tracker.trackURLs, [progressEvent2.uri]); | ||
}); | ||
@@ -330,3 +341,3 @@ }); | ||
CONTENTPLAYHEAD: "00:00:00.000" | ||
}) | ||
}); | ||
}); | ||
@@ -333,0 +344,0 @@ }); |
@@ -168,3 +168,6 @@ describe("videojs.vast plugin", function () { | ||
player = videojs(document.createElement('video'), {}); | ||
player.vastClient({url: echoFn('/fake.ad.url')}); | ||
player.vastClient({ | ||
url: echoFn('/fake.ad.url'), | ||
playAdAlways: true | ||
}); | ||
}); | ||
@@ -185,2 +188,37 @@ | ||
it("must cancel the ad on replay if the ads are disabled and trigger the content events", function(){ | ||
var adsCanceled = sinon.spy(); | ||
var contentStart = sinon.spy(); | ||
var contentEnd = sinon.spy(); | ||
player.vast.disable(); | ||
player.trigger('vast.firstPlay'); | ||
clock.tick(1); | ||
//We simulate we finish playing the video. | ||
player.trigger('vast.contentEnd'); | ||
clock.tick(1); | ||
player.on('vast.adsCancel', adsCanceled); | ||
player.on('vast.contentStart', contentStart); | ||
player.on('vast.contentEnd', contentEnd); | ||
//We simulate the second first play (replay) | ||
player.trigger('vast.firstPlay'); | ||
clock.tick(1); | ||
sinon.assert.calledOnce(adsCanceled); | ||
sinon.assert.notCalled(contentStart); | ||
sinon.assert.notCalled(contentEnd); | ||
player.trigger('playing'); | ||
sinon.assert.calledOnce(adsCanceled); | ||
sinon.assert.calledOnce(contentStart); | ||
sinon.assert.notCalled(contentEnd); | ||
player.trigger('ended'); | ||
sinon.assert.calledOnce(adsCanceled); | ||
sinon.assert.calledOnce(contentStart); | ||
sinon.assert.calledOnce(contentEnd); | ||
}); | ||
it("must remove the native poster to prevent flickering when video content starts", function(){ | ||
@@ -317,3 +355,7 @@ var tech = player.el().querySelector('.vjs-tech'); | ||
player.vast.adUnit = { | ||
type: 'FAKE' | ||
type: 'FAKE', | ||
isPaused: function() { | ||
return false; | ||
}, | ||
pauseAd: noop | ||
}; | ||
@@ -383,3 +425,3 @@ player.vast.disable(); | ||
beforeEach(function () { | ||
old_UA = _UA; | ||
old_UA = window._UA; | ||
window._UA = "iPhone"; | ||
@@ -386,0 +428,0 @@ |
@@ -22,3 +22,3 @@ describe("VPAIDIntegrator", function () { | ||
fn(null, vol); | ||
}, 0) | ||
}, 0); | ||
@@ -39,3 +39,3 @@ }; | ||
fn(null, skippable); | ||
}, 0) | ||
}, 0); | ||
}; | ||
@@ -101,3 +101,3 @@ | ||
describe("instance", function () { | ||
var vpaidIntegrator, callback, fakeTech, vastResponse; | ||
var vpaidIntegrator, callback, FakeTech, vastResponse; | ||
@@ -116,11 +116,11 @@ function createMediaFile(url, type) { | ||
fakeTech = function () { | ||
FakeTech = function () { | ||
}; | ||
fakeTech.prototype.name = 'vpaid-fake'; | ||
fakeTech.prototype.loadAdUnit = sinon.spy(); | ||
fakeTech.prototype.unloadAdUnit = sinon.spy(); | ||
fakeTech.prototype.mediaFile = mediaFile; | ||
fakeTech.supports = sinon.stub(); | ||
FakeTech.prototype.name = 'vpaid-fake'; | ||
FakeTech.prototype.loadAdUnit = sinon.spy(); | ||
FakeTech.prototype.unloadAdUnit = sinon.spy(); | ||
FakeTech.prototype.mediaFile = mediaFile; | ||
FakeTech.supports = sinon.stub(); | ||
@@ -140,4 +140,4 @@ vastResponse = new VASTResponse(); | ||
beforeEach(function () { | ||
fakeTech.supports.returns(true); | ||
VPAIDIntegrator.techs.unshift(fakeTech); | ||
FakeTech.supports.returns(true); | ||
VPAIDIntegrator.techs.unshift(FakeTech); | ||
@@ -158,3 +158,3 @@ loadAdUnit = stubAsyncStep(vpaidIntegrator, '_loadAdUnit', this.clock); | ||
assert.instanceOf(error, VASTError); | ||
assert.equal(error.message, 'VAST Error: on VASTIntegrator.playAd, missing required VASTResponse') | ||
assert.equal(error.message, 'VAST Error: on VASTIntegrator.playAd, missing required VASTResponse'); | ||
}); | ||
@@ -216,3 +216,3 @@ | ||
this.clock.tick(1); | ||
sinon.assert.calledOnce(fakeTech.prototype.unloadAdUnit); | ||
sinon.assert.calledOnce(FakeTech.prototype.unloadAdUnit); | ||
}); | ||
@@ -227,3 +227,3 @@ }); | ||
finishPlaying.flush(null, vpaidAdUnit, vastResponse); | ||
sinon.assert.calledOnce(fakeTech.prototype.unloadAdUnit); | ||
sinon.assert.calledOnce(FakeTech.prototype.unloadAdUnit); | ||
}); | ||
@@ -245,3 +245,3 @@ | ||
var adUnit = vpaidIntegrator.playAd(vastResponse, noop); | ||
assert.equal(adUnit.type, 'VPAID') | ||
assert.equal(adUnit.type, 'VPAID'); | ||
}); | ||
@@ -277,3 +277,3 @@ | ||
var adUnit = vpaidIntegrator.playAd(vastResponse, noop); | ||
assert.equal(adUnit.getSrc(), fakeTech.prototype.mediaFile); | ||
assert.equal(adUnit.getSrc(), FakeTech.prototype.mediaFile); | ||
}); | ||
@@ -285,3 +285,3 @@ }); | ||
it("must pass the containerEl", function () { | ||
var testTech = new fakeTech(); | ||
var testTech = new FakeTech(); | ||
vpaidIntegrator._loadAdUnit(testTech, vastResponse, callback); | ||
@@ -292,3 +292,3 @@ sinon.assert.calledWithExactly(testTech.loadAdUnit, vpaidIntegrator.containerEl, player.el().querySelector('.vjs-tech'), sinon.match.func); | ||
it("must pass the error if there is an error loading the ad unit", function(){ | ||
var testTech = new fakeTech(); | ||
var testTech = new FakeTech(); | ||
vpaidIntegrator._loadAdUnit(testTech, vastResponse, callback); | ||
@@ -302,3 +302,3 @@ var techLoadAdUnitCb = thirdArg(testTech.loadAdUnit); | ||
it("must pass the error, a wrapped adUnit and the vast response to the callback", function () { | ||
var testTech = new fakeTech(); | ||
var testTech = new FakeTech(); | ||
vpaidIntegrator._loadAdUnit(testTech, vastResponse, callback); | ||
@@ -311,3 +311,3 @@ var techLoadAdUnitCb = thirdArg(testTech.loadAdUnit); | ||
it("must pass the error if there is a problem creating the VPAIDAdUnitWrapper", function(){ | ||
var testTech = new fakeTech(); | ||
var testTech = new FakeTech(); | ||
vpaidIntegrator._loadAdUnit(testTech, vastResponse, callback); | ||
@@ -321,7 +321,7 @@ var techLoadAdUnitCb = thirdArg(testTech.loadAdUnit); | ||
var error = firstArg(callback); | ||
assert.equal(error.message, 'VAST Error: on VPAIDAdUnitWrapper, the passed VPAID adUnit does not fully implement the VPAID interface') | ||
assert.equal(error.message, 'VAST Error: on VPAIDAdUnitWrapper, the passed VPAID adUnit does not fully implement the VPAID interface'); | ||
}); | ||
it("must add the tech class to the player and remove it on 'vpaid.adEnd' event",function(){ | ||
var testTech = new fakeTech(); | ||
var testTech = new FakeTech(); | ||
var fakeAdUnit = {}; | ||
@@ -389,3 +389,3 @@ sinon.stub(window, 'VPAIDAdUnitWrapper').returns(fakeAdUnit); | ||
it("must be a function", function () { | ||
assert.isFunction(vpaidIntegrator._handshake) | ||
assert.isFunction(vpaidIntegrator._handshake); | ||
}); | ||
@@ -401,3 +401,3 @@ | ||
assert.instanceOf(error, VASTError); | ||
assert.equal(error.message, 'VAST Error: on VPAIDIntegrator._handshake, unsupported version "0.0.0"') | ||
assert.equal(error.message, 'VAST Error: on VPAIDIntegrator._handshake, unsupported version "0.0.0"'); | ||
}); | ||
@@ -413,3 +413,3 @@ | ||
assert.instanceOf(error, VASTError); | ||
assert.equal(error.message, 'VAST Error: on VPAIDIntegrator._handshake, unsupported version "3.0.0"') | ||
assert.equal(error.message, 'VAST Error: on VPAIDIntegrator._handshake, unsupported version "3.0.0"'); | ||
}); | ||
@@ -458,6 +458,6 @@ | ||
it("must call pass the with, height , viewmode desired bitrate to the adUnit's initAd", function () { | ||
it("must call pass the with, height, viewmode, desired bitrate, and creativeData to the adUnit's initAd", function () { | ||
var next = sinon.spy(); | ||
vpaidIntegrator._initAd(adUnitWrapper, response, next); | ||
sinon.assert.calledWithExactly(adUnitWrapper.initAd, 720, 480, 'normal', -1, '', sinon.match.func) | ||
sinon.assert.calledWithExactly(adUnitWrapper.initAd, 720, 480, 'normal', -1, sinon.match({AdParameters: ''}), sinon.match.func); | ||
}); | ||
@@ -467,5 +467,5 @@ | ||
var next = sinon.spy(); | ||
response.adParameters = "some params"; | ||
response.adParameters = 'some params'; | ||
vpaidIntegrator._initAd(adUnitWrapper, response, next); | ||
sinon.assert.calledWithExactly(adUnitWrapper.initAd, 720, 480, 'normal', -1, 'some params', sinon.match.func) | ||
sinon.assert.calledWithExactly(adUnitWrapper.initAd, 720, 480, 'normal', -1, sinon.match({AdParameters: 'some params'}), sinon.match.func); | ||
}); | ||
@@ -587,3 +587,3 @@ | ||
it("must no open any window if there is no click thru url passed or in the vastResponse", function(){ | ||
adUnit.trigger('AdClickThru', '', 0001, true); | ||
adUnit.trigger('AdClickThru', '', 1, true); | ||
sinon.assert.notCalled(window.open); | ||
@@ -821,3 +821,3 @@ }); | ||
sinon.stub(VPAIDFLASHClient, 'isSupported', function () {return false}); | ||
sinon.stub(VPAIDFLASHClient, 'isSupported', function () {return false;}); | ||
@@ -824,0 +824,0 @@ assert.isNull(vpaidIntegrator._findSupportedTech(vastResponse)); |
@@ -405,3 +405,3 @@ describe("playerUtils", function () { | ||
it("must restore the muted volume on 'vast.reset' evt", function () { | ||
it("must restore the muted volume on 'vast.reset' evt", function () { // need to be sure we need to reset the volume on reset | ||
playerUtils.prepareForAds(player); | ||
@@ -733,2 +733,2 @@ player.volume(1); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7031345
468
102654
278