Ads()
Initialize an instance of the current class using the new keyword along with this constructor.
Methods
-
manager(adManagerFactory)
-
Registers a new ad manager factory. The factory will be used to instantiate ad managers when the player is created. The format of the resulting ad manager is validated and the ad manager factory is only registered if the ad manager defines the required functions and properties.
Parameters:
Name Type Description adManagerFactory
object The ad manager factory function to register -
unregisterAdManager(name)
-
Unregisters an ad manager factory.
Parameters:
Name Type Description name
string The name of the ad manager factory to unregister, traditionally represented by the resulting ad manager instance adManager.name -
validateAdManager(adManager) → {boolean}
-
Validates the format of an ad manager and checks if the ad manager is already registered.
The ad manager must define the following functions:
- initialize
- buildTimeline
- playAd
- cancelAd
- name (string)
- ready (boolean)
Parameters:
Name Type Description adManager
object The ad manager object Returns:
true
if the ad manager meets the template requirements,false
otherwise.- Type
- boolean
-
getUnregisteredAdManagers() → {Array.<string>}
-
Returns the names of ad managers that were registered but have been unregistered. This is used in testing.
Returns:
A list of all ad managers that have been unregistered.- Type
- Array.<string>