com.brightcove.player.display

## Class ExoPlayerVideoDisplayComponent

- java.lang.Object
- - com.brightcove.player.event.AbstractComponent
  - - com.brightcove.player.display.VideoDisplayComponent
    - - com.brightcove.player.display.ExoPlayerVideoDisplayComponent

- All Implemented Interfaces:
    Component

      @Emits(events={"addAnalyticsBaseParams","analyticsVideoEngagement","audioTracks","bufferingCompleted","bufferingStarted","caption","captionsLanguages","toggleClosedCaptions","seekToIncorrectTargetValue","renditionChanged"})
       @ListensFor(events={"selectAudioTrack","selectClosedCaptionTrack","on360FrameAvailable","videoDurationChanged"})
       @RequiresApi(api=16)
      public class ExoPlayerVideoDisplayComponent
      extends VideoDisplayComponent

  This class extends the VideoDisplayComponent to add support for the ExoPlayer.

  See: https://github.com/google/ExoPlayer

  See Also:
    `VideoDisplayComponent`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `ExoPlayerVideoDisplayComponent.CaptionListener` A listener for receiving notifications of timed text.
    `static interface` | `ExoPlayerVideoDisplayComponent.Id3MetadataListener` Deprecated. Use `ExoPlayerVideoDisplayComponent.MetadataListener` instead.
    `static interface` | `ExoPlayerVideoDisplayComponent.InfoListener` A listener for debugging information.
    `static interface` | `ExoPlayerVideoDisplayComponent.InternalErrorListener` Listeners for receiving error information.
    `static interface` | `ExoPlayerVideoDisplayComponent.MetadataListener` Listener for receiving `Metadata` parsed from the media stream.
    `static interface` | `ExoPlayerVideoDisplayComponent.TrackType` The list of possible Format types.

    - ### Nested classes/interfaces inherited from class com.brightcove.player.display.VideoDisplayComponent

      `VideoDisplayComponent.OnSetSourceListener, VideoDisplayComponent.OnWillChangeVideoListener`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `BUFFERED_POSITION` The buffered position property of a BUFFERED_UPDATE event.
    `static java.lang.String` | `EXOPLAYER_FORMAT` The key for a Format object emitted when the ExoPlayer changes rendition.
    `static java.lang.String` | `IN_MANIFEST_CC_URI_STR`
    `static java.lang.String` | `RENDITION_CHANGED` Emitted when the ExoPlayer changes the rendition
    `static java.util.ResourceBundle` | `resourceBundle`
    `static int` | `TYPE_AUDIO`
    `static int` | `TYPE_METADATA`
    `static int` | `TYPE_TEXT`
    `static int` | `TYPE_VIDEO`
    `static java.lang.String` | `UNKNOWN_CC`

    - ### Fields inherited from class com.brightcove.player.display.VideoDisplayComponent

      `captionsPath, context, fromSeekPosition, hasSurface, isFrameAvailable, mRendererConfig, nextSource, nextVideo, ON_PLAY_SEEK_THRESHOLD, playheadPosition, playheadPositionLong, progressInterval, renderView, reseeking, seekPosition, updater`

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

      `eventEmitter, listenerTokens`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExoPlayerVideoDisplayComponent(RenderView renderView, EventEmitter eventEmitter)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `destroyPlayer()` Destroys the current player and releases it from memory.
    `com.google.android.exoplayer2.upstream.BandwidthMeter` | `getBandwidthMeter()` Returns the current bandwidth meter.
    `BrightcoveDrmSession` | `getBrightcoveDrmSession()` Deprecated.
    `com.google.android.exoplayer2.upstream.HttpDataSource.Factory` | `getDataSourceFactory()` Returns the current `HttpDataSource.Factory`, which is used when creating the `MediaSource`.
    `com.google.android.exoplayer2.ExoPlayer` | `getExoPlayer()`
    `ExoPlayerDrmSessionManager<com.google.android.exoplayer2.drm.FrameworkMediaCrypto>` | `getExoPlayerDrmSessionManager()` Gets the ExoPlayer Drm session if available or null otherwise.
    `int` | `getLiveEdge()` Deprecated.
    `long` | `getLiveEdgeLong()` Compute the "live edge" as a long datatype, the largest position not within three target durations of the duration (per the HLS spec).
    `LoadControlConfig` | `getLoadControlConfig()` Gets the LoadControlConfig object.
    `android.os.Handler` | `getMainHandler()`
    `long` | `getMaxBufferDurationToSwitchDown()` Deprecated. It is not longer used for ExoPlayer v2.
    `android.media.MediaPlayer` | `getMediaPlayer()`
    `long` | `getMinBufferDurationToSwitchUp()` Deprecated. It is not longer used for ExoPlayer v2.
    `int` | `getMinBufferMs()` Deprecated. It is not longer used for ExoPlayer v2.
    `int` | `getMinRebufferMs()` Deprecated. It is not longer used for ExoPlayer v2. Use Use `getLoadControlConfig()`
    `int` | `getPeakBitrate()` Return the peak bitrate.
    `android.os.Looper` | `getPlaybackLooper()`
    `long` | `getPlayerCurrentPosition()` Returns the current playhead position of the underlying video player.
    `int` | `getPlayerState()` Returns the ExoPlayer state if available, or -1 if the player is null.
    `com.google.android.exoplayer2.trackselection.DefaultTrackSelector` | `getTrackSelector()` Gets the DefaultTrackSelector object.
    `TrackSelectorHelper` | `getTrackSelectorHelper()` Gets the TrackSelectorHelper object.
    `java.util.Map<java.lang.String,java.lang.String>` | `getVideoDisplayProperties()`
    `com.google.android.exoplayer2.Format` | `getVideoFormat()`
    `WidevineMediaDrmCallback` | `getWidevineMediaDrmCallback()`
    `boolean` | `hasDvr()` Indicates if Live with DVR is supported.
    `protected void` | `initializeListeners()`
    `boolean` | `isInLiveEdge()` Checks the current playhead position with the live edge position and determines if it is in live edge.
    `boolean` | `isLive()` Provides a default for handling live videos.
    `protected void` | `openVideo(Video video, Source source)` Creates, configures, and prepares a new instance of MediaPlayer
    `void` | `setBandwidthMeter(com.google.android.exoplayer2.upstream.BandwidthMeter bandwidthMeter)` Sets the current bandwidth meter.
    `void` | `setCaptionListener(ExoPlayerVideoDisplayComponent.CaptionListener listener)`
    `void` | `setDataSourceFactory(com.google.android.exoplayer2.upstream.HttpDataSource.Factory httpDataSourceFactory)` Sets the `HttpDataSource.Factory`, which is used when creating the `MediaSource`.
    `void` | `setDebugListener(ExoPlayerVideoDisplayComponent.InfoListener debugListener)`
    `void` | `setInternalErrorListener(ExoPlayerVideoDisplayComponent.InternalErrorListener internalErrorListener)`
    `void` | `setLoadControlConfig(LoadControlConfig loadControlConfig)` Sets the LoadControlConfig object.
    `void` | `setMaxBufferDurationToSwitchDown(long maxBufferDurationToSwitchDown)` Deprecated. It is not longer used for ExoPlayer v2.
    `void` | `setMetadataListener(ExoPlayerVideoDisplayComponent.Id3MetadataListener listener)` Deprecated. Use `setMetadataListener(MetadataListener)` instead
    `void` | `setMetadataListener(ExoPlayerVideoDisplayComponent.MetadataListener listener)`
    `void` | `setMinBufferDurationToSwitchUp(long minBufferDurationToSwitchUp)` Deprecated. It is not longer used for ExoPlayer v2.
    `void` | `setMinBufferMs(int minBufferMs)` Deprecated. It is not longer used for ExoPlayer v2.
    `void` | `setMinRebufferMs(int minRebufferMs)` Deprecated. It is not longer used for ExoPlayer v2. Use `setLoadControlConfig(LoadControlConfig)`
    `void` | `setPeakBitrate(int peakBitrate)` Sets the peak bitrate.
    `void` | `setTextInformationFrameListener(TextInformationFrameListener listener)` Sets the Text Information Frame Listener.
    `void` | `setTrackSelector(com.google.android.exoplayer2.trackselection.DefaultTrackSelector trackSelector)`
    `void` | `setVideoDisplayProperties(java.util.Map<java.lang.String,java.lang.String> videoDisplayProperties)`
    `void` | `setVideoSelectionOverrideCreator(SelectionOverrideCreator videoSelectionOverrideCreator)` Provides a creator for a `DefaultTrackSelector.SelectionOverride` instance specific for the Video track.
    `protected void` | `startUpdater()`
    `protected void` | `stopUpdater()`
    `void` | `surfaceChanged(android.view.SurfaceHolder surfaceHolder, int format, int w, int h)`
    `void` | `surfaceCreated(android.view.SurfaceHolder surfaceHolder)`
    `void` | `surfaceDestroyed(android.view.SurfaceHolder surfaceHolder)`

    - ### Methods inherited from class com.brightcove.player.display.VideoDisplayComponent

      `emitErrorEvent, emitErrorEvent, emitVideoSize, getAnalytics, getCurrentSource, getCurrentSourceOrFail, getCurrentVideo, getCurrentVideoOrFail, getHeaders, getRenderView, isCurrentVideo360Mode, onSurfaceTextureAvailable, onSurfaceTextureDestroyed, onSurfaceTextureSizeChanged, onSurfaceTextureUpdated, openCurrentVideoSource, setProgressInterval, setRendererConfig, setVideoSource`

    - ### 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

    - #### IN_MANIFEST_CC_URI_STR

          public static final java.lang.String IN_MANIFEST_CC_URI_STR

      See Also:
        Constant Field Values

    - #### BUFFERED_POSITION

          public static final java.lang.String BUFFERED_POSITION

      The buffered position property of a BUFFERED_UPDATE event.
      See Also:
        Constant Field Values

    - #### RENDITION_CHANGED

          public static final java.lang.String RENDITION_CHANGED

      Emitted when the ExoPlayer changes the rendition
      See Also:
        Constant Field Values

    - #### EXOPLAYER_FORMAT

          public static final java.lang.String EXOPLAYER_FORMAT

      The key for a Format object emitted when the ExoPlayer changes rendition.
      See Also:
        Constant Field Values

    - #### TYPE_VIDEO

          public static final int TYPE_VIDEO

      See Also:
        Constant Field Values

    - #### TYPE_AUDIO

          public static final int TYPE_AUDIO

      See Also:
        Constant Field Values

    - #### TYPE_TEXT

          public static final int TYPE_TEXT

      See Also:
        Constant Field Values

    - #### TYPE_METADATA

          public static final int TYPE_METADATA

      See Also:
        Constant Field Values

    - #### UNKNOWN_CC

          public static final java.lang.String UNKNOWN_CC

      See Also:
        Constant Field Values

    - #### resourceBundle

          public static java.util.ResourceBundle resourceBundle

  - ### Constructor Detail

    - #### ExoPlayerVideoDisplayComponent

          public ExoPlayerVideoDisplayComponent(RenderView renderView,
                                                EventEmitter eventEmitter)

  - ### Method Detail

    - #### getBrightcoveDrmSession

          @Nullable
           @Deprecated
          public BrightcoveDrmSession getBrightcoveDrmSession()

      Deprecated.
      Deprecates. Instead use {`getExoPlayerDrmSessionManager()`}

    - #### getExoPlayerDrmSessionManager

          public ExoPlayerDrmSessionManager<com.google.android.exoplayer2.drm.FrameworkMediaCrypto> getExoPlayerDrmSessionManager()

      Gets the ExoPlayer Drm session if available or null otherwise. The `ExoPlayerDrmSessionManager` will be created only when the current `Source` properties has the key `Source.Fields#WIDEVINE_KEY_SYSTEM`
      Returns:
        the drm session manager

    - #### getWidevineMediaDrmCallback

          public WidevineMediaDrmCallback getWidevineMediaDrmCallback()

    - #### getTrackSelector

          @Nullable
          public com.google.android.exoplayer2.trackselection.DefaultTrackSelector getTrackSelector()

      Gets the DefaultTrackSelector object.
      Returns:
        the track selector
      See Also:
        `DefaultTrackSelector`

    - #### getTrackSelectorHelper

          @Nullable
          public TrackSelectorHelper getTrackSelectorHelper()

      Gets the TrackSelectorHelper object.
      Returns:
        the track selector helper
      See Also:
        `TrackSelectorHelper`

    - #### setTrackSelector

          public void setTrackSelector(@NonNull
                                       com.google.android.exoplayer2.trackselection.DefaultTrackSelector trackSelector)

    - #### initializeListeners

          protected void initializeListeners()

      Overrides:
        `initializeListeners` in class `VideoDisplayComponent`

    - #### startUpdater

          protected void startUpdater()

      Overrides:
        `startUpdater` in class `VideoDisplayComponent`

    - #### stopUpdater

          protected void stopUpdater()

      Overrides:
        `stopUpdater` in class `VideoDisplayComponent`

    - #### getMediaPlayer

          public android.media.MediaPlayer getMediaPlayer()

      Overrides:
        `getMediaPlayer` in class `VideoDisplayComponent`

    - #### hasDvr

          public boolean hasDvr()

      Description copied from class: `VideoDisplayComponent`
      Indicates if Live with DVR is supported. Subclasses will override if live with DVR videos are supported.
      Overrides:
        `hasDvr` in class `VideoDisplayComponent`
      Returns:
        `TRUE` iff live video with DVR capabilities is supported.

    - #### isLive

          public boolean isLive()

      Description copied from class: `VideoDisplayComponent`
      Provides a default for handling live videos. Subclasses will override if live videos are supported.
      Overrides:
        `isLive` in class `VideoDisplayComponent`
      Returns:
        `TRUE` iff live video is supported.

    - #### isInLiveEdge

          public boolean isInLiveEdge()

      Description copied from class: `VideoDisplayComponent`
      Checks the current playhead position with the live edge position and determines if it is in live edge.
      Overrides:
        `isInLiveEdge` in class `VideoDisplayComponent`
      Returns:
        true if in live edge.

    - #### getPlayerCurrentPosition

          public long getPlayerCurrentPosition()

      Description copied from class: `VideoDisplayComponent`
      Returns the current playhead position of the underlying video player. If the player has not been set or initialized, `Constants.TIME_UNSET` will returned.
      Overrides:
        `getPlayerCurrentPosition` in class `VideoDisplayComponent`
      Returns:
        the current playhead position.

    - #### getLiveEdge

          @Deprecated
          public int getLiveEdge()

      Deprecated.
      Deprecated. Instead use `getLiveEdgeLong()`
      Overrides:
        `getLiveEdge` in class `VideoDisplayComponent`
      Returns:
        0. Subclasses should override to provide a value within three target durations of the maximum position.

    - #### getExoPlayer

          public com.google.android.exoplayer2.ExoPlayer getExoPlayer()

    - #### getLiveEdgeLong

          public long getLiveEdgeLong()

      Compute the "live edge" as a long datatype, the largest position not within three target durations of the duration (per the HLS spec).
      Overrides:
        `getLiveEdgeLong` in class `VideoDisplayComponent`
      Returns:
        -1 if the video is not live. Otherwise the largest position that is three target durations away from the duration.

    - #### getPlayerState

          public int getPlayerState()

      Returns the ExoPlayer state if available, or -1 if the player is null.
      Returns:
        the player state
      See Also:
        `Player.getPlaybackState()`

    - #### setDebugListener

          public void setDebugListener(ExoPlayerVideoDisplayComponent.InfoListener debugListener)

    - #### setCaptionListener

          public void setCaptionListener(ExoPlayerVideoDisplayComponent.CaptionListener listener)

    - #### setMetadataListener

          public void setMetadataListener(ExoPlayerVideoDisplayComponent.MetadataListener listener)

    - #### setMetadataListener

          @Deprecated
          public void setMetadataListener(ExoPlayerVideoDisplayComponent.Id3MetadataListener listener)

      Deprecated. Use `setMetadataListener(MetadataListener)` instead
      Parameters:
        `listener` - the listener

    - #### setInternalErrorListener

          public void setInternalErrorListener(ExoPlayerVideoDisplayComponent.InternalErrorListener internalErrorListener)

    - #### setTextInformationFrameListener

          public void setTextInformationFrameListener(@NonNull
                                                      TextInformationFrameListener listener)

      Description copied from class: `VideoDisplayComponent`
      Sets the Text Information Frame Listener. `TextInformationFrameListener.onTextInformationFrame(TextInformationFrame, long)` will be called when the player finds an ID3 Metadata of type `TextInformationFrame` in the Video. Use `TextInformationFrameListener.DISABLED` to disable the listener.
      Overrides:
        `setTextInformationFrameListener` in class `VideoDisplayComponent`
      Parameters:
        `listener` - the listener

    - #### openVideo

          protected void openVideo(@NonNull
                                   Video video,
                                   @Nullable
                                   Source source)

      Description copied from class: `VideoDisplayComponent`
      Creates, configures, and prepares a new instance of MediaPlayer
      Overrides:
        `openVideo` in class `VideoDisplayComponent`
      Parameters:
        `video` - reference to the video to be prepared for the playback.
        `source` - reference to the source to played if any.

    - #### destroyPlayer

          protected void destroyPlayer()

      Description copied from class: `VideoDisplayComponent`
      Destroys the current player and releases it from memory. This seems wasteful, but helps to mitigate working with the complex state machines that are the MediaPlayer and the SurfaceView
      Overrides:
        `destroyPlayer` in class `VideoDisplayComponent`
      See Also:
        `MediaPlayer`, `SurfaceView`

    - #### getPlaybackLooper

          public android.os.Looper getPlaybackLooper()

    - #### getMainHandler

          public android.os.Handler getMainHandler()

    - #### getVideoFormat

          public com.google.android.exoplayer2.Format getVideoFormat()

    - #### getPeakBitrate

          public int getPeakBitrate()

      Return the peak bitrate.

    - #### setPeakBitrate

          public void setPeakBitrate(int peakBitrate)

      Sets the peak bitrate. Set 0 to set the default bitrate.
      Parameters:
        `peakBitrate` - the peak bitrate

    - #### setVideoSelectionOverrideCreator

          public void setVideoSelectionOverrideCreator(@NonNull
                                                       SelectionOverrideCreator videoSelectionOverrideCreator)

      Provides a creator for a `DefaultTrackSelector.SelectionOverride` instance specific for the Video track. This SelectionOverride is applied every time a new video is loaded, and when the `setPeakBitrate(int)` is set.

      If you want to disable the default SelectionOverride, you may pass `SelectionOverrideCreator.EMPTY`, which returns `SelectionOverrideCreator.EMPTY_SELECTION_OVERRIDE` and gets ignored when attempting to apply it to the `DefaultTrackSelector`.

    - #### getBandwidthMeter

          public com.google.android.exoplayer2.upstream.BandwidthMeter getBandwidthMeter()

      Returns the current bandwidth meter. If null, a default bandwidth meter will be used.

    - #### setBandwidthMeter

          public void setBandwidthMeter(com.google.android.exoplayer2.upstream.BandwidthMeter bandwidthMeter)

      Sets the current bandwidth meter.

    - #### getDataSourceFactory

          @NonNull
          public com.google.android.exoplayer2.upstream.HttpDataSource.Factory getDataSourceFactory()

      Returns the current `HttpDataSource.Factory`, which is used when creating the `MediaSource`.

    - #### setDataSourceFactory

          public void setDataSourceFactory(@NonNull
                                           com.google.android.exoplayer2.upstream.HttpDataSource.Factory httpDataSourceFactory)

      Sets the `HttpDataSource.Factory`, which is used when creating the `MediaSource`. WARNING: When creating a customized HttpDataSource.Factory, you must make sure to use the default user agent `C.HTTP_USER_AGENT` to avoid losing Brightcove Analytics and Delivery Rules support.
      Parameters:
        `httpDataSourceFactory` - the http data source factory

    - #### getMinBufferDurationToSwitchUp

          @Deprecated
          public long getMinBufferDurationToSwitchUp()

      Deprecated. It is not longer used for ExoPlayer v2.
      Returns the minimum duration of media that needs to be buffered for a switch to a higher quality variant to be considered.

    - #### setMinBufferDurationToSwitchUp

          @Deprecated
          public void setMinBufferDurationToSwitchUp(long minBufferDurationToSwitchUp)

      Deprecated. It is not longer used for ExoPlayer v2.
      Sets the minimum duration of media that needs to be buffered for a switch to a higher quality variant to be considered.

    - #### getMaxBufferDurationToSwitchDown

          @Deprecated
          public long getMaxBufferDurationToSwitchDown()

      Deprecated. It is not longer used for ExoPlayer v2.
      Returns the maximum duration of media that needs to be buffered for a switch to a lower quality variant to be considered.

    - #### setMaxBufferDurationToSwitchDown

          @Deprecated
          public void setMaxBufferDurationToSwitchDown(long maxBufferDurationToSwitchDown)

      Deprecated. It is not longer used for ExoPlayer v2.
      Sets the maximum duration of media that needs to be buffered for a switch to a lower quality variant to be considered.

    - #### getMinBufferMs

          @Deprecated
          public int getMinBufferMs()

      Deprecated. It is not longer used for ExoPlayer v2.
      Returns the minimum duration of data that must be buffered for playback to start or resume following a user action such as a seek.

    - #### setMinBufferMs

          @Deprecated
          public void setMinBufferMs(int minBufferMs)

      Deprecated. It is not longer used for ExoPlayer v2.
      Sets the minimum duration of data that must be buffered for playback to start or resume following a user action such as a seek.

    - #### getMinRebufferMs

          @Deprecated
          public int getMinRebufferMs()

      Deprecated. It is not longer used for ExoPlayer v2. Use Use `getLoadControlConfig()`

    - #### setMinRebufferMs

          @Deprecated
          public void setMinRebufferMs(int minRebufferMs)

      Deprecated. It is not longer used for ExoPlayer v2. Use `setLoadControlConfig(LoadControlConfig)`

    - #### getLoadControlConfig

          public LoadControlConfig getLoadControlConfig()

      Gets the LoadControlConfig object.
      Returns:
        the load control config

    - #### setLoadControlConfig

          public void setLoadControlConfig(@NonNull
                                           LoadControlConfig loadControlConfig)

      Sets the LoadControlConfig object.

      This object is used to create a `LoadControl` instance. The `LoadControl` is used when creating an instance of the ExoPlayer.

      Parameters:
        `loadControlConfig` - the load control config

    - #### surfaceCreated

          public void surfaceCreated(android.view.SurfaceHolder surfaceHolder)

      Overrides:
        `surfaceCreated` in class `VideoDisplayComponent`

    - #### surfaceChanged

          public void surfaceChanged(android.view.SurfaceHolder surfaceHolder,
                                     int format,
                                     int w,
                                     int h)

      Overrides:
        `surfaceChanged` in class `VideoDisplayComponent`

    - #### surfaceDestroyed

          public void surfaceDestroyed(android.view.SurfaceHolder surfaceHolder)

      Overrides:
        `surfaceDestroyed` in class `VideoDisplayComponent`

    - #### getVideoDisplayProperties

          public java.util.Map<java.lang.String,java.lang.String> getVideoDisplayProperties()

    - #### setVideoDisplayProperties

          public void setVideoDisplayProperties(java.util.Map<java.lang.String,java.lang.String> videoDisplayProperties)