Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Switch prerolls between content changes support #63

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "videojs-vast-plugin",
"name": "videojs-vast",
"version": "0.2.1",
"homepage": "https://github.com/theonion/videojs-vast-plugin",
"authors": [
Expand Down
20 changes: 18 additions & 2 deletions videojs.vast.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@

// return vast plugin
return {
skip: function(skip) {
if (skip === undefined) {
return settings.skip;
} else {
settings.skip = skip;
}
},

url: function(url) {
if (url === undefined) {
return settings.url;
} else {
settings.url = url;
}
},

createSourceObjects: function (media_files) {
var sourcesByFormat = {}, i, j, tech;
var techOrder = player.options().techOrder;
Expand Down Expand Up @@ -299,7 +315,7 @@

player.on('contentupdate', function(){
// videojs-ads triggers this when src changes
player.vast.getContent(settings.url);
player.vast.getContent();
});

player.on('readyforpreroll', function() {
Expand All @@ -314,7 +330,7 @@

// make an ads request immediately so we're ready when the viewer hits "play"
if (player.currentSrc()) {
player.vast.getContent(settings.url);
player.vast.getContent();
}

// return player to allow this plugin to be chained
Expand Down