com.brightcove.cast

## Class GoogleCastComponent

- java.lang.Object
- - com.brightcove.player.event.AbstractComponent
  - - com.brightcove.cast.GoogleCastComponent

- All Implemented Interfaces:
    Component

      @Emits(events={"registerPlugin","didPlay","didPause","castSessionStarted","castSessionEnded"})
       @ListensFor(events={"activityPaused","activityResumed","fragmentPaused","fragmentResumed","activityDestroyed","fragmentDestroyed","setMediaMetadata","destroyCast","setMediaInfo","addMediaInfo","setMediaQueueItem","addMediaQueueItem","controlBarCreated"})
      public class GoogleCastComponent
      extends AbstractComponent

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `GoogleCastComponent.Builder` The Builder to create a `GoogleCastComponent`.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `CAST_MEDIA_INFO`
    `static java.lang.String` | `CAST_MEDIA_METADATA_BIG_IMAGE_URL`
    `static java.lang.String` | `CAST_MEDIA_METADATA_CONTENT_TYPE`
    `static java.lang.String` | `CAST_MEDIA_METADATA_IMAGE_URL`
    `static java.lang.String` | `CAST_MEDIA_METADATA_OBJECT`
    `static java.lang.String` | `CAST_MEDIA_METADATA_STUDIO`
    `static java.lang.String` | `CAST_MEDIA_METADATA_SUBTITLE`
    `static java.lang.String` | `CAST_MEDIA_METADATA_TITLE`
    `static java.lang.String` | `CAST_MEDIA_METADATA_URL`
    `static java.lang.String` | `CAST_MEDIA_METADATA_VIDEO_ID`
    `static java.lang.String` | `CAST_MEDIA_PLAY_POSITION` Deprecated.
    `static java.lang.String` | `CAST_MEDIA_PLAY_POSITION_LONG`
    `static java.lang.String` | `CAST_MEDIA_QUEUE_ITEM`
    `static java.lang.String` | `CAST_MENU` Deprecated.
    `static java.lang.String` | `CAST_MENU_RESOURCE_ID` Deprecated.
    `static java.lang.String` | `CAST_MINICONTROLLER` Deprecated.
    `static java.lang.String` | `CAST_PLAYER`

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

      `eventEmitter, listenerTokens`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GoogleCastComponent(EventEmitter emitter, android.content.Context context)` Deprecated. Use `GoogleCastComponent.Builder.build()`
    `GoogleCastComponent(EventEmitter emitter, android.content.Context context, BrightcoveCastMediaManager brightcoveCastMediaManager)` Deprecated. Use `GoogleCastComponent.Builder.build()`
    `GoogleCastComponent(EventEmitter emitter, java.lang.String applicationId, android.content.Context context)` Deprecated. Use `GoogleCastComponent.Builder.build()`
    `GoogleCastComponent(EventEmitter emitter, java.lang.String applicationId, android.content.Context context, boolean autoPlay)` Deprecated. Use `GoogleCastComponent.Builder.build()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult>` | `addItems(com.google.android.gms.cast.MediaQueueItem... mediaQueue)`
    `void` | `enableCustomData(boolean enableCustomData)` Enables/Disables custom data in the current `BrightcoveCastMediaManager` instance.
    `CustomData` | `getCustomData()`
    `static void` | `initializeVideoCastManager(android.content.Context context, java.lang.String applicationId, java.lang.Class<? extends android.app.Activity> targetActivity)` Deprecated.
    `boolean` | `isSessionAvailable()`
    `com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult>` | `loadItem(com.google.android.gms.cast.MediaQueueItem mediaQueue, int playheadPosition)`
    `void` | `loadMediaInfo(com.google.android.gms.cast.MediaInfo mediaInfo)` Load the Google Cast MediaInfo object.
    `void` | `loadMediaInfo(com.google.android.gms.cast.MediaInfo mediaInfo, long positionMs)` Load the Google Cast MediaInfo object.
    `void` | `setAutoPlay(boolean autoPlayEnabled)` Sets auto play.
    `void` | `setCustomData(CustomData customData)`
    `void` | `setIsQueuingSupported(boolean isQueuingSupported)` Enables/Disables queuing support in the current `BrightcoveCastMediaManager` instance.
    `static android.view.MenuItem` | `setUpMediaRouteButton(android.app.Activity activity, android.view.Menu menu)`

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

    - #### CAST_MEDIA_METADATA_OBJECT

          public static final java.lang.String CAST_MEDIA_METADATA_OBJECT

      See Also:
        Constant Field Values

    - #### CAST_MEDIA_METADATA_SUBTITLE

          public static final java.lang.String CAST_MEDIA_METADATA_SUBTITLE

      See Also:
        Constant Field Values

    - #### CAST_MEDIA_METADATA_TITLE

          public static final java.lang.String CAST_MEDIA_METADATA_TITLE

      See Also:
        Constant Field Values

    - #### CAST_MEDIA_METADATA_STUDIO

          public static final java.lang.String CAST_MEDIA_METADATA_STUDIO

      See Also:
        Constant Field Values

    - #### CAST_MEDIA_METADATA_IMAGE_URL

          public static final java.lang.String CAST_MEDIA_METADATA_IMAGE_URL

      See Also:
        Constant Field Values

    - #### CAST_MEDIA_METADATA_BIG_IMAGE_URL

          public static final java.lang.String CAST_MEDIA_METADATA_BIG_IMAGE_URL

      See Also:
        Constant Field Values

    - #### CAST_MEDIA_METADATA_URL

          public static final java.lang.String CAST_MEDIA_METADATA_URL

      See Also:
        Constant Field Values

    - #### CAST_MEDIA_METADATA_CONTENT_TYPE

          public static final java.lang.String CAST_MEDIA_METADATA_CONTENT_TYPE

      See Also:
        Constant Field Values

    - #### CAST_MEDIA_METADATA_VIDEO_ID

          public static final java.lang.String CAST_MEDIA_METADATA_VIDEO_ID

      See Also:
        Constant Field Values

    - #### CAST_MEDIA_INFO

          public static final java.lang.String CAST_MEDIA_INFO

      See Also:
        Constant Field Values

    - #### CAST_MEDIA_QUEUE_ITEM

          public static final java.lang.String CAST_MEDIA_QUEUE_ITEM

      See Also:
        Constant Field Values

    - #### CAST_MEDIA_PLAY_POSITION

          @Deprecated
          public static final java.lang.String CAST_MEDIA_PLAY_POSITION

      Deprecated.
      See Also:
        Constant Field Values

    - #### CAST_MEDIA_PLAY_POSITION_LONG

          public static final java.lang.String CAST_MEDIA_PLAY_POSITION_LONG

      See Also:
        Constant Field Values

    - #### CAST_PLAYER

          public static final java.lang.String CAST_PLAYER

      See Also:
        Constant Field Values

    - #### CAST_MENU

          @Deprecated
          public static final java.lang.String CAST_MENU

      Deprecated.
      See Also:
        Constant Field Values

    - #### CAST_MENU_RESOURCE_ID

          @Deprecated
          public static final java.lang.String CAST_MENU_RESOURCE_ID

      Deprecated.
      See Also:
        Constant Field Values

    - #### CAST_MINICONTROLLER

          @Deprecated
          public static final java.lang.String CAST_MINICONTROLLER

      Deprecated.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### GoogleCastComponent

          @Deprecated
          public GoogleCastComponent(EventEmitter emitter,
                                                 java.lang.String applicationId,
                                                 android.content.Context context,
                                                 boolean autoPlay)

      Deprecated. Use `GoogleCastComponent.Builder.build()`
      Parameters:
        `emitter` - The current event emitter.
        `applicationId` - The application ID for the receiver application on the Chromecast.
        `context` - The top-level application context.
        `autoPlay` - Boolean for deciding whether or not to auto play local playback on return from the Chromecast.

    - #### GoogleCastComponent

          @Deprecated
          public GoogleCastComponent(EventEmitter emitter,
                                                 java.lang.String applicationId,
                                                 android.content.Context context)

      Deprecated. Use `GoogleCastComponent.Builder.build()`
      Parameters:
        `emitter` - The current event emitter.
        `applicationId` - The application ID for the receiver application on the Chromecast.
        `context` - The top-level application context.

    - #### GoogleCastComponent

          @Deprecated
          public GoogleCastComponent(@NonNull
                                                 EventEmitter emitter,
                                                 @NonNull
                                                 android.content.Context context)

      Deprecated. Use `GoogleCastComponent.Builder.build()`
      Instantiates a new Google Cast Component.
      Parameters:
        `emitter` - The current event emitter.
        `context` - The top-level application context.

    - #### GoogleCastComponent

          @Deprecated
          public GoogleCastComponent(@NonNull
                                                 EventEmitter emitter,
                                                 @NonNull
                                                 android.content.Context context,
                                                 @Nullable
                                                 BrightcoveCastMediaManager brightcoveCastMediaManager)

      Deprecated. Use `GoogleCastComponent.Builder.build()`
      Instantiates a new Google Cast Component.
      Parameters:
        `emitter` - The current event emitter.
        `context` - The top-level application context.
        `brightcoveCastMediaManager` - The Brightcove Cast Media Manager.

  - ### Method Detail

    - #### loadMediaInfo

          public void loadMediaInfo(com.google.android.gms.cast.MediaInfo mediaInfo)

      Load the Google Cast MediaInfo object.
      Parameters:
        `mediaInfo` - the media info

    - #### loadMediaInfo

          public void loadMediaInfo(com.google.android.gms.cast.MediaInfo mediaInfo,
                                    long positionMs)

      Load the Google Cast MediaInfo object. This will load and auto play the video by default. To change this, you can set autoPlay to false with `setAutoPlay(boolean)`.
      Parameters:
        `mediaInfo` - the media info
        `positionMs` - the position in millis
      See Also:
        `RemoteMediaClient.load(MediaInfo, boolean, long)`

    - #### setAutoPlay

          public void setAutoPlay(boolean autoPlayEnabled)

      Sets auto play. It is enabled by default. This only applies when using `loadMediaInfo(MediaInfo)` or `loadMediaInfo(MediaInfo, long)`.
      Parameters:
        `autoPlayEnabled` - true enabled
      See Also:
        `loadMediaInfo(MediaInfo)`, `loadMediaInfo(MediaInfo, long)`

    - #### enableCustomData

          public void enableCustomData(boolean enableCustomData)

      Enables/Disables custom data in the current `BrightcoveCastMediaManager` instance. If enabled, custom data is added to the MediaInfo object when sending information to the Cast receiver app. Otherwise, custom data is not added.
      Parameters:
        `enableCustomData` - Whether to enable custom data.

    - #### setIsQueuingSupported

          public void setIsQueuingSupported(boolean isQueuingSupported)

      Enables/Disables queuing support in the current `BrightcoveCastMediaManager` instance. If enabled, it is expected that the Receiver will support queuing, and so an Add To Queue menu item will be shown to the user in the play menu when a cast session is in progress. If disabled, it is expected that the Receiver will not support queuing, and so only a Play Now menu item will be shown to the user in the play menu when a cast session is in progress.
      Parameters:
        `isQueuingSupported` - Whether the receiver is expected to support queuing.

    - #### setCustomData

          public void setCustomData(CustomData customData)

    - #### getCustomData

          public CustomData getCustomData()

    - #### setUpMediaRouteButton

          public static android.view.MenuItem setUpMediaRouteButton(@NonNull
                                                                    android.app.Activity activity,
                                                                    @NonNull
                                                                    android.view.Menu menu)

    - #### loadItem

          public com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult> loadItem(com.google.android.gms.cast.MediaQueueItem mediaQueue,
                                                                                                                                                            int playheadPosition)

    - #### addItems

          public com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult> addItems(com.google.android.gms.cast.MediaQueueItem... mediaQueue)

    - #### initializeVideoCastManager

          @Deprecated
          public static void initializeVideoCastManager(android.content.Context context,
                                                                    java.lang.String applicationId,
                                                                    java.lang.Class<? extends android.app.Activity> targetActivity)

      Deprecated.

    - #### isSessionAvailable

          public boolean isSessionAvailable()