Package com.castlabs.sdk.ima

# Class ImaStreamRequest

java.lang.Object
com.castlabs.sdk.ima.ImaStreamRequest

public final class ImaStreamRequest extends Object
IMA request implementation allowing to issue IMA stream requests with server side ads insertion

After `ImaPlugin` is registered and enabled the request can be issued as following:

      // Starting playback with a Bundle
      Bundle bundle = new Bundle();
      bundle.putParcelable(SdkConsts.INTENT_ADVERTS_DATA, new ImaStreamRequest("ContentSourceId", "VideoId", "ApiKey").toAdRequest())

      // Starting playback with PlayerConfig
      PlayerConfig config = new PlayerConfig.Builder("content_url")
        .adRequest(new ImaStreamRequest("ContentSourceId", "VideoId", "ApiKey").toAdRequest())
        .contentType(SdkConsts.CONTENT_TYPE_DASH)
             .get();

Since:
  4.2.19

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final boolean`
  `adSnapback`
  Set to `true` to force play the closest skipped ad when seeking the content.
  `final String`
  `apiKey`
  API key for the ad server
  `final String`
  `assetKey`
  Asset key for server side ad insertion streams.
  `final String`
  `contentSourceId`
  Content source ID for VOD server side ad insertion streams.
  `boolean`
  `disableDefaultAdUi`
  Set to `true` to disable the default IMA ad UI.
  `final String`
  `fallbackUrl`
  Fallback Url to be used when stream Url can not be retrieved from the ad server
  `final String`
  `videoId`
  Video ID for VOD server side ad insertion streams.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ImaStreamRequest(String assetKey, String apiKey)`
  Create IMA stream request for live streams
  `ImaStreamRequest(String contentSourceId, String videoId, String apiKey)`
  Create IMA stream request for VOD streams
  `ImaStreamRequest(String assetKey, String apiKey, String fallbackUrl, boolean adSnapback)`
  Create IMA stream request for live streams
  `ImaStreamRequest(String contentSourceId, String videoId, String apiKey, String fallbackUrl, boolean adSnapback)`
  Create IMA stream request for VOD streams
  `ImaStreamRequest(String contentSourceId, String videoId, String apiKey, String assetKey, String fallbackUrl, boolean isLive, boolean adSnapback, boolean disableDefaultAdUi)`
  Create IMA stream request.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  `int`
  `hashCode()`
  `AdRequest`
  `toAdRequest()`
  Converts this `ImaStreamRequest` to an `AdRequest`.

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

  `getClass, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### contentSourceId

    @Nullable public final String contentSourceId
    Content source ID for VOD server side ad insertion streams. Set to `null` for live streams

  - ### videoId

    @Nullable public final String videoId
    Video ID for VOD server side ad insertion streams. Set to `null` for live streams

  - ### apiKey

    @Nullable public final String apiKey
    API key for the ad server

  - ### assetKey

    @Nullable public final String assetKey
    Asset key for server side ad insertion streams. Set to `null` for VOD streams

  - ### fallbackUrl

    @Nullable public final String fallbackUrl
    Fallback Url to be used when stream Url can not be retrieved from the ad server

  - ### adSnapback

    public final boolean adSnapback
    Set to `true` to force play the closest skipped ad when seeking the content.

  - ### disableDefaultAdUi

    public boolean disableDefaultAdUi
    Set to `true` to disable the default IMA ad UI.

- ## Constructor Details

  - ### ImaStreamRequest

    public ImaStreamRequest(@Nullable String contentSourceId, @Nullable String videoId, @Nullable String apiKey)
    Create IMA stream request for VOD streams
    Parameters:
      `contentSourceId` - Content source Id
      `videoId` - Video Id
      `apiKey` - API key

  - ### ImaStreamRequest

    public ImaStreamRequest(@Nullable String contentSourceId, @Nullable String videoId, @Nullable String apiKey, @Nullable String fallbackUrl, boolean adSnapback)
    Create IMA stream request for VOD streams
    Parameters:
      `contentSourceId` - Content source Id
      `videoId` - Video Id
      `apiKey` - API key
      `fallbackUrl` - Fallback Url
      `adSnapback` - Enable or disable ads snap back

  - ### ImaStreamRequest

    public ImaStreamRequest(@Nullable String assetKey, @Nullable String apiKey)
    Create IMA stream request for live streams
    Parameters:
      `assetKey` - Asset key
      `apiKey` - API key

  - ### ImaStreamRequest

    public ImaStreamRequest(@Nullable String assetKey, @Nullable String apiKey, @Nullable String fallbackUrl, boolean adSnapback)
    Create IMA stream request for live streams
    Parameters:
      `assetKey` - Asset key
      `apiKey` - API key
      `fallbackUrl` - Fallback Url
      `adSnapback` - Enable or disable ads snap back

  - ### ImaStreamRequest

    public ImaStreamRequest(@Nullable String contentSourceId, @Nullable String videoId, @Nullable String apiKey, @Nullable String assetKey, @Nullable String fallbackUrl, boolean isLive, boolean adSnapback, boolean disableDefaultAdUi)
    Create IMA stream request.
    Parameters:
      `contentSourceId` - Content source Id for VOD streams.
      `videoId` - Video Id for VOD streams.
      `apiKey` - API key for the ad server.
      `assetKey` - Asset key for live streams.
      `fallbackUrl` - Fallback Url to be used when stream Url can not be retrieved from the ad server.
      `isLive` - Set to `true` for live streams, `false` otherwise.
      `adSnapback` - Set to `true` to force play the closest skipped ad when seeking the content.
      `disableDefaultAdUi` - Set to `true` to disable the default IMA ad UI.

- ## Method Details

  - ### toAdRequest

    @NonNull public AdRequest toAdRequest()
    Converts this `ImaStreamRequest` to an `AdRequest`.
    Returns:
      The `AdRequest` representation of this IMA stream request.

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`