mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 02:09:22 +02:00
Moving to node_modules folder to make easier to upgrade
trying to move from Bootstrap 3 to Bootstrap 5
This commit is contained in:
parent
047e363a16
commit
d4d042e041
8460 changed files with 1355889 additions and 547977 deletions
24
node_modules/videojs-contrib-ads/docs/_layouts/default.html
generated
vendored
Normal file
24
node_modules/videojs-contrib-ads/docs/_layouts/default.html
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ page.lang | default: site.lang | default: "en" }}">
|
||||
<head>
|
||||
<link rel="stylesheet" href="//videojs.github.io/videojs-contrib-ads/assets/css/style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<header class="page-content">
|
||||
<div class="wrapper">
|
||||
<h1><a href="/videojs-contrib-ads">videojs-contrib-ads</a></h1>
|
||||
<div>
|
||||
<a href="/videojs-contrib-ads/integrator/">Integrator Docs</a>
|
||||
| <a href="/videojs-contrib-ads/developer/">Developer Docs</a>
|
||||
| <a href="https://github.com/videojs/videojs-contrib-ads">Github</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<main class="page-content" aria-label="Content">
|
||||
<div class="wrapper">
|
||||
{{ content }}
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>
|
90
node_modules/videojs-contrib-ads/docs/assets/css/style.scss
generated
vendored
Normal file
90
node_modules/videojs-contrib-ads/docs/assets/css/style.scss
generated
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
---
|
||||
---
|
||||
|
||||
@import "{{ site.theme }}";
|
||||
|
||||
body {
|
||||
font-size: 18px;
|
||||
color: #383838;
|
||||
}
|
||||
|
||||
header {
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
.page-content {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
margin: 0 auto;
|
||||
padding: .5em 1em;
|
||||
text-align: left;
|
||||
max-width: 1000px;
|
||||
}
|
||||
|
||||
header .wrapper {
|
||||
padding: .1em 1em .9em;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0a03d6;
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 18px;
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
pre code {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
padding-left: 2em;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
li {
|
||||
margin: 0 0 .3em;
|
||||
}
|
||||
|
||||
li ul, li ol {
|
||||
margin-top: .2em;
|
||||
}
|
||||
|
||||
table {
|
||||
border: solid #ccc 2px;
|
||||
}
|
||||
|
||||
thead {
|
||||
background: #ccc;
|
||||
}
|
||||
|
||||
td, th {
|
||||
padding: 1px 5px;
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: .2em .5em;
|
||||
}
|
||||
|
||||
img, svg {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: .2em 0;
|
||||
}
|
||||
|
||||
h2, h3, h4, h5, h6 {
|
||||
margin: .5em 0;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
margin: .5em 0;
|
||||
}
|
BIN
node_modules/videojs-contrib-ads/docs/developer/ad-states.png
generated
vendored
Normal file
BIN
node_modules/videojs-contrib-ads/docs/developer/ad-states.png
generated
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
42
node_modules/videojs-contrib-ads/docs/developer/getting-started.md
generated
vendored
Normal file
42
node_modules/videojs-contrib-ads/docs/developer/getting-started.md
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
# Getting started developing videojs-contrib-ads
|
||||
|
||||
## Building
|
||||
|
||||
videojs-contrib-ads is designed to be built with `npm`.
|
||||
|
||||
If you don't already have `npm`, you will need to install [Node.js](http://nodejs.org/) (which comes with npm). We recommend using [NVM](https://github.com/creationix/nvm) to manage your installed Node versions. Either way, the supported Node version is listed in the project's [.nvmrc file](https://github.com/videojs/videojs-contrib-ads/blob/master/.nvmrc).
|
||||
|
||||
With NPM ready, you can download the ads plugin's build-time dependencies and then build the ads plugin. Open a terminal to the directory where you've cloned this repository, then:
|
||||
|
||||
```sh
|
||||
$ npm install
|
||||
$ npm run build
|
||||
```
|
||||
|
||||
We will run a suite of unit tests and code formatting checks, then create a `dist/` directory. Inside you'll find the minified ads plugin file `videojs.ads.min.js`, the unminified `videojs.ads.js`, and the CSS `videojs.ads.css`.
|
||||
|
||||
## Linting
|
||||
|
||||
Checks for errors or style issues.
|
||||
|
||||
```sh
|
||||
npm run lint
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
Runs QUnit tests.
|
||||
|
||||
### Using command line
|
||||
|
||||
```sh
|
||||
npm run test
|
||||
```
|
||||
|
||||
### In browser
|
||||
|
||||
Run `npm start` and a Chrome instance will launch with Karma's debug interface at `localhost:9876`, allowing you to debug tests. Also, a static server will run and allow you to look at examples at `localhost:9999`.
|
||||
|
||||
## What's Next
|
||||
|
||||
Check out the [architecture overview](overview.md) to learn your way around the code.
|
8
node_modules/videojs-contrib-ads/docs/developer/index.md
generated
vendored
Normal file
8
node_modules/videojs-contrib-ads/docs/developer/index.md
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Developer Documentation
|
||||
|
||||
If you are interested in contributing bug fixes or features to videojs-contrib-ads this documentation is for you.
|
||||
|
||||
* [Getting Started](getting-started.md)
|
||||
* [Overview](overview.md)
|
||||
* [States](states.md)
|
||||
* [Roadmap](roadmap.md)
|
41
node_modules/videojs-contrib-ads/docs/developer/lib/railroad-diagrams.css
generated
vendored
Normal file
41
node_modules/videojs-contrib-ads/docs/developer/lib/railroad-diagrams.css
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
svg.railroad-diagram {
|
||||
background-color: hsl(30,20%,95%);
|
||||
}
|
||||
svg.railroad-diagram path {
|
||||
stroke-width: 3;
|
||||
stroke: black;
|
||||
fill: rgba(0,0,0,0);
|
||||
}
|
||||
svg.railroad-diagram text {
|
||||
font: bold 14px monospace;
|
||||
text-anchor: middle;
|
||||
}
|
||||
svg.railroad-diagram text.diagram-text {
|
||||
font-size: 12px;
|
||||
}
|
||||
svg.railroad-diagram text.diagram-arrow {
|
||||
font-size: 16px;
|
||||
}
|
||||
svg.railroad-diagram text.label {
|
||||
text-anchor: start;
|
||||
}
|
||||
svg.railroad-diagram text.comment {
|
||||
font: italic 12px monospace;
|
||||
}
|
||||
svg.railroad-diagram g.non-terminal text {
|
||||
/*font-style: italic;*/
|
||||
}
|
||||
svg.railroad-diagram rect {
|
||||
stroke-width: 3;
|
||||
stroke: black;
|
||||
fill: hsl(120,100%,90%);
|
||||
}
|
||||
svg.railroad-diagram path.diagram-text {
|
||||
stroke-width: 3;
|
||||
stroke: black;
|
||||
fill: white;
|
||||
cursor: help;
|
||||
}
|
||||
svg.railroad-diagram g.diagram-text:hover path.diagram-text {
|
||||
fill: #eee;
|
||||
}
|
1059
node_modules/videojs-contrib-ads/docs/developer/lib/railroad-diagrams.js
generated
vendored
Normal file
1059
node_modules/videojs-contrib-ads/docs/developer/lib/railroad-diagrams.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
57
node_modules/videojs-contrib-ads/docs/developer/overview.md
generated
vendored
Normal file
57
node_modules/videojs-contrib-ads/docs/developer/overview.md
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
# Architecture Overview
|
||||
|
||||
videojs-contrib-ads is separated into files by module.
|
||||
|
||||
## Modules
|
||||
|
||||
### plugin.js
|
||||
|
||||
The entry point of the application. Registers the plugin with video.js and initializes other feature modules.
|
||||
|
||||
### ads.js
|
||||
|
||||
Implements the [public API](../integrator/api.md).
|
||||
|
||||
### adBreak.js
|
||||
|
||||
Common code that is invoked when ad breaks start and end. Used by Preroll.js, Midroll.js, and Postroll.js.
|
||||
|
||||
### cancelContentPlay.js
|
||||
|
||||
Feature that prevents content playback while prerolls are handled. cancelContentPlay is used when video.js middleware is *not* available.
|
||||
|
||||
### playMiddleware.js
|
||||
|
||||
Feature that prevents content playback while prerolls are handled. playMiddleware is used when video.js middleware is available.
|
||||
|
||||
### contentupdate
|
||||
|
||||
Implements the `contentchanged` event.
|
||||
|
||||
### plugin.scss
|
||||
|
||||
Styles for the ad player.
|
||||
|
||||
### redispatch.js
|
||||
|
||||
Feature that makes the presense of ads transparent to event listeners.
|
||||
|
||||
### snapshot.js
|
||||
|
||||
Feature that captures the player state before ads and restores it after ads.
|
||||
|
||||
### states.js
|
||||
|
||||
Used to import modules from the `states` folder. This works around an issue with bundler where importing the files directly may not load them in the correct order.
|
||||
|
||||
### states
|
||||
|
||||
The states folder contains the various states that videojs-contrib-ads can be in.
|
||||
|
||||
### states/abstract
|
||||
|
||||
States in the `abstract` subfolder are subclassed by the main states in the `states` folder itself. They implement common functionality used by similar states.
|
||||
|
||||
## What's Next
|
||||
|
||||
Learn more about [states](states.md).
|
7
node_modules/videojs-contrib-ads/docs/developer/roadmap.md
generated
vendored
Normal file
7
node_modules/videojs-contrib-ads/docs/developer/roadmap.md
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Roadmap
|
||||
|
||||
## Version 7
|
||||
|
||||
* Pause content video if there is a programmatic call to play (prefixed as adplay) while an ad is playing in an ad container (rather than content video element). Prefixing doesn't prevent the videojs behavior, so this would prevent the content from playing behind the ad. Right now, ad plugins I am aware of are doing this on their own, so this would require a migration to move the behavior into this project.
|
||||
* `contentended` will change from its current deprecated purpose to being a normal prefixed event during content restoration.
|
||||
* The default value for `liveCuePoints` will change to `false` because we believe this is a more common and intuitive default.
|
3
node_modules/videojs-contrib-ads/docs/developer/states.css
generated
vendored
Normal file
3
node_modules/videojs-contrib-ads/docs/developer/states.css
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
svg.railroad-diagram {
|
||||
background-color: transparent;
|
||||
}
|
134
node_modules/videojs-contrib-ads/docs/developer/states.md
generated
vendored
Normal file
134
node_modules/videojs-contrib-ads/docs/developer/states.md
generated
vendored
Normal file
|
@ -0,0 +1,134 @@
|
|||
<script src="./lib/railroad-diagrams.js"></script>
|
||||
<link rel="stylesheet" href="./lib/railroad-diagrams.css"/>
|
||||
<link rel="stylesheet" href="states.css"/>
|
||||
|
||||
# States
|
||||
|
||||
videojs.contrib-ads moves through various states as a content video plays. Here's a state diagram which shows the states of the ads plugin and how it transitions between them:
|
||||
|
||||

|
||||
|
||||
Ad states are yellow and content states are blue. If the current state is an ad state, the plugin is in ad mode.
|
||||
|
||||
Many methods in the public API are implemented by inspecting the current state. The current state instance should not be inspected directly by ad plugins.
|
||||
|
||||
States are implemented as classes with a 3-tiered inheritance hierarchy. All states extend either `AdState` or `ContentState`. In turn, `AdState` and `ContentState` extend `State`.
|
||||
|
||||
## BeforePreroll (extends ContentState)
|
||||
|
||||
The initial state. On source change, contrib-ads returns to this state for the new source. This state is not an ad state because content playback has not been requested yet, therefor playback has not been blocked by the ad plugin yet.
|
||||
|
||||
<script>
|
||||
Diagram(
|
||||
NonTerminal('init'),
|
||||
Optional(
|
||||
NonTerminal('onAdsReady')
|
||||
),
|
||||
Choice(
|
||||
0,
|
||||
NonTerminal('onPlay'),
|
||||
NonTerminal('onNoPreroll'),
|
||||
NonTerminal('skipLinearAdMode'),
|
||||
)
|
||||
)
|
||||
.addTo(document.querySelector('#diagram-1'));
|
||||
</script>
|
||||
<div id="diagram-1"></div>
|
||||
|
||||
## Preroll (extends AdState)
|
||||
|
||||
We move into this state when content playback is requested, as indicated by the `play` event. At this point, playback is officially blocked by the ad plugin. Ads may or may not play during this time. For example, we we learn that there are no preroll ads and move on. We leave this state when content playback begins, resulting in a `playing` event.
|
||||
|
||||
<script>
|
||||
Diagram(
|
||||
NonTerminal('init'),
|
||||
Optional(
|
||||
NonTerminal('onAdsReady')
|
||||
),
|
||||
Choice(
|
||||
0,
|
||||
Sequence(
|
||||
NonTerminal('startLinearAdMode'),
|
||||
Optional(
|
||||
NonTerminal('onAdStarted')
|
||||
),
|
||||
NonTerminal('endLinearAdMode'),
|
||||
),
|
||||
NonTerminal('onAdTimeout'),
|
||||
NonTerminal('onNoPreroll'),
|
||||
NonTerminal('skipLinearAdMode')
|
||||
),
|
||||
NonTerminal('cleanup')
|
||||
)
|
||||
.addTo(document.querySelector('#diagram-2'));
|
||||
</script>
|
||||
<div id="diagram-2"></div>
|
||||
|
||||
## ContentPlayback (extends ContentState)
|
||||
|
||||
This state represents normal content playback, even if the player is paused.
|
||||
|
||||
<script>
|
||||
Diagram(
|
||||
NonTerminal('init'),
|
||||
Optional('onAdsReady'),
|
||||
Choice(
|
||||
0,
|
||||
NonTerminal('onReadyForPostroll'),
|
||||
NonTerminal('startLinearAdMode')
|
||||
)
|
||||
)
|
||||
.addTo(document.querySelector('#diagram-3'));
|
||||
</script>
|
||||
<div id="diagram-3"></div>
|
||||
|
||||
## Midroll (extends AdState)
|
||||
|
||||
This state encapsulates preparing for midroll ads, playing midroll ads, and restoring content after midroll ads. It begins when the ad plugin invokes `startLinearAdMode` and it ends when content resumes, resulting in a `playing` event.
|
||||
|
||||
<script>
|
||||
Diagram(
|
||||
NonTerminal('init'),
|
||||
Optional('onAdStarted'),
|
||||
NonTerminal('endLinearAdMode'),
|
||||
NonTerminal('cleanup')
|
||||
)
|
||||
.addTo(document.querySelector('#diagram-4'));
|
||||
</script>
|
||||
<div id="diagram-4"></div>
|
||||
|
||||
## Postroll (extends AdState)
|
||||
|
||||
This state begins when content ends for the first time, resulting in a `readyforpostroll` event. A preroll may play during this state. This state leads to the AdsDone state; the ad plugin will not return to ContentPlayback for this source.
|
||||
|
||||
<script>
|
||||
Diagram(
|
||||
NonTerminal('init'),
|
||||
Choice(
|
||||
0,
|
||||
Sequence(
|
||||
NonTerminal('startLinearAdMode'),
|
||||
Optional('onAdStarted'),
|
||||
NonTerminal('endLinearAdMode')
|
||||
),
|
||||
NonTerminal('skipLinearAdMode'),
|
||||
NonTerminal('onAdTimeout'),
|
||||
NonTerminal('onNoPostroll'),
|
||||
),
|
||||
NonTerminal('cleanup')
|
||||
)
|
||||
.addTo(document.querySelector('#diagram-5'));
|
||||
</script>
|
||||
<div id="diagram-5"></div>
|
||||
|
||||
## AdsDone (extends ContentState)
|
||||
|
||||
No more ads will play. The user can seek and re-watch content as they please. The only way to leave this state is by changing the content source.
|
||||
|
||||
<script>
|
||||
Diagram(
|
||||
NonTerminal('init')
|
||||
)
|
||||
.addTo(document.querySelector('#diagram-6'));
|
||||
</script>
|
||||
<div id="diagram-6"></div>
|
13
node_modules/videojs-contrib-ads/docs/index.md
generated
vendored
Normal file
13
node_modules/videojs-contrib-ads/docs/index.md
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
The documentation is spit into parts by audience.
|
||||
|
||||
## Are you building an ad plugin using videojs-contrib-ads?
|
||||
|
||||
Check out the [integrator docs](./integrator/).
|
||||
|
||||
## Are you contributing bug fixes or features to videojs-contrib-ads?
|
||||
|
||||
Check out the [developer docs](./developer).
|
||||
|
||||
## Are you adding advertising support to a video player on your site?
|
||||
|
||||
Please refer to the documentation for the ad plugin you are using. videojs-contrib-ads is a library for building ad plugins and is not a stand-alone ad plugin.
|
23
node_modules/videojs-contrib-ads/docs/integrator/ad-mode.md
generated
vendored
Normal file
23
node_modules/videojs-contrib-ads/docs/integrator/ad-mode.md
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
# What is ad mode?
|
||||
|
||||
Defining "ad mode" has turned out to be an interesting challenge for this project. A naive definition might be "is an ad playing or not?" It turns out there are a lot of edge cases that this naive definition does not cover. The following precise definition of ad mode drives the implementation of contrib-ads and ad plugins should be careful to follow it as well to assure maximum correctness.
|
||||
|
||||
Ad mode is split into three parts as identified by the methods `isWaitingForAdBreak()`, `inAdBreak()`, and `isContentResuming()`. See the [API reference](api.md) for more information.
|
||||
|
||||
## Definition
|
||||
|
||||
> The player is in ad mode if the ad plugin is currently preventing content playback.
|
||||
|
||||
### Examples of ad mode:
|
||||
|
||||
* Waiting to find out if an ad is going to play while content would normally be playing
|
||||
* Waiting for an ad to start playing while content would normally be playing
|
||||
* A linear ad is playing
|
||||
* An ad has completed and content is about to resume, but content has not resumed yet
|
||||
|
||||
### Examples of not ad mode:
|
||||
|
||||
* Content playback has not been requested
|
||||
* Content playback is paused
|
||||
* An asynchronous ad request is ongoing while content is playing
|
||||
* A non-linear ad (such as an overlay) is active
|
87
node_modules/videojs-contrib-ads/docs/integrator/api.md
generated
vendored
Normal file
87
node_modules/videojs-contrib-ads/docs/integrator/api.md
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
# API Reference
|
||||
|
||||
This page contains reference documentation for the interaction points between videojs-contrib-ads and ad plugins that use it. All methods are called on `player.ads`; for example, `player.ads.isInAdMode()`. All events are triggered or listened to on the `player` object; for example `player.trigger('nopreroll')` or `player.on('readyforpreroll', () => {...})`.
|
||||
|
||||
## Informational methods and events
|
||||
|
||||
* `isInAdMode()` (METHOD) -- Returns true if the player is in [ad mode](ad-mode.md).
|
||||
* `isWaitingForAdBreak()` (METHOD) -- This method returns true during ad mode if an ad break hasn't started yet.
|
||||
* `inAdBreak()` (METHOD) -- This method returns true after `startLinearAdMode` and before `endLinearAdMode`. This is the part of ad mode when an ad plugin may play ads.
|
||||
* `isContentResuming()` (METHOD) -- This method returns true during ad mode after an ad break has ended but before content has resumed playing.
|
||||
* `adstart` (EVENT) -- This event is fired directly as a consequence of calling `startLinearAdMode()`.
|
||||
* `adend` (EVENT) -- This event is fired directly as a consequence of calling `endLinearAdMode()`.
|
||||
* `adskip` (EVENT) -- This event is fired directly as a consequence of calling `skipLinearAdMode()`.
|
||||
|
||||
## How contrib-ads talks to your ad plugin
|
||||
|
||||
Your ad plugin will listen to these events to trigger its behaviors. See [Getting Started](getting-started.md) for more information.
|
||||
|
||||
* `readyforpreroll` (EVENT) -- Indicates that your ad plugin may start a preroll ad break by calling `startLinearAdMode`.
|
||||
* `readyforpostroll` (EVENT) -- Indicates that your ad plugin may start a postroll ad break by calling `startLinearAdMode`.
|
||||
* `adtimeout` (EVENT) -- A timeout managed by videojs-contrib-ads has expired and regular video content has begun to play. Ad plugins have a fixed amount of time to start an ad break when an opportunity arises. For example, if the ad plugin is blocked by network conditions or an error, this event will fire and regular playback will resume rather than the player stalling indefinitely.
|
||||
* `contentchanged` (EVENT) -- Fires when a new content video has been loaded in the player (specifically, at the same time as the `loadstart` media event for the new source). This means the ad workflow has restarted from the beginning. Your ad plugin will need to trigger `adsready` again, for example. Note that when changing sources, the playback state of the player is retained: if the previous source was playing, the new source will also be playing and the ad workflow will not wait for a new `play` event.
|
||||
|
||||
## How your ad plugin talks to contrib-ads
|
||||
|
||||
Your ad plugin can invoke these methods and events to play (or skip) ads. See [Getting Started](getting-started.md) for more information.
|
||||
|
||||
* `adsready` (EVENT) -- Trigger this event to indicate that the ad plugin is ready to play prerolls. `readyforpreroll` will not be sent until after you trigger `adsready`, but it may not be sent right away (for example, if the user has not clicked play yet). A timeout can occur while waiting for `adsready`. You will need to trigger `adsready` again if you load a new content source.
|
||||
* `startLinearAdMode()` (METHOD) -- Invoke this method to start an ad break.
|
||||
* For a preroll ad, you can invoke `startLinearAdMode` after the `readyforpreroll` event if `isWaitingForAdBreak()` is true.
|
||||
* For a midroll ad, you can invoke `startLinearAdMode` during content playback if `isInAdMode()` is false.
|
||||
* For a postroll ad, you can invoke `startLinearAdMode` after the `readyforpostroll` event if `isWaitingForAdBreak()` is true.
|
||||
* `ads-ad-started` (event) -- Trigger this event during an ad break to indicate that an ad has actually started playing. This will hide the loading spinner. It is possible for an ad break to end without playing any ads.
|
||||
* `endLinearAdMode()` (method) -- Invoke this method to end an ad break. This will cause content to resume. You can check if an ad break is active using `inAdBreak()`.
|
||||
* `skipLinearAdMode()` (METHOD) -- At a time when `startLinearAdMode()` is expected, calling `skipLinearAdMode()` will immediately resume content playback instead.
|
||||
* `nopreroll` (EVENT) -- You can trigger this event even before `readyforpreroll` to indicate that no preroll will play. The ad plugin will not check for prerolls and will instead begin content playback after the `play` event (or immediately, if playback was already requested).
|
||||
* `nopostroll` (EVENT) -- Similar to `nopreroll`, you can trigger this event even before `readyforpostroll` to indicate that no postroll will play. The ad plugin will not wait for a postroll to play and will instead immediately trigger the `ended` event.
|
||||
* `contentresumed` (EVENT) - If your ad plugin does not result in a "playing" event when resuming content after an ad, send this event to signal that content has resumed. This was added to support stitched ads and is not normally necessary because content will result in a `playing` event when it resumes.
|
||||
|
||||
## Advanced Properties
|
||||
|
||||
Once the plugin is initialized, there are a couple properties you can
|
||||
access modify its behavior.
|
||||
|
||||
### contentSrc
|
||||
|
||||
In order to detect changes to the content video, videojs-contrib-ads
|
||||
monitors the src attribute of the player. If you need to make a change
|
||||
to the src attribute during content playback that should *not* be
|
||||
interpreted as loading a new video, you can update this property with
|
||||
the new source you will be loading:
|
||||
|
||||
```js
|
||||
// you might want to switch from a low bitrate version of a video to a
|
||||
// higher quality one at the user's request without forcing them to
|
||||
// re-watch all the ad breaks they've already viewed
|
||||
|
||||
// first, you'd update contentSrc on the ads plugin to the URL of the
|
||||
// higher bitrate rendition:
|
||||
player.ads.contentSrc = 'movie-high.mp4';
|
||||
|
||||
// then, modify the src attribute as usual
|
||||
player.src('movie-high.mp4');
|
||||
```
|
||||
|
||||
### disableNextSnapshotRestore
|
||||
|
||||
Advanced option. Prevents videojs-contrib-ads from restoring the previous video source.
|
||||
|
||||
If you need to change the video source during an ad break, you can use _disableNextSnapshotRestore_ to prevent videojs-contrib-ads from restoring the snapshot from the previous video source.
|
||||
```js
|
||||
if (player.ads.inAdBreak()) {
|
||||
player.ads.disableNextSnapshotRestore = true;
|
||||
player.src('another-video.mp4');
|
||||
}
|
||||
```
|
||||
|
||||
## Deprecated
|
||||
|
||||
The following are slated for removal from contrib-ads and will have no special behavior once removed. These should no longer be used in integrating ad plugins. Replacements are provided for matching functionality that will continue to be supported.
|
||||
|
||||
* `contentupdate` (EVENT) -- In the future, contrib-ads will no longer trigger this event. Listen to the new `contentchanged` event instead; it is is more reliable.
|
||||
* `adscanceled` (EVENT) -- In the future, this event will no longer result in special behavior in contrib-ads. It was intended to cancel all ads, but it was never fully implemented. Instead, trigger `nopreroll` and `nopostroll`.
|
||||
* `adserror` (EVENT) -- In the future, this event will no longer result in special behavior in contrib-ads. Today, this event skips prerolls when seen before a preroll ad break. It skips postrolls if seen after `readyforpostroll` and before a postroll ad break. It ends linear ad mode if seen during an ad break. These behaviors should be replaced using `skipLinearAdMode` and `endLinearAdMode` in the ad plugin.
|
||||
* `adplaying` (EVENT) -- In the future, this event is no longer guaranteed to happen once per ad break. Your ad plugin should trigger a `ads-pod-started` event to indicate the beginning of an ad break. The `ads-ad-started` event can be used to indicate the start of an individual ad in an ad break. There should be multiple `ads-ad-started` events corresponding to each ad in the ad break.
|
||||
* `isAdPlaying()` (METHOD) -- Does the same thing as `inAdBreak` but has a misleading name. Being in an ad break doesn't strictly mean that an ad is playing.
|
||||
* `contentended` (EVENT) -- This used to be the event that was used to indicate that content had ended and that it was time to play postrolls. The name was confusing because the content prefix is usually used during content restoration after an ad. Integrations should use `readyforpostroll` instead. In the future, the meaning of `contentended` will be updated to match what is expected by the prefix.
|
18
node_modules/videojs-contrib-ads/docs/integrator/autoplay.md
generated
vendored
Normal file
18
node_modules/videojs-contrib-ads/docs/integrator/autoplay.md
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Autoplay
|
||||
|
||||
Using the `autoplay` attribute on the video element is not supported. Due to Autoplay Restrictions introduced by browsers, such as [Safari](https://webkit.org/blog/7734/auto-play-policy-changes-for-macos/) and [Chrome](https://developers.google.com/web/updates/2017/09/autoplay-policy-changes), using the `autoplay` attribute on the player will often not behave as expected. The recommended [best practice](https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#best-practices) is to use the `player.play()` method to autoplay.
|
||||
|
||||
Contrib Ads blocks play requests so that prerolls can be handled. To get access to the [play promise](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play), you must wait until the `play` event. For example:
|
||||
|
||||
```js
|
||||
player.on('play', () => {
|
||||
var playPromise = player.play();
|
||||
|
||||
playPromise.then(() => {
|
||||
// play succeeded
|
||||
})
|
||||
.catch(() => {
|
||||
// play failed
|
||||
});
|
||||
});
|
||||
```
|
37
node_modules/videojs-contrib-ads/docs/integrator/common-interface.md
generated
vendored
Normal file
37
node_modules/videojs-contrib-ads/docs/integrator/common-interface.md
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Common Interface
|
||||
|
||||
videojs-contrib-ads does not implement these. This page establishes a convention used some some ad plugins that you may want to consider sending for consistency as they may be useful.
|
||||
|
||||
## Events
|
||||
|
||||
* `ads-request`: Fired when ad data is requested.
|
||||
* `ads-load`: Fired when ad data is available following an ad request.
|
||||
* `ads-pod-started`: Fired when a LINEAR ad pod has started.
|
||||
* `ads-pod-ended`: Fired when a LINEAR ad pod has completed.
|
||||
* `ads-allpods-completed`: Fired when all LINEAR ads are completed.
|
||||
* `ads-ad-started`: Fired when the ad starts playing. Should include the event parameter `indexInBreak`.
|
||||
* `ads-ad-ended`: Fired when the ad completes playing.
|
||||
* `ads-first-quartile`: Fired when the ad playhead crosses first quartile.
|
||||
* `ads-midpoint`: Fired when the ad playhead crosses midpoint.
|
||||
* `ads-third-quartile`: Fired when the ad playhead crosses third quartile.
|
||||
* `ads-pause`: Fired when the ad is paused.
|
||||
* `ads-play`: Fired when the ad is resumed.
|
||||
* `ads-mute`: Fired when the ad volume has been muted.
|
||||
* `ads-click`: Fired when the ad is clicked.
|
||||
|
||||
## Properties
|
||||
|
||||
```js
|
||||
player.ads.provider = {
|
||||
"type": `String`,
|
||||
"event": `Object`
|
||||
}
|
||||
|
||||
player.ads.ad = {
|
||||
"type": `String`,
|
||||
"index": `Number`,
|
||||
"id": `String`,
|
||||
"duration": `Number`,
|
||||
"currentTime": `Function`
|
||||
}
|
||||
```
|
42
node_modules/videojs-contrib-ads/docs/integrator/cue-text-tracks.md
generated
vendored
Normal file
42
node_modules/videojs-contrib-ads/docs/integrator/cue-text-tracks.md
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
# Cue Text Tracks
|
||||
|
||||
An optional feature that allows the manipulation of metadata tracks, specifically in the case of working with advertising cue points.
|
||||
|
||||
For example, an ad plugin may want to make an ad request when a cuepoint change has been observed. To do this, an ad plugin would need to do something like this:
|
||||
|
||||
`player.ads.cueTextTracks.processMetadataTracks(player, processMetadataTrack)`
|
||||
|
||||
where processMetadataTrack could be something like this:
|
||||
|
||||
```js
|
||||
function processMetadataTrack(player, track) {
|
||||
track.addEventListener('cuechange', function() {
|
||||
var cues = this.cues;
|
||||
var processCue = function() {
|
||||
// Make an ad request
|
||||
...
|
||||
};
|
||||
var cancelAds = function() {
|
||||
// Optional method to dynamically cancel ads
|
||||
// This will depend on the ad implementation
|
||||
...
|
||||
};
|
||||
|
||||
player.ads.cueTextTracks.processAdTrack(player, cues, processCue, cancelAds);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
For more information on the utility methods that are available, see [cueTextTracks.js](https://github.com/videojs/videojs-contrib-ads/blob/master/src/cueTextTracks.js).
|
||||
|
||||
## setMetadataTrackMode
|
||||
|
||||
A track is 'enabled' if the track.mode is set to `hidden` or `showing`. Otherwise, a track is `disabled` and is not updated. It is important to note that some tracks may be disabled as a workaround of not being able to remove them, and so should not be re-enabled. Ad plugins should be careful about setting the mode of tracks in these cases and shadow `setMetadataTrackMode` to determine which tracks are safe to change. For example, if all tracks should be hidden:
|
||||
|
||||
```js
|
||||
player.ads.cueTextTracks.setMetadataTrackMode = function(track) {
|
||||
// Hide the tracks so they are enabled and get updated
|
||||
// but are not shown in the UI
|
||||
track.mode = 'hidden';
|
||||
}
|
||||
```
|
113
node_modules/videojs-contrib-ads/docs/integrator/getting-started.md
generated
vendored
Normal file
113
node_modules/videojs-contrib-ads/docs/integrator/getting-started.md
generated
vendored
Normal file
|
@ -0,0 +1,113 @@
|
|||
# Getting Started
|
||||
|
||||
## Installation
|
||||
|
||||
### Install From NPM
|
||||
|
||||
```sh
|
||||
npm install videojs-contrib-ads
|
||||
```
|
||||
|
||||
### Using a module bundler
|
||||
|
||||
This is the recommended approach. If you are including `videojs-contrib-ads` using a module bundler such as [webpack](https://webpack.js.org/), this example is a useful starting point:
|
||||
|
||||
[https://github.com/videojs/videojs-contrib-ads/blob/master/examples/module-import/entry.js](https://github.com/videojs/videojs-contrib-ads/blob/master/examples/module-import/entry.js)
|
||||
|
||||
With this basic structure in place, you're ready to develop an ad plugin.
|
||||
|
||||
### Including the files in your HTML
|
||||
|
||||
This is not the recommended approach, but may be useful in some cases. In addition to the video.js library, you'll need two files from this project: `videojs.ads.js` and `videojs.ads.css`. After you [build the project](/developer/getting-started.md) they are both in the `dist` directory.
|
||||
|
||||
Include the CSS in your HTML's `<head>` section with a `<link>` tag:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="videojs.ads.css">
|
||||
```
|
||||
|
||||
Then, include the JavaScript file after video.js, but before your ad plugin code:
|
||||
|
||||
```html
|
||||
<video id="video" src="movie.mp4" controls></video>
|
||||
<script src="video.js"></script>
|
||||
<script src="videojs.ads.js"></script>
|
||||
<script>
|
||||
videojs('video', {}, function() {
|
||||
var player = this;
|
||||
player.ads(); // initialize videojs-contrib-ads
|
||||
// your custom ad plugin code
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
### CDN Link
|
||||
|
||||
You may also use the Javascript and CSS links from the following to get started:
|
||||
[https://cdnjs.com/libraries/videojs-contrib-ads](https://cdnjs.com/libraries/videojs-contrib-ads)
|
||||
|
||||
## Important Note About Initialization
|
||||
|
||||
In order to function correctly, videojs-contrib-ads must be initialized immediately after video.js (in the same [tick](http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/)). This is for two reasons:
|
||||
|
||||
* This plugin relies on `loadstart` events, and initializing the plugin late means the plugin may miss an initial `loadstart`.
|
||||
* For [Redispatch](redispatch.md) to function it must be initialized before any other code that listens to media events.
|
||||
|
||||
The plugin will emit an error if it detects that it it missed a `loadstart` event. If this happens, it is likely that downstream failures will occur, so it's important to resolve this issue.
|
||||
|
||||
## Developing an Ad Plugin
|
||||
|
||||
First you call `player.ads()` to initialize the plugin. Afterwards, the flow of interaction between your ad plugin and contrib-ads might look like this:
|
||||
|
||||
* Player triggers `play` (EVENT) -- This media event is triggered when there is a request to play your player. videojs-contrib-ads responds by preventing content playback and showing a loading spinner.
|
||||
* Ad Plugin triggers `adsready` (EVENT) -- Your ad plugin should trigger this event on the player to indicate that it is initialized. This can happen before or after the `play` event.
|
||||
* Contrib Ads triggers `readyforpreroll` (EVENT) -- This event is fired after both `play` and `adsready` have ocurred. This signals that the ad plugin may begin an ad break by calling `startLinearAdMode`.
|
||||
* Ad plugin calls `player.ads.startLinearAdMode()` (METHOD) -- This begins an ad break. During this time, your ad plugin plays ads. videojs-contrib-ads does not handle actual ad playback.
|
||||
* Ad plugin triggers `ads-ad-started` (EVENT) - Trigger this when each individual ad begins. This removes the loading spinner, which otherwise stays up until the end of the ad break. [More information](common-interface.md).
|
||||
* Ad plugin calls `player.ads.endLinearAdMode()` (METHOD) -- This ends an ad break. As a result, content will play.
|
||||
* Content plays.
|
||||
* To play a Midroll ad, start and end an ad break with `player.ads.startLinearAdMode()` and `player.ads.endLinearAdMode()` at any time during content playback.
|
||||
* Contrib Ads triggers `readyforpostroll` (EVENT) -- This event means that it's time to play a postroll ad.
|
||||
* To play a Postroll ad, start and end an ad break with `player.ads.startLinearAdMode()` and `player.ads.endLinearAdMode()`.
|
||||
* Contrib Ads triggers `ended` (EVENT) -- This standard media event happens when all ads and content have completed. After this, no additional ads are expected, even if the user seeks backwards.
|
||||
|
||||
This is the basic flow for a simple use case, but there are other things the ad plugin can do. Refer to the [API reference](api.md) for more information.
|
||||
|
||||
## Single Preroll Example
|
||||
|
||||
Here's an outline of what a basic ad plugin might look like.
|
||||
It only plays a single preroll ad before each content video, but does demonstrate the interaction points offered by the ads plugin.
|
||||
|
||||
```js
|
||||
player.ads(); // initialize videojs-contrib-ads
|
||||
|
||||
// request ads whenever there's new video content
|
||||
player.on('contentchanged', function() {
|
||||
// in a real plugin, you might fetch new ad inventory here
|
||||
player.trigger('adsready');
|
||||
});
|
||||
|
||||
player.on('readyforpreroll', function() {
|
||||
player.ads.startLinearAdMode();
|
||||
// play your linear ad content
|
||||
// in this example, we use a static mp4
|
||||
player.src('kitteh.mp4');
|
||||
|
||||
// send event when ad is playing to remove loading spinner
|
||||
player.one('adplaying', function() {
|
||||
player.trigger('ads-ad-started');
|
||||
});
|
||||
|
||||
// resume content when all your linear ads have finished
|
||||
player.one('adended', function() {
|
||||
player.ads.endLinearAdMode();
|
||||
});
|
||||
});
|
||||
|
||||
// in a real plugin, you might fetch ad inventory here
|
||||
player.trigger('adsready');
|
||||
```
|
||||
|
||||
To implement midroll ads, you might listen to `timeupdate` events to monitor the progress of the content video's playback. To implement postroll ads, you'd listen to the `readyforpostroll` event.
|
||||
|
||||
For a more involved example that plays both prerolls and midrolls, see the [examples directory](https://github.com/videojs/videojs-contrib-ads/tree/master/examples) in this project. For more detailed information about what events and methods are available, see the [API reference](api.md).
|
16
node_modules/videojs-contrib-ads/docs/integrator/index.md
generated
vendored
Normal file
16
node_modules/videojs-contrib-ads/docs/integrator/index.md
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Integrator Documentation
|
||||
|
||||
If you are building an ad plugin using videojs-contrib-ads, this documentation is for you.
|
||||
|
||||
* [Getting Started](./getting-started.md)
|
||||
* [Plugin Options](./options.md)
|
||||
* [API Reference](./api.md)
|
||||
* [Ad Mode](./ad-mode.md)
|
||||
* [Common Interface](./common-interface.md)
|
||||
* [Migration Guides](/migration.md)
|
||||
* [Autoplay](/autoplay.md)
|
||||
* Features
|
||||
* [Snapshot](./snapshot.md)
|
||||
* [Redispatch](./redispatch.md)
|
||||
* [Macros](./macros.md)
|
||||
* [Cue Text Tracks](./cue-text-tracks.md)
|
90
node_modules/videojs-contrib-ads/docs/integrator/macros.md
generated
vendored
Normal file
90
node_modules/videojs-contrib-ads/docs/integrator/macros.md
generated
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
# Macros
|
||||
|
||||
An optional feature that contrib-ads supports is ad macros. Ad macros are often used by ad plugins to support addition of run-time values into a server URL or configuration.
|
||||
|
||||
For example, an ad plugin that supports this feature might accept an ad server URL like this:
|
||||
|
||||
`'http://example.com/vmap.xml?id={player.id}'`
|
||||
|
||||
In the ad plugin code, it would use the videojs-contrib-ads macro feature to process that URL like this:
|
||||
|
||||
`serverUrl = player.ads.adMacroReplacement(serverUrl, true, additionalMacros);`
|
||||
|
||||
This would result in a server URL like this:
|
||||
|
||||
`'http://example.com/vmap.xml?id=12345'`
|
||||
|
||||
where 12345 is the player ID.
|
||||
|
||||
adMacroReplacement takes 3 arguments:
|
||||
|
||||
1. The string that has macros to be replaced.
|
||||
2. `true` if the macro values should be URI encoded when they are inserted, else `false` (default `false`)
|
||||
3. An optional object that defines additional macros, such as `{'{five}': 5}` (default `{}`)
|
||||
|
||||
## Static Macros
|
||||
|
||||
| Name | Value |
|
||||
|:-------------------------|:----------------------------------|
|
||||
| {player.id} | The player ID |
|
||||
| {player.width} | The current player width |
|
||||
| {player.height} | The current player height |
|
||||
| {player.duration} | The duration of current video * |
|
||||
| {player.pageUrl} | The page URL ** *** |
|
||||
| {timestamp} | Current epoch time |
|
||||
| {document.referrer} | Value of document.referrer *** |
|
||||
| {window.location.href} | Value of window.location.href |
|
||||
| {random} | A random number 0-1 trillion |
|
||||
| {mediainfo.id} | Pulled from mediainfo object |
|
||||
| {mediainfo.name} | Pulled from mediainfo object |
|
||||
| {mediainfo.description} | Pulled from mediainfo object |
|
||||
| {mediainfo.tags} | Pulled from mediainfo object |
|
||||
| {mediainfo.reference_id} | Pulled from mediainfo object |
|
||||
| {mediainfo.duration} | Pulled from mediainfo object |
|
||||
| {mediainfo.ad_keys} | Pulled from mediainfo object |
|
||||
| {playlistinfo.id} | Pulled from playlistinfo object |
|
||||
| {playlistinfo.name} | Pulled from playlistinfo object |
|
||||
|
||||
\* Returns 0 if video is not loaded. Be careful timing your ad request with this macro.
|
||||
|
||||
\** Returns document referrer if in an iframe otherwise window location.
|
||||
|
||||
\*** Document referrer may not return the full URL depending on the effective [referrer policy][referrer-policy].
|
||||
|
||||
## Dynamic Macro: mediainfo.custom_fields.*
|
||||
|
||||
A macro such as {mediainfo.custom_fields.foobar} allows the user to access the value of any property in `mediainfo.custom_fields`.
|
||||
|
||||
## Dynamic Macro: pageVariable.*
|
||||
|
||||
A macro such as {pageVariable.foobar} allows the user access the value of any property on the `window` object. Only certain value types are allowed, per this table:
|
||||
|
||||
| Type | What happens |
|
||||
|:----------|:--------------------------------------|
|
||||
| String | Used without any change |
|
||||
| Number | Converted to string automatically |
|
||||
| Boolean | Converted to string automatically |
|
||||
| Null | Returns the string `"null"` |
|
||||
| Undefined | Logs warning and returns empty string |
|
||||
| Other | Logs warning and returns empty string |
|
||||
|
||||
## TCF macros
|
||||
|
||||
If a CMP supporting the [GDPR Transparency and Consent Framework][tcf] is in use additional tcf macros are made available. The syntax is `{tcf.*}`, with `*` being a property in the [tcData][tcdata] object. Most commonly used will be:
|
||||
|
||||
| Name | Value |
|
||||
|:-------------------------|:--------------------------------------------|
|
||||
| {tcf.gdprApplies} | Whether GDPR applies to the current session |
|
||||
| {tcf.tcString} | The consent string |
|
||||
|
||||
Since `gdprApplies` is a boolean and many ad servers expect the value as an int, an additional `{tcf.gdprAppliesInt}` is provided which will return `1` or `0`.
|
||||
|
||||
If the player is in an iframe, a proxy will be added if any parent frame is detected to gain consent with the postmessage API. The CMP must be loaded first.
|
||||
|
||||
## Default values in macros
|
||||
|
||||
A default value can be provided within a macro, in which case this value will be used where not resolvable e.g. `http://example.com/ad/{pageVariable.adConf=1234}` becomes `http://example.com/ad/1234` if `window.adConf` is undefined.
|
||||
|
||||
[tcf]: https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md
|
||||
[tcdata]: https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#tcdata
|
||||
[referrer-policy]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
|
24
node_modules/videojs-contrib-ads/docs/integrator/migration-guides/migrating-to-2.0.md
generated
vendored
Normal file
24
node_modules/videojs-contrib-ads/docs/integrator/migration-guides/migrating-to-2.0.md
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Guidance for Ad Plugin Maintainers
|
||||
One of the best features of video.js is the community of plugins and customizations that has built up around it.
|
||||
Ad support is an important part of that ecosystem but not all plugin authors write with advertisements in mind (and we probably won't be able to convince them to start).
|
||||
Rather than throw our hands in the air, we're making some big changes in [videojs-contrib-ads](https://github.com/videojs/videojs-contrib-ads) to make advertisements more compatible with the rest of the video.js universe.
|
||||
In version 2.0 of the plugin, we redispatch events with different prefixes depending on whether an ad is playing or not.
|
||||
When an ad is playing, events are prefixed with `ad` and when content is resuming after an ad break, events are prefixed with `content`.
|
||||
A `pause` event during an ad would become an `adpause` event, for instance.
|
||||
This means from the perspective of a (non-ad) plugin author, video.js will behave just the same whether ads are playing or not.
|
||||
And if someoene wants to write a plugin that is ad-aware, those original events are still available for them to hook into.
|
||||
|
||||
## Migration
|
||||
If you've written your own ad plugin on top of videojs-contrib-ads, there's a couple things you should do to prepare for the upgrade:
|
||||
|
||||
- Apply the appropriate prefix to your event handlers.
|
||||
If you were listening for `timeupdate` events during ad playback, you should now be listening for `adtimeupdate`.
|
||||
Video events that occur during content playback are unaffected.
|
||||
- Listen for `contentended` to trigger postrolls instead of `ended`.
|
||||
When the content is playing, the `ended` event gets captured and redispatched as `contentended` so that other plugins don't see multiple `ended` events for the same video.
|
||||
After the content and postrolls have finished, contrib-ads will fire an `ended` event.
|
||||
- Advise your users to include and initialize your plugin before they fire up other plugins.
|
||||
contrib-ads will take care of redispatching events but it can't hide them for plugins that are registered earlier in the listener chain.
|
||||
|
||||
The extended support for postrolls added a new `postrollTimeout` option, similar to prerolls.
|
||||
If you do not wish to play a postroll for a video, you can fire `adtimeout` to proceed to the next video immediately.
|
17
node_modules/videojs-contrib-ads/docs/integrator/migration-guides/migrating-to-3.0.md
generated
vendored
Normal file
17
node_modules/videojs-contrib-ads/docs/integrator/migration-guides/migrating-to-3.0.md
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Migrating to videojs-contrib-ads 3.0.0
|
||||
|
||||
One of the best features of video.js is the community of plugins and customizations that has built up around it.
|
||||
|
||||
Version 3 of the videojs-contrib-ads plugin is primarily about compatibility with video.js 5 (and, therefore, non-compatibility with video.js 4). Refer to the "[5.0 Change Details](https://github.com/videojs/video.js/wiki/5.0-Change-Details)" document for more on that change.
|
||||
|
||||
## Migration
|
||||
|
||||
For the most part, ad plugin maintainers will only need to follow the video.js 5 migration changes.
|
||||
|
||||
However, there are a few minor changes to videojs-contrib-ads, which are unlikely to affect anyone using the plugin:
|
||||
|
||||
- The timer used to trigger an `'adtimeout'` event has been moved to a different property. It is no longer `player.ads.timeout`, but `player.ads.adTimeoutTimeout`. This naming change is less vague and more in line with other timers.
|
||||
|
||||
- A new timer is exposed for triggering a synthetic `'ended'` event, `player.ads.resumeEndedTimeout`.
|
||||
|
||||
- Internally, timers are now tracked universally using `setTimeout` rather than a mix of `setTimeout`, `requestAnimationFrame`, and the non-standard `setImmediate`. This is not only simpler, but it makes testing easier and more reliable/robust.
|
18
node_modules/videojs-contrib-ads/docs/integrator/migration-guides/migrating-to-4.0.md
generated
vendored
Normal file
18
node_modules/videojs-contrib-ads/docs/integrator/migration-guides/migrating-to-4.0.md
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Migrating to videojs-contrib-ads 4.0.0
|
||||
|
||||
Version 4 of videojs-contrib-ads is mainly about improving code quality. Functional
|
||||
changes are in support of that effort.
|
||||
|
||||
## Migration
|
||||
|
||||
* A `playing` event is no longer sent before a preroll ad. This is because a `playing`
|
||||
event should only be sent when content actually plays. If your ad plugin relies on
|
||||
this event being fired at this time, consider another solution.
|
||||
* Contrib-ads expects your plugin to send a "playing" event when an ad starts playing,
|
||||
which will be redispatched as "adplaying". This may happen automatically, for example,
|
||||
if you play your ad in the content's `video` element.
|
||||
* The `contentplayback` event has been removed. Use `playing` instead.
|
||||
* `videojs.ads.global.js` and `videojs.ads.global.min.js` have been removed. Use
|
||||
`videojs.ads.js` or `videojs.ads.min.js` instead.
|
||||
* `videojs.ads.css` is now available in the `dist` folder rather than the `src` folder.
|
||||
Your ad plugin should be updated to include it from there.
|
13
node_modules/videojs-contrib-ads/docs/integrator/migration-guides/migrating-to-5.0.md
generated
vendored
Normal file
13
node_modules/videojs-contrib-ads/docs/integrator/migration-guides/migrating-to-5.0.md
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Migrating to videojs-contrib-ads 5.0.0
|
||||
|
||||
Version 5 of videojs-contrib-ads includes a rewrite of the Redispatch feature. The goal of
|
||||
this rewrite was to provide reliable, maintainable, well-documented, and well-tested
|
||||
functionality.
|
||||
|
||||
## Migration
|
||||
|
||||
* [The behavior of Redispatch is now documented](https://github.com/videojs/videojs-contrib-ads#redispatch). You should review this documentation and confirm that your ad plugin does not have expectations that conflict with the documented behavior.
|
||||
* When there is no preroll, you may no longer see extra play events. If your ad plugin relies on play events at the start of a video, you should verify its behavior.
|
||||
* The definition of [ad mode](https://github.com/videojs/videojs-contrib-ads#ad-mode-definition) is now documented and consistent. As a result, you may find events that were unprefixed* during ad mode in previous versions that are now prefixed. Any code that listens to unprefixed events during ad mode should be checked.
|
||||
|
||||
*An unprefixed event is a normal [media event](https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events) while a prefixed event is one that has been redispatched. For example, `play` is unprefixed and `adplay` is prefixed.
|
54
node_modules/videojs-contrib-ads/docs/integrator/migration-guides/migrating-to-6.0.md
generated
vendored
Normal file
54
node_modules/videojs-contrib-ads/docs/integrator/migration-guides/migrating-to-6.0.md
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
# Migrating to videojs-contrib-ads 6.0.0
|
||||
|
||||
Version 6 of videojs-contrib-ads includes a major refactor and cleanup of the state management logic.
|
||||
|
||||
## Migration
|
||||
|
||||
* Timeouts have a more intuitive behavior. See the "Timeout behavior changes" section below for more information.
|
||||
* Ended events are no longer delayed by 1 second.
|
||||
* Ended events due to an ad ending will no longer be allowed to replace the ended event
|
||||
that is triggered by linear ad mode ending. Ad plugins must not emit ended events
|
||||
after the end of linear ad mode.
|
||||
* There will no longer be a `contentended` event when content ends after the first time content ends.
|
||||
* `ads.state` has been removed. Methods have been added to replace state checks, such as `ads.isInAdMode()`. See the documentation for a [list of available methods](http://videojs.github.io/videojs-contrib-ads/integrator/api.html). `ads._state` has been
|
||||
added, but it is not compatible with the old `ads.state` and should not be inspected by ad plugins.
|
||||
* The event parameter `triggerevent` has been removed. It is unlikely that ad plugins used it, but any usage must be migrated.
|
||||
* We no longer trigger a `readyforpreroll` event after receiving a `nopreroll` event.
|
||||
* adTimeoutTimeout has been removed. It was not part of the documented interface, but make note if your ad plugin inspected it.
|
||||
* There is no longer a snapshot object while checking for postrolls. Now a snapshot is only taken when a postroll ad break actually begins.
|
||||
* The `contentplayback` event (removed in [4.0.0](https://github.com/videojs/videojs-contrib-ads/blob/cc664517aa0d07398decc0aa5d41974330efc4e4/CHANGELOG.md#400), re-added as deprecated in [4.1.1](https://github.com/videojs/videojs-contrib-ads/blob/cc664517aa0d07398decc0aa5d41974330efc4e4/CHANGELOG.md#411)), has been removed. Use the `playing` event instead.
|
||||
* The `adplaying` behavior is an implementation detail and has changed in this update. The `adplaying` event is no longer guaranteed to happen once per ad break. It is not intended to be used to detect the beginning of an ad break. The `ads-pod-started` event should be used instead. The `ads-ad-started` event can be used to detect the start of an individual ad in an ad break. There will be multiple `ads-ad-started` events corresponding to each ad in the ad break.
|
||||
|
||||
## Deprecation
|
||||
|
||||
Deprecated interfaces will be removed in a future major version update.
|
||||
|
||||
* `contentupdate` is now deprecated. It has been replaced by `contentchanged`. `contentupdate` was never intended to fire for the initial source, but over time its behavior eroded. To make migration easier for anyone who depends on the current behavior, we're providing a deprecation period and a new event with correct behavior.
|
||||
* `adscanceled` is now deprecated. Instead, use `nopreroll` and `nopostroll`. `adscanceled` was initially intended to function similarly to calling both `nopreroll` and `nopostroll` but it was never fully implemented.
|
||||
* `adserror` is now deprecated. Currently this event will skip prerolls when seen before a preroll ad break, skip postrolls if called after contentended and before a postroll ad break, and end linear ad mode if seen during an ad break. It is more declarative for the ad plugin to do these things explicitly with `skipLinearAdMode` and `endLinearAdMode`. In the future, this event will not have any special behavior in contrib-ads. Ad plugins may continue to use it for other purposes.
|
||||
|
||||
## Timeout behavior changes
|
||||
|
||||
Previous behavior:
|
||||
|
||||
* The `timeout` setting was the number of milliseconds that we waited for `adsready` after the `play` event if `adsready` was not before `play`.
|
||||
* The `prerollTimeout` setting was the number of milliseconds we waited for `startLinearAdMode` after `readyforpreroll`. It was a separate timeout period after `timeout`.
|
||||
* The `postrollTimeout` setting was the number of milliseconds we waited for `startLinearAdMode` after `contentended`.
|
||||
|
||||
Previous Defaults:
|
||||
|
||||
* timeout: 5000
|
||||
* prerollTimeout: 100
|
||||
* postrollTimeout: 100
|
||||
|
||||
New Behavior:
|
||||
|
||||
* The `timeout` setting is now the default setting for all timeouts. It can be overridden by `prerollTimeout` and/or `postrollTimeout`.
|
||||
* `prerollTimeout` overrides `timeout` for the number of milliseconds we wait for a preroll ad (the time between `play` and `startLinearAdMode`).
|
||||
* `postrollTimeout` overrides `timeout` for the number of milliseconds we wait for a postroll ad (the time between `contentended` and `startLinearAdMode`).
|
||||
|
||||
New Defaults:
|
||||
|
||||
* timeout: 5000
|
||||
* prerollTimeout: no default
|
||||
* postrollTimeout: no default
|
9
node_modules/videojs-contrib-ads/docs/integrator/migration.md
generated
vendored
Normal file
9
node_modules/videojs-contrib-ads/docs/integrator/migration.md
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Migration Guides
|
||||
|
||||
When updating an ad plugin's dependency on videojs-contrib-ads accross [major version](https://semver.org/) updates, refer to these migration guides in order to understand what changes may be necessary.
|
||||
|
||||
* [Migrating to 2.0](migration-guides/migrating-to-2.0.md)
|
||||
* [Migrating to 3.0](migration-guides/migrating-to-3.0.md)
|
||||
* [Migrating to 4.0](migration-guides/migrating-to-4.0.md)
|
||||
* [Migrating to 5.0](migration-guides/migrating-to-5.0.md)
|
||||
* [Migrating to 6.0](migration-guides/migrating-to-6.0.md)
|
72
node_modules/videojs-contrib-ads/docs/integrator/options.md
generated
vendored
Normal file
72
node_modules/videojs-contrib-ads/docs/integrator/options.md
generated
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
## Plugin Options
|
||||
|
||||
videojs-contrib-ads can be configured with custom settings by providing a settings object at initialization:
|
||||
|
||||
```js
|
||||
player.ads({
|
||||
timeout: 3000
|
||||
});
|
||||
```
|
||||
|
||||
The current set of options are described in detail below.
|
||||
|
||||
### timeout
|
||||
|
||||
Type: `number`
|
||||
Default Value: 5000
|
||||
|
||||
The maximum amount of time to wait in ad mode before an ad break begins. If this time elapses, ad mode ends and content resumes.
|
||||
|
||||
Some ad plugins may want to play a preroll ad even after the timeout has expired and content has begun playing. To facilitate this, videojs-contrib-ads will respond to an `adsready` event during content playback with a `readyforpreroll` event. If you want to avoid this behavior, make sure your plugin does not send `adsready` after `adtimeout`.
|
||||
|
||||
### prerollTimeout
|
||||
|
||||
Type: `number`
|
||||
No Default Value
|
||||
|
||||
Override the `timeout` setting just for preroll ads (the time between `play` and `startLinearAdMode`)
|
||||
|
||||
### postrollTimeout
|
||||
|
||||
Type: `number`
|
||||
No Default Value
|
||||
|
||||
Override the `timeout` setting just for preroll ads (the time between `readyforpostroll` and `startLinearAdMode`)
|
||||
|
||||
### stitchedAds
|
||||
|
||||
Type: `boolean`
|
||||
Default Value: `false`
|
||||
|
||||
Set this to true if you are using ads stitched into the content video. This is necessary for ad events to be sent correctly.
|
||||
|
||||
### liveCuePoints
|
||||
|
||||
Type: `boolean`
|
||||
Default Value: `true`
|
||||
|
||||
If set to `true`, content will play muted behind ads on supported platforms when the content is detected to be a live stream. This is to support ads on live video metadata cuepoints. It also results in more precise resumes after ads in this scenario. If set to `false`, the [snapshot](snapshot.md) feature will be used to restore content to its previous state after an ad break.
|
||||
|
||||
Note: In a future major version update, we plan to change the default to `false` because we believe this reflects a more intuitive and common default behavior. The default is `true` for backwards compatibility. If you want to avoid having to migrate in the future, you might consider setting an explicit value for `liveCuePoints` instead of relying on the default.
|
||||
|
||||
### contentIsLive
|
||||
|
||||
Type: `boolean`
|
||||
No Default Value
|
||||
|
||||
Use this to override detection of if the content video is a live stream. Live detection checks if the duration is `Infinity` but there are cases when this check is insufficient.
|
||||
|
||||
### allowVjsAutoplay
|
||||
|
||||
Type: `boolean`
|
||||
Default Value: `videojs.options.normalizeAutoplay || false`
|
||||
|
||||
Set this to `true` if you intend to use video.js's custom autoplay settings ("play", "muted", or "any"). It defaults to `true` if the videojs `normalizeAutoplay` option is `true` since `normalizeAutoplay` signals an intent to use `autoplay: "play"` behavior.
|
||||
|
||||
### debug
|
||||
|
||||
Type: `boolean`
|
||||
Default Value: `false`
|
||||
|
||||
If debug is set to true, the ads plugin will output additional debugging information.
|
||||
This can be handy for diagnosing issues or unexpected behavior in an ad plugin.
|
46
node_modules/videojs-contrib-ads/docs/integrator/redispatch.md
generated
vendored
Normal file
46
node_modules/videojs-contrib-ads/docs/integrator/redispatch.md
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
# Redispatch
|
||||
|
||||
This project includes a feature called `redispatch` which will monitor all [media
|
||||
events](https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events) and modify them with the goal of making the usage of ads transparent. For example, in ad mode, a `playing` event would be sent as an `adplaying` event. Code that listens to the `playing` event will not see `playing` events that result from an advertisement playing.
|
||||
|
||||
In order for redispatch to work correctly, any ad plugin built using contrib-ads must be initialized as soon as possible, before any other plugins that attach event listeners.
|
||||
|
||||
Different platforms, browsers, devices, etc. send different media events at different times. Redispatch does not guarantee a specific sequence of events, but instead ensures that certain expectations are met. The next section describes those expectations.
|
||||
|
||||
## The Law of the Land: Redispatch Event Behavior
|
||||
|
||||
### `play` events
|
||||
|
||||
* Play events represent intention to play, such as clicking the play button.
|
||||
* Play events do not occur during ad breaks.
|
||||
* Play events can happen during [ad mode when not currently in an ad break](ad-mode.md), but content will not play as a result.
|
||||
|
||||
### `playing` events
|
||||
|
||||
* Playing events may occur when content plays.
|
||||
* If there is a preroll, there is no playing event before the preroll.
|
||||
* If there is a preroll, there is at least one playing event after the preroll.
|
||||
|
||||
### `ended` events
|
||||
|
||||
* If there is no postroll, there is a single ended event when content ends.
|
||||
* If there is a postroll, there is no ended event before the postroll.
|
||||
* If there is a postroll, there is a single ended event after the postroll.
|
||||
|
||||
### `loadstart` events
|
||||
|
||||
* There is always a loadstart event after content starts loading.
|
||||
* There is always a loadstart when the source changes.
|
||||
* There is never a loadstart due to an ad loading.
|
||||
|
||||
### Ad events
|
||||
|
||||
* Events are given the `ad` prefix in [ad mode](ad-mode.md) unless content is resuming. For example, if the video element emits a `playing` event during an ad break, that event would be redispatched as `adplaying`. These events can be useful when building ad plugins that use the content video element for ad playback, particularly `adplaying` and `adended`. See [getting started](getting-started.md) for an example that does this.
|
||||
|
||||
Exceptions:
|
||||
|
||||
* `loadstart`, `loadeddata`, and `loadedmetadata` can occur much later than the source set that triggered them. Contrib Ads will not prefix them during ad mode if they originated from a source change before ad mode began.
|
||||
|
||||
### Content resuming events
|
||||
|
||||
* Events are given the `content` prefix while content is resuming (while `isContentResuming()` is true). These events are not particularly useful to listen to; they mainly exist to prevent extra unprefixed events that would be confusing otherwise.
|
8
node_modules/videojs-contrib-ads/docs/integrator/snapshot.md
generated
vendored
Normal file
8
node_modules/videojs-contrib-ads/docs/integrator/snapshot.md
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Snapshot
|
||||
|
||||
The snapshot feature records the player state when an ad break begins and restores it when the ad break ends. This is useful when the ad plugin uses the content video element for ad playback. It also prevents metadata corresponding to the content from affecting ads; for example, you won't see your content's captions over ads. The following state is saved and restored:
|
||||
|
||||
* Content source
|
||||
* Current time
|
||||
* Style attribute
|
||||
* Text tracks
|
Loading…
Add table
Add a link
Reference in a new issue