Class: GoogleIMA

GoogleIMA

The GoogleIMA Ads Manager class is registered as an ads manager with the Ad Manager Controller. This class communicates between the player's ad manager controller and the GoogleIMA sdk. This implementation handles both AdRules ads and Non AdRules ads.

GoogleIMA()

Initialize an instance of the current class using the new keyword along with this constructor.
Properties:
Name Type Description
PLUGIN_VERSION string This is a variable version number of the player sent to Google for tracking **This must be updated with big updates to a different number**
PLAYER_TYPE string This is a variable that specifies the name of the player that is relayed to Google for tracking
sharedVideoElement object The video element to use on iOS where only one video element is allowed

Methods

initialize(amcIn, playerId)

Initializes the class by registering the ad manager controller. Adds listeners for Ad Manager Controller events.
Parameters:
Name Type Description
amcIn object A reference to the ad manager controller instance
playerId string The unique player identifier of the player initializing the class

loadMetadata(metadata, baseMetadata, movieMetadata)

This is called by the ad manager controller when the metadata has been loaded. Ingests metadata, determines if it should use AdRules logic or Non AdRules logic. If preloading ad rules ads is enabled, then it preloads the ads as well.
Parameters:
Name Type Description
metadata object Ad manager metadata from Backlot and from the page level
baseMetadata object Base level metadata from Backlot
movieMetadata object Metadata pertaining specifically to the movie being played

registerUi()

Called when the UI has been set up. Sets up the native element listeners and style for the overlay. Checks if the module is ready to send the request for ads.

setupSharedVideoElement(element)

Sets up the shared video element.
Parameters:
Name Type Description
element Element to be setup as the shared video element

buildTimeline() → {Array.<OO.AdManagerController#Ad>}

Called by the ad manager controller. Creates OO.AdManagerController#Ad objects, places them in an array, and returns them to the ad manager controller. If AdRules is used, then the list will be empty. In that case the SDK will handle the timing of ads playing.
Returns:
timeline A list of the ads to play for the current video
Type
Array.<OO.AdManagerController#Ad>

playAd(ad)

Called by the ad manager controller. Ad Manager Controller lets the module know that an ad should play now.
Parameters:
Name Type Description
ad object The ad to play from the timeline.

hideOverlay(ad)

Called by the ad manager controller. Hide the overlay. In this case, overlay showing, after a hide, is not supported so it just cancels the overlay.
Parameters:
Name Type Description
ad object The ad to hide

cancelAd(ad)

Called by the ad manager controller. Cancels the current running ad.
Parameters:
Name Type Description
ad object The ad to cancel

pauseAd(ad)

Called by the ad manager controller. Pauses the current ad.
Parameters:
Name Type Description
ad object The ad to pause

resumeAd(ad)

Called by the ad manager controller. Resumes the current ad.
Parameters:
Name Type Description
ad object The ad to resume

<protected> setupUnmutedPlayback()

Preps the IMA SDK for unmuted playback. This needs to be done on the user click thread.

onFullScreenChanged(shouldEnterFullscreen)

Callback for Ad Manager Controller. Handles going into and out of fullscreen mode.
Parameters:
Name Type Description
shouldEnterFullscreen boolean True if going into fullscreen

destroy()

Cancel the current ad, and destroy/reset all the GoogleIMA SDK variables.

checkCompanionAds(ad)

Checks if there is any companion ads associated with the ad and if one is found, it will call the Ad Manager Controller to show it.
Parameters:
Name Type Description
ad object The Ad metadata

<protected> setRequiresMutedAutoplay(required)

Notifies IMA if the browser requires muted autoplay or not. This test is typically done on a video element.
Parameters:
Name Type Description
required boolean True if the browser requires muted autoplay, false otherwise

<protected> requiresMutedAutoplay() → {boolean}

Checks to see if autoplay requires the video to be muted
Returns:
true if video must be muted to autoplay, false otherwise
Type
boolean

<protected> willPlayAdMuted() → {boolean}

Checks to see if we intend for the ad to playback muted.
Returns:
true if we intend for the ad to playback muted, false otherwise
Type
boolean