Configures the class from an object.
Promise
Downloads adease configuration from a URL, returning a promise that resolves with undefined when done.
string
Promise
Returns the ads.
Returns the ads that are present at a given moment. In practice this will only ever return either an empty list, or a list with one element. It is theoretically possible for more than one ad to be returned, however this makes no practical sense.
Time in milliseconds.
This is the inverse of getStreamTime
. It returns the time in an asset
that the loaded stream time corresponds to. For example, if the time 35 seconds is
given, then 5 seconds will be returned if a 30 second pre roll has been inserted.
number Time in milliseconds.
number Time in milliseconds.
Since inserting ads into a stream changes the duration, it can be useful to translate between the original time of the asset and the corresponding time in the loaded stream. This method returns the time in the stream that a position in the original asset corresponds to.
For example, 5 seconds into the original asset would be 35 seconds in the loaded stream if a 30 second pre roll has been inserted.
Returns the real stream time.
For live only.
Call when an ID3 tag is detected in the metadata track.
The string tag of the event;
The time in milliseconds that the event appears in the stream.
A promise that resolves once all undelying actions have completed.
Notify that a time update (position in the stream) has occured. This may fire off beacons. Returns a promise that resolves once all underlying network requests have completed.
number Time in milliseconds.
Generated using TypeDoc
The adease class essentially provides a wrapper around a configuration object. The configuration object contains all of the information regarding where in a stream the ads have been inserted.
This class has methods both to query what ads have been inserted where, as well as triggering analytics based on time updates and user initiated actions.
Internal state is kept to track what beacons have been sent, and what the last time update was. Whenever configuration is provided this internal state is reset. If this internal state needs to be preserved, then a new instance should be created instead.
NOTE: All methods except
configureFromURL
andconfigureFromObject
will throw an exception if the class has not been provided configuration. Your code should ensure that the class has been setup before calling any methods; a proxy pattern can work well here. This design choice has been made to avoid silently failing, to increase development/debugging speed.