src/controller.js
function(player, options) {
  /**
   * Stores user-provided settings.
   * @type {Object}
   */
  this.settings = {};

  /**
   * Content and ads ended listeners passed by the publisher to the plugin.
   * These will be called when the plugin detects that content *and all
   * ads* have completed. This differs from the contentEndedListeners in that
   * contentEndedListeners will fire between content ending and a post-roll
   * playing, whereas the contentAndAdsEndedListeners will fire after the
   * post-roll completes.
   */
  this.contentAndAdsEndedListeners = [];

  /**
   * Whether or not we are running on a mobile platform.
   */
  this.isMobile = (navigator.userAgent.match(/iPhone/i) ||
      navigator.userAgent.match(/iPad/i) ||
      navigator.userAgent.match(/Android/i));

  /**
   * Whether or not we are running on an iOS platform.
   */
  this.isIos = (navigator.userAgent.match(/iPhone/i) ||
      navigator.userAgent.match(/iPad/i));

  this.initWithSettings(options);

  /**
   * Stores contrib-ads default settings.
   */
  const contribAdsDefaults = {
    debug: this.settings.debug,
    timeout: this.settings.timeout,
    prerollTimeout: this.settings.prerollTimeout,
  };
  const adsPluginSettings = this.extend(
      {}, contribAdsDefaults, options.contribAdsSettings || {});

  this.playerWrapper = new PlayerWrapper(player, adsPluginSettings, this);
  this.adUi = new AdUi(this);
  this.sdkImpl = new SdkImpl(this);
}
function(player, options) {
  /**
   * Stores user-provided settings.
   * @type {Object}
   */
  this.settings = {};

  /**
   * Content and ads ended listeners passed by the publisher to the plugin.
   * These will be called when the plugin detects that content *and all
   * ads* have completed. This differs from the contentEndedListeners in that
   * contentEndedListeners will fire between content ending and a post-roll
   * playing, whereas the contentAndAdsEndedListeners will fire after the
   * post-roll completes.
   */
  this.contentAndAdsEndedListeners = [];

  /**
   * Whether or not we are running on a mobile platform.
   */
  this.isMobile = (navigator.userAgent.match(/iPhone/i) ||
      navigator.userAgent.match(/iPad/i) ||
      navigator.userAgent.match(/Android/i));

  /**
   * Whether or not we are running on an iOS platform.
   */
  this.isIos = (navigator.userAgent.match(/iPhone/i) ||
      navigator.userAgent.match(/iPad/i));

  this.initWithSettings(options);

  /**
   * Stores contrib-ads default settings.
   */
  const contribAdsDefaults = {
    debug: this.settings.debug,
    timeout: this.settings.timeout,
    prerollTimeout: this.settings.prerollTimeout,
  };
  const adsPluginSettings = this.extend(
      {}, contribAdsDefaults, options.contribAdsSettings || {});

  this.playerWrapper = new PlayerWrapper(player, adsPluginSettings, this);
  this.adUi = new AdUi(this);
  this.sdkImpl = new SdkImpl(this);
}
function ( player , options ) { /**
   * Stores user-provided settings.
   * @type {Object}
   */ this . settings = { } ; /**
   * Content and ads ended listeners passed by the publisher to the plugin.
   * These will be called when the plugin detects that content *and all
   * ads* have completed. This differs from the contentEndedListeners in that
   * contentEndedListeners will fire between content ending and a post-roll
   * playing, whereas the contentAndAdsEndedListeners will fire after the
   * post-roll completes.
   */ this . contentAndAdsEndedListeners = [ ] ; /**
   * Whether or not we are running on a mobile platform.
   */ this . isMobile = ( navigator . userAgent . match ( / iPhone / i ) || navigator . userAgent . match ( / iPad / i ) || navigator . userAgent . match ( / Android / i ) ) ; /**
   * Whether or not we are running on an iOS platform.
   */ this . isIos = ( navigator . userAgent . match ( / iPhone / i ) || navigator . userAgent . match ( / iPad / i ) ) ; this . initWithSettings ( options ) ; /**
   * Stores contrib-ads default settings.
   */ const contribAdsDefaults = { debug : this . settings . debug , timeout : this . settings . timeout , prerollTimeout : this . settings . prerollTimeout , } ; const adsPluginSettings = this . extend ( { } , contribAdsDefaults , options . contribAdsSettings || { } ) ; this . playerWrapper = new PlayerWrapper ( player , adsPluginSettings , this ) ; this . adUi = new AdUi ( this ) ; this . sdkImpl = new SdkImpl ( this ) ; }
The grand coordinator of the plugin. Facilitates communication between all
other plugin classes.

@param {Object} player Instance of the video.js player.
@param {Object} options Options provided by the implementation.
@constructor
@struct
@final
The grand coordinator of the plugin . Facilitates communication between all other plugin classes .