src/sdk-impl.js
function(controller) {
  /**
   * Plugin controller.
   */
  this.controller = controller;

  /**
   * IMA SDK AdDisplayContainer.
   */
  this.adDisplayContainer = null;

  /**
   * True if the AdDisplayContainer has been initialized. False otherwise.
   */
  this.adDisplayContainerInitialized = false;

  /**
   * IMA SDK AdsLoader
   */
  this.adsLoader = null;

  /**
   * IMA SDK AdsManager
   */
  this.adsManager = null;

  /**
   * IMA SDK AdsRenderingSettings.
   */
  this.adsRenderingSettings = null;

  /**
   * VAST, VMAP, or ad rules response. Used in lieu of fetching a response
   * from an ad tag URL.
   */
  this.adsResponse = null;

  /**
   * Current IMA SDK Ad.
   */
  this.currentAd = null;

  /**
   * Timer used to track ad progress.
   */
  this.adTrackingTimer = null;

  /**
   * True if ALL_ADS_COMPLETED has fired, false until then.
   */
  this.allAdsCompleted = false;

  /**
   * True if ads are currently displayed, false otherwise.
   * True regardless of ad pause state if an ad is currently being displayed.
   */
  this.adsActive = false;

  /**
   * True if ad is currently playing, false if ad is paused or ads are not
   * currently displayed.
   */
  this.adPlaying = false;

  /**
   * True if the ad is muted, false otherwise.
   */
  this.adMuted = false;

  /**
   * Listener to be called to trigger manual ad break playback.
   */
  this.adBreakReadyListener = undefined;

  /**
   * Tracks whether or not we have already called adsLoader.contentComplete().
   */
  this.contentCompleteCalled = false;

  /**
   * Stores the dimensions for the ads manager.
   */
  this.adsManagerDimensions = {
    width: 0,
    height: 0,
  };

  /**
   * Boolean flag to enable manual ad break playback.
   */
  this.autoPlayAdBreaks = true;
  if (this.controller.getSettings().autoPlayAdBreaks === false) {
    this.autoPlayAdBreaks = false;
  }

  // Set SDK settings from plugin settings.
  if (this.controller.getSettings().locale) {
    /* eslint no-undef: 'error' */
    /* global google */
    google.ima.settings.setLocale(this.controller.getSettings().locale);
  }
  if (this.controller.getSettings().disableFlashAds) {
    google.ima.settings.setDisableFlashAds(
        this.controller.getSettings().disableFlashAds);
  }
  if (this.controller.getSettings().disableCustomPlaybackForIOS10Plus) {
    google.ima.settings.setDisableCustomPlaybackForIOS10Plus(
        this.controller.getSettings().disableCustomPlaybackForIOS10Plus);
  }
}
function(controller) {
  /**
   * Plugin controller.
   */
  this.controller = controller;

  /**
   * IMA SDK AdDisplayContainer.
   */
  this.adDisplayContainer = null;

  /**
   * True if the AdDisplayContainer has been initialized. False otherwise.
   */
  this.adDisplayContainerInitialized = false;

  /**
   * IMA SDK AdsLoader
   */
  this.adsLoader = null;

  /**
   * IMA SDK AdsManager
   */
  this.adsManager = null;

  /**
   * IMA SDK AdsRenderingSettings.
   */
  this.adsRenderingSettings = null;

  /**
   * VAST, VMAP, or ad rules response. Used in lieu of fetching a response
   * from an ad tag URL.
   */
  this.adsResponse = null;

  /**
   * Current IMA SDK Ad.
   */
  this.currentAd = null;

  /**
   * Timer used to track ad progress.
   */
  this.adTrackingTimer = null;

  /**
   * True if ALL_ADS_COMPLETED has fired, false until then.
   */
  this.allAdsCompleted = false;

  /**
   * True if ads are currently displayed, false otherwise.
   * True regardless of ad pause state if an ad is currently being displayed.
   */
  this.adsActive = false;

  /**
   * True if ad is currently playing, false if ad is paused or ads are not
   * currently displayed.
   */
  this.adPlaying = false;

  /**
   * True if the ad is muted, false otherwise.
   */
  this.adMuted = false;

  /**
   * Listener to be called to trigger manual ad break playback.
   */
  this.adBreakReadyListener = undefined;

  /**
   * Tracks whether or not we have already called adsLoader.contentComplete().
   */
  this.contentCompleteCalled = false;

  /**
   * Stores the dimensions for the ads manager.
   */
  this.adsManagerDimensions = {
    width: 0,
    height: 0,
  };

  /**
   * Boolean flag to enable manual ad break playback.
   */
  this.autoPlayAdBreaks = true;
  if (this.controller.getSettings().autoPlayAdBreaks === false) {
    this.autoPlayAdBreaks = false;
  }

  // Set SDK settings from plugin settings.
  if (this.controller.getSettings().locale) {
    /* eslint no-undef: 'error' */
    /* global google */
    google.ima.settings.setLocale(this.controller.getSettings().locale);
  }
  if (this.controller.getSettings().disableFlashAds) {
    google.ima.settings.setDisableFlashAds(
        this.controller.getSettings().disableFlashAds);
  }
  if (this.controller.getSettings().disableCustomPlaybackForIOS10Plus) {
    google.ima.settings.setDisableCustomPlaybackForIOS10Plus(
        this.controller.getSettings().disableCustomPlaybackForIOS10Plus);
  }
}
function ( controller ) { /**
   * Plugin controller.
   */ this . controller = controller ; /**
   * IMA SDK AdDisplayContainer.
   */ this . adDisplayContainer = null ; /**
   * True if the AdDisplayContainer has been initialized. False otherwise.
   */ this . adDisplayContainerInitialized = false ; /**
   * IMA SDK AdsLoader
   */ this . adsLoader = null ; /**
   * IMA SDK AdsManager
   */ this . adsManager = null ; /**
   * IMA SDK AdsRenderingSettings.
   */ this . adsRenderingSettings = null ; /**
   * VAST, VMAP, or ad rules response. Used in lieu of fetching a response
   * from an ad tag URL.
   */ this . adsResponse = null ; /**
   * Current IMA SDK Ad.
   */ this . currentAd = null ; /**
   * Timer used to track ad progress.
   */ this . adTrackingTimer = null ; /**
   * True if ALL_ADS_COMPLETED has fired, false until then.
   */ this . allAdsCompleted = false ; /**
   * True if ads are currently displayed, false otherwise.
   * True regardless of ad pause state if an ad is currently being displayed.
   */ this . adsActive = false ; /**
   * True if ad is currently playing, false if ad is paused or ads are not
   * currently displayed.
   */ this . adPlaying = false ; /**
   * True if the ad is muted, false otherwise.
   */ this . adMuted = false ; /**
   * Listener to be called to trigger manual ad break playback.
   */ this . adBreakReadyListener = undefined ; /**
   * Tracks whether or not we have already called adsLoader.contentComplete().
   */ this . contentCompleteCalled = false ; /**
   * Stores the dimensions for the ads manager.
   */ this . adsManagerDimensions = { width : 0 , height : 0 , } ; /**
   * Boolean flag to enable manual ad break playback.
   */ this . autoPlayAdBreaks = true ; if ( this . controller . getSettings ( ) . autoPlayAdBreaks === false ) { this . autoPlayAdBreaks = false ; } // Set SDK settings from plugin settings. if ( this . controller . getSettings ( ) . locale ) { /* eslint no-undef: 'error' */ /* global google */ google . ima . settings . setLocale ( this . controller . getSettings ( ) . locale ) ; } if ( this . controller . getSettings ( ) . disableFlashAds ) { google . ima . settings . setDisableFlashAds ( this . controller . getSettings ( ) . disableFlashAds ) ; } if ( this . controller . getSettings ( ) . disableCustomPlaybackForIOS10Plus ) { google . ima . settings . setDisableCustomPlaybackForIOS10Plus ( this . controller . getSettings ( ) . disableCustomPlaybackForIOS10Plus ) ; } }
Implementation of the IMA SDK for the plugin.

@param {Object} controller Reference to the parent controller.

@constructor
@struct
@final
Implementation of the IMA SDK for the plugin .