com.brightcove.player.controller

## Class VideoPlaybackController

- java.lang.Object
- - com.brightcove.player.event.AbstractComponent
  - - com.brightcove.player.controller.VideoPlaybackController

- All Implemented Interfaces:
    Component

      @Emits(events={"completed","cuePoint","didSelectSource","didSetVideo","play","selectSource","setSource","setVideoStill"})
       @ListensFor(events={"completed","cuePoint","seekTo","didSeekTo","didSetSource","play","didPlay","progress","readyToPlay","removeCuePoint","setCuePoint","setCuePoints","setVideo","willChangeVideo"})
      public class VideoPlaybackController
      extends AbstractComponent
      implements Component

  Manages video playback and provides proper translation between the Brightcove representation of videos and the underlying platform's representation. This includes performing activities such as selecting the appropriate rendition to play, given a Video object, and ensuring that a Video still image loads properly if specified in a Video object.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `VideoPlaybackController.OnDidSeekToListener`
    `protected class` | `VideoPlaybackController.OnDidSetSourceListener`
    `protected class` | `VideoPlaybackController.OnPlayerReadyListener`
    `protected class` | `VideoPlaybackController.OnPlayListener`
    `protected class` | `VideoPlaybackController.OnRemoveCuePointListener`
    `protected class` | `VideoPlaybackController.OnSeekToListener`
    `protected class` | `VideoPlaybackController.OnSetCuePointListener`
    `protected class` | `VideoPlaybackController.OnSetCuePointsListener`
    `protected class` | `VideoPlaybackController.OnSetVideoListener`
    `protected class` | `VideoPlaybackController.OnSourceSelectedListener`
    `protected class` | `VideoPlaybackController.OnVideoCompletedListener`
    `protected class` | `VideoPlaybackController.OnWillChangeVideoListener`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `adsDisabled` Disables ad playback which otherwise might occurr after a -seekTo.
    `protected int` | `liveWindowTimeMs`
    `static java.lang.String` | `TAG`

    - ### Fields inherited from class com.brightcove.player.event.AbstractComponent

      `eventEmitter, listenerTokens`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VideoPlaybackController(EventEmitter eventEmitter)` Being a Component, VideoPlaybackController requires an EventEmitter on initialization.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getLiveWindowTimeMs()` Deprecated.
    `boolean` | `hasPendingSourcesToLoad()` Indicates whether there are pending Sources to load.
    `void` | `initialize()` Resets the state of the controller to its initial values.
    `protected void` | `initializeListeners()` Ensure that all relevant event listeners are registered with the EventEmitter given in the constructor.
    `boolean` | `isAdsDisabled()`
    `void` | `setAdsDisabled(boolean disable)`
    `void` | `setLiveWindowTimeMs(int liveWindowTimeMs)` Deprecated.

    - ### Methods inherited from class com.brightcove.player.event.AbstractComponent

      `addListener, addOnceListener, getEventEmitter, removeListener, removeListeners`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### TAG

          public static final java.lang.String TAG

    - #### adsDisabled

          protected boolean adsDisabled

      Disables ad playback which otherwise might occurr after a -seekTo. The intended use is, for example, to resume video playback when an app has quit and relaunched; the app can seek to a saved time and ads which have been previously viewed will not play again. Set adsDisabled to true, then call -seekTo method, and then set adsDisabled to false in the DID_SEEK_TO listener callback. The default value of adsDisabled is false.

    - #### liveWindowTimeMs

          protected int liveWindowTimeMs

  - ### Constructor Detail

    - #### VideoPlaybackController

          public VideoPlaybackController(EventEmitter eventEmitter)

      Being a Component, VideoPlaybackController requires an EventEmitter on initialization.
      Parameters:
        `eventEmitter` - the EventEmitter through which this Component will listen for and emit events to interact with other components in the player

  - ### Method Detail

    - #### isAdsDisabled

          public boolean isAdsDisabled()

    - #### setAdsDisabled

          public void setAdsDisabled(boolean disable)

    - #### getLiveWindowTimeMs

          @Deprecated
          public int getLiveWindowTimeMs()

      Deprecated.
      Gets the time in milliseconds for the Live Stream Window. Currently used only for UI.
      Returns:
        the live window time in ms

    - #### setLiveWindowTimeMs

          @Deprecated
          public void setLiveWindowTimeMs(int liveWindowTimeMs)

      Deprecated.
      Sets the time in milliseconds for the Live Stream Window. Currently used only for UI.
      Parameters:
        `liveWindowTimeMs` - the live window time in ms

    - #### initialize

          public void initialize()

      Resets the state of the controller to its initial values. This is automatically called by the constructor, but can be called again if new components are introduced to the given EventEmitter. This will also clear out any pending SET_SOURCE events that might have happened if one was to be emitted before READY_TO_PLAY was received.

    - #### hasPendingSourcesToLoad

          public boolean hasPendingSourcesToLoad()

      Indicates whether there are pending Sources to load.
      Returns:
        true if there are Sources to load (resulting from SELECT_SOURCE responses happening before PLAYER_LOAD fired), false otherwise

    - #### initializeListeners

          protected void initializeListeners()

      Ensure that all relevant event listeners are registered with the EventEmitter given in the constructor.