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
    --- | --- | ---
    `boolean` | `adSnapback` | Set to `true` to force play the closest skipped ad when seeking the content.
    `String` | `apiKey` | API key for the ad server
    `String` | `assetKey` | Asset key for server side ad insertion streams.
    `String` | `contentSourceId` | Content source ID for VOD server side ad insertion streams.
    `String` | `fallbackUrl` | Fallback Url to be used when stream Url can not be retrieved from the ad server
    `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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(Object obj)` |
    `int` | `hashCode()` |
    `AdRequest` | `toAdRequest()` |

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

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

- - ### Field Detail

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

  - ### Constructor Detail

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

  - ### Method Detail

    - #### toAdRequest

          @NonNull
          public AdRequest toAdRequest()

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals​(Object obj)

      Overrides:
        `equals` in class `Object`