Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
DoomTay committed Jun 6, 2018
0 parents commit 860a563
Show file tree
Hide file tree
Showing 8 changed files with 691 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
Empty file added CHANGELOG.md
Empty file.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 DoomTay

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
90 changes: 90 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# videojs-vast-vpaid-waterfall

Allows for VAST and VPAID preroll, midroll, and postroll ads with waterfall. This means that if one ad in an array can't be run for any reason, it will attempt to run the next one.

## Installation

Drop the JS and CSS files in the src folder somewhere in your project

## Usage

You will need video.js, as well as

* [videojs-contrib-ads](https://github.com/videojs/videojs-contrib-ads)
* [vast-client-js](https://github.com/dailymotion/vast-client-js)
* [VPAIDHTML5Client](https://github.com/MailOnline/VPAIDHTML5Client)
* [SWFObject](https://github.com/swfobject/swfobject)
* [VPAIDFLASHClient](https://github.com/MailOnline/VPAIDFLASHClient) *

\* Version must be no later than 0.1.9, as later versions will [inexplicably fail](MailOnline/VPAIDFLASHClient#23)

```html
<script src="//path/to/video.min.js"></script>
<script src="//path/to/vast-client.js"></script>
<script src="//path/to/swfobject.js"></script>
<script src="//path/to/VPAIDHTML5Client.js"></script>
<script src="//path/to/VPAIDFLASHClient.js"></script>
<script src="//path/to/videojs-contrib-ads.js"></script>
<script src="//path/to/videojs-vast-vpaid-waterfall.js"></script>
<script>
var player = videojs('my-video');
player.vastWaterfall({
preroll:
[
{
time: 0,
ads: ["https://www.adserver.com/preroll/default/...",
"https://www.adserver.com/preroll/backup1/...",
"https://www.adserver.com/preroll/backup2/...",
"https://www.adserver.com/prerolll/backup3/..."]
}
],
midroll:
[
{
time: 229,
ads: ["https://www.adserver.com/midroll/default/...",
"https://www.adserver.com/midroll/backup1/...",
"https://www.adserver.com/midroll/backup2/...",
"https://www.adserver.com/midroll/backup3/..."]
},
{
time: 229,
ads: ["https://www.adserver.com/midroll/default/...",
"https://www.adserver.com/midroll/backup1/...",
"https://www.adserver.com/midroll/backup2/...",
"https://www.adserver.com/midroll/backup3/..."]
}
],
postroll:
[
{
time: 0,
ads: ["https://www.adserver.com/postroll/default/...",
"https://www.adserver.com/postroll/backup1/...",
"https://www.adserver.com/postroll/backup2/...",
"https://www.adserver.com/postrolll/backup3/..."]
}
]
});
</script>
```

## Other options
### markers
Adds markers to indicate when midroll markers will happen. Defaults to `true`. Markers will have the class `vjs-midroll-marker`, so their appearance can be customized with CSS.

### debug
Prints debug messages. Defaults to `false`

### flashWrapperPath
Points to the file that will serve as the wrapper for VPAID Flash ads. Defaults to `/VPAIDFlash.swf`


## License

MIT. Copyright (c) DoomTay


[videojs]: http://videojs.com/
58 changes: 58 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>videojs-vast-vpaid-waterfall Demo</title>

<link href="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.0.3/video-js.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/6.3.0/videojs-contrib-ads.min.css">
<link href="src/videojs-vast-vpaid-waterfall.css" rel="stylesheet">

</head>
<body>
<video id="videojs-vast-vpaid-waterfall-player" class="video-js vjs-default-skin" controls width="640" height="360">
<source src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" type='video/mp4'>
</video>

<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.0.3/video.min.js"></script>
<script src="https://unpkg.com/vast-client@1.8.3/vast-client.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script src="https://unpkg.com/vpaid-html5-client@0.1.14/bin/VPAIDHTML5Client.js"></script>
<script src="https://unpkg.com/vpaid-flash-client@0.1.9/bin/VPAIDFLASHClient.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/6.3.0/videojs-contrib-ads.js"></script>
<script src="src/videojs-vast-vpaid-waterfall.js"></script>
<script>
var player = window.player = videojs('videojs-vast-vpaid-waterfall-player');

player.vastWaterfall({
preroll:
[
{
time: 0,
ads: ["https://raw.githubusercontent.com/InteractiveAdvertisingBureau/VAST_Samples/master/VAST%201-2.0%20Samples/Inline_LinearVAST2vpaid.xml","https://cdn.rawgit.com/InteractiveAdvertisingBureau/VAST_Samples/dc7b176c27239e00dd1cefc5c8ba74ee3aec4e08/VAST%201-2.0%20Samples/Inline_LinearRegular_VAST2.0.xml"]
}
],
midroll:
[
{
time: 223,
ads: ["http://search.spotxchange.com/vast/2.00/79391?VPAID=1&content_page_url=test.com&cb=3202405928168446&player_width=300&player_height=250","https://raw.githubusercontent.com/InteractiveAdvertisingBureau/VAST_Samples/master/VAST%201-2.0%20Samples/Inline_LinearVAST2vpaid.xml"]
},
{
time: 223,
ads: ["https://raw.githubusercontent.com/InteractiveAdvertisingBureau/VAST_Samples/master/VAST%201-2.0%20Samples/Inline_LinearVAST2vpaid.xml"]
}
],
postroll:
[
{
time: 0,
ads: ["https://raw.githubusercontent.com/InteractiveAdvertisingBureau/VAST_Samples/master/VAST%201-2.0%20Samples/Inline_LinearVAST2vpaid.xml"]
}
],
flashWrapperPath: "https://unpkg.com/vpaid-flash-client@0.1.9/bin/VPAIDFlash.swf",
debug: true
});
</script>
</body>
</html>
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "videojs-vast-vpaid-waterfall",
"version": "1.0.0",
"description": "Allows for VAST and VPAID preroll, midroll, and postroll ads with fallback",
"main": "src/videojs-vast-vpaid-waterfall.js",
"keywords": [
"ads",
"vast",
"videojs",
"videojs-plugin",
"vpaid"
],
"author": "DoomTay",
"license": "MIT",
"files": [
"index.html",
"src/"
],
"dependencies": {}
}
21 changes: 21 additions & 0 deletions src/videojs-vast-vpaid-waterfall.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.vjs-midroll-marker
{
width: 5px;
height: 100%;
background-color: white;
position: absolute;
}

.vjs-ad-playing .vjs-midroll-marker
{
display: none;
}

.vjs-ad-playing .vjs-vpaid-wrapper
{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
Loading

0 comments on commit 860a563

Please sign in to comment.