Comments (2)
Basically, the idea of the 2.0 release is to hide any of the ad workings from any plugins listening down stream. So, a plugin could just listen to playing
and ended
and know when a video starts and ends and not need to worry about whether ads are playing currently or not. To do so, events are prefixed -- and redispatched in case a downstream user does want to know about ads -- to hide them by default.
Around each ad block, we fire adstart
and adend
events for users to know when we enter ad playback and when we leave ad playback. These are our own events that are fired.
Regular video lifecycle events during an ad will get prefixed with ad
, so, the usual play
, playing
, pause
, ended
would turn into adplay
, adplaying
, adpause
, adended
.
Some of the events during a video also need to be prefixed, for example, the ended
event, since there might be a postroll. Those events get prefixed with content
, so, ended
becomes contentended
. ended
gets special attention because we make sure that ended
gets fired after all the postrolls are done to make sure that downstream users know the video and all ads are done.
So, a typical video's events could look something like:
loadstart
loadedmetadata
canplay
canplaythrough
play
playing
pause
play
ended
This will apply to a regular video or a video that has ads. Assuming a single pre-roll and a single post-roll, the full event log could look something like:
loadstart
loadedmetadata
canplay
canplaythrough
play
playing
adstart
adplay
adplaying
adended
adend
pause
play
contentended
adstart
adplay
adplaying
adended
adend
ended
And if we had not prefixed the ad-events, the event stream would look like the following:
loadstart
loadedmetadata
canplay
canplaythrough
play
playing
adstart
play
playing
ended
adend
pause
play
ended
adstart
play
playing
ended
adend
ended
Now it's hard to know when the actual video ends vs when ads are over.
While we didn't like the dependency order requirement for this plugin we felt like this was the best possibly solution that would keep all the ads details contained to this plugin. Hope the above gives some more insight into our thought process and what actually happens.
from videojs-contrib-ads.
The example debug made it pretty clear, but just wanted to verify.
Thanks.
from videojs-contrib-ads.
Related Issues (20)
- Detect when Server Side Ad is playing HOT 1
- QUESTION: Ad bug in upper-left hand corner HOT 1
- Preroll not starting when following simple exemple
- Preroll wont work on livestreams
- integration with prebid
- Is this possible to play ads whenever possible?
- Library not compatible with Samsung Tizen TVs HOT 9
- WARN: Unexpected startLinearAdMode invocation (preroll)
- Does videojs-contrib-ads support Amazon IVS player? HOT 1
- Docs are wrong HOT 1
- Something wrong wrong with the repo HOT 2
- Google IMA ads not playing with DASH stream in iPhone simulation mode in Chrome browser HOT 2
- While casting to TV the player stops after the preroll HOT 2
- 'npm install' just makes errors. HOT 1
- Post roll leaves player in a stuck state HOT 3
- Is there any way to clear or deregister the videojs-contrib-ads plugin for removing event binding and such as? HOT 1
- How to avoid preroll checks every time when change video source src? HOT 1
- Need Help to create queue system for loading ads
- Why mid-roll ad not working when changing playback speed from 1 to 2?
- Preroll doesn't start after resume video
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from videojs-contrib-ads.