Skip to content

Commit

Permalink
Release 1.0.22
Browse files Browse the repository at this point in the history
  • Loading branch information
aviral-zype committed Aug 27, 2023
1 parent ba3c636 commit eaef23a
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 30 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<a name="1.0.21"></a>

Bug Fixes
Fixed a bug where sometimes Ad scheduling was throwing an Error Message.

<a name="1.0.21"></a>

New Feature
introducing an exciting addition: the Schedule Break API now supports adUrl. This means you can simply provide any VAST or VMAP Url, and the plugin will seamlessly handle it for you. This eliminates the necessity of manually providing vmapUrl or vastUrl. Enjoy a smoother experience with this automated process.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ This plugin currently supports a handful of options that might help you customiz

* **vastUrl** (string) - The URL where the plugin will fetch the VAST manifest from
* **vmapUrl** (string) - The URL where the plugin will fetch the VMAP manifest from
* **adUrl** (string) - The URL where the plugin will automatically detect and play VMAP or VAST manifest Ad
* **isLimitedTracking** (boolean) - According to the Vast [documentation](https://interactiveadvertisingbureau.github.io/vast/vast4macros/vast4-macros-latest.html#macro-spec-limitadtracking), relates to the LIMITADTRACKING macro. ***Default : false***
* **timeout** (milliseconds - int) - Max amount of time the plugin should wait for the manifest URL to respond and the assets to load. Will throw an error if this value is exceeded. ***Default: 5000***
* **verificationTimeout** (milliseconds - int) - Max amount of time the plugin should wait for the OMID verification URLs to respond and the assets to load. ***Default: 2000***
Expand Down Expand Up @@ -118,6 +119,10 @@ Below you can find a list of the events currently supported. Just like the plugi
* **vast.error** - Called if the plugin fails at some point in the process
* **vast.click** - Called once the plugin succeffully registers a click in the call to action element associated with an ad - check the [Implementing a CTA](#implementing-a-cta) section for more details

Additional Available Events:
**adplaying** | **adpause** | **adtimeupdate** | **advolumechange** | **adfullscreen** | **adtimeout** | **adstart** | **aderror** | **readyforpreroll** | **readyforpostroll** | **skip** | **adended** | **ended** |

Call `player.ads.isAdPlaying()` to check if ad is playing or not.
#### Runnning locally

Running the plugin locally to further develop it is quite simple. Since the plugin repository does not contain any self contained development environment, we recommend using [**yalc**](https://www.npmjs.com/package/yalc) to publish the package in a local repository and then use [**yalc**](https://www.npmjs.com/package/yalc) again to install the plugin from the same local repository in in a dedicated development environment or even within the project you are working on.
Expand Down
34 changes: 17 additions & 17 deletions docs/demo.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/demo.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aviral-zype/video-js-vast-plugin",
"version": "1.0.21",
"version": "1.0.22",
"main": "./dist/cjs/index.js",
"module": "./dist/mjs/index.js",
"license": "Apache-2.0",
Expand Down
13 changes: 9 additions & 4 deletions src/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ const skippableAd = "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923
// Initialize the VAST plugin
const options = {
// vastUrl: vastAd,
vmapUrl: vmapAd,
// adUrl: skippableAd,
// vmapUrl: vmapAd,
adUrl: vmapAd,
debug: true,
}
const vastPlugin = player.vast(options);
const vastPlugin = player.vast();
// console.log(player)
// Add event listeners
player.on('play', () => {
console.log('Video started playing');
vastPlugin.schdeuleAdBreak(options)
});

player.on('pause', () => {
Expand All @@ -43,7 +44,11 @@ player.on('timeupdate', (e) => {
vastPlugin.schdeuleAdBreak(options)
}
})

player.on('adtimeupdate', (e) => {
console.log("XXX",player.ads.isAdPlaying())
console.log("A+ACA AD IS PLA?YIN")
// console.log(player)
})
// ...

// You can add more event listeners as needed
Expand Down
14 changes: 8 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,17 @@ class Vast extends Plugin {

async schdeuleAdBreak(options){
if(!this.player) return;
if(options.adUrl){
const response = await fetchAdUrl(options.adUrl)
this.options = {...this.options, ...options}
if(this.options.adUrl){
const response = await fetchAdUrl(this.options.adUrl)
if(response.adType === "vmap"){
this.handleVmapXml(response.vmap)
} else if(response.adType === "vast")
this.vastXMLHandler(response.xml)
} else if (options.vmapUrl) {
this.handleVMAP(options.vmapUrl);
} else {
this.vastHandler(options)
} else if (this.options.vmapUrl) {
this.handleVMAP(this.options.vmapUrl);
} else if(this.options.vastUrl) {
this.vastHandler(this.options)
}
}

Expand Down Expand Up @@ -105,6 +106,7 @@ class Vast extends Plugin {
}

disablePostroll() {
if(!this.player) return;
this.player.on('readyforpostroll', () => {
this.player?.trigger('nopostroll');
});
Expand Down

0 comments on commit eaef23a

Please sign in to comment.