# [ima](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima).StreamRequest

class static

## Constructor

### StreamRequest

new
StreamRequest()

Used for specifying properties of the stream request.

## Properties

### adTagParameters

static

String

Optional. You can override a limited set of ad tag parameters
on your stream request.
[Supply targeting parameters to your stream](https://support.google.com/dfp_premium/answer/7320899)
provides more information. You can also use the dai-ot and dai-ov
parameters for stream variant preference. See
[Override stream variant parameters](https://support.google.com/dfp_premium/answer/7320898)
for more information.

### adUiNode

static

roSGNode

A scene graph node where ad UI displays. IMA places elements like **Why
This Ad** and **Skip** buttons on this element during ads. The element
must overlay the entire video element.

### apiKey

static

String

Optional. These keys can be used to authenticate stream requests.
[DAI authentication keys](https://support.google.com/dfp_premium/answer/6381445)
must be set up in the DFP UI.

### assetKey

static

String

Required for live streams. This is used to determine which
stream should be played. The live stream request
[asset key](https://support.google.com/dfp_premium/answer/7294289#locate-a-live-linear-stream-url-and-asset-key)
is an identifier which can be found in the DFP UI.

### authToken

static

String

The stream request authorization token. Used in place of the API key
for stricter content authorization. The publisher can control individual
content streams authorizations based on this token.

### contentSourceId

static

String

Required for on-demand streams. The
[cmsid](https://support.google.com/dfp_premium/answer/1068325#cmsid-vid)
comes from the DFP Video Content Source in the DFP UI.

### customAssetKey

static

String

The custom asset key is used to determine which stream should be played.
Custom asset keys are required for pod serving stream requests.

### format

static

[ima.StreamFormat](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.StreamFormat)

The format of the stream. Defaults to `ima.StreamFormat.HLS`.

### networkCode

static

String

The network code for the publisher making the stream request. Network codes
are required for Pod serving stream requests made with
createPodLiveStreamRequest or createPodVodStreamRequest. These codes are
also required for Cloud stitching stream requests made with
createVideoStitcherLiveStreamRequest, createVideoStitcherVodStreamRequest,
or createVideoStitcherVodStreamRequestWithVodConfig. These codes are
optional and recommended for Full service stream requests made with
createLiveStreamRequest or createVodStreamRequest. Adding the network code
applies settings selected in the Ad Manager UI, such as programmatic limited
ads enablement. For Pod serving and Cloud stitching, adding the network code
locates and plays the stream. To find the network code, see
[this article](https://support.google.com/admanager/answer/7674889).

### player

static

([ima.Player](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.Player) or Invalid)

An implementation of the player interface.

### ppid

static

String

Deprecated. Use adTagParameters.
Optional. A DFP Audience
[publisher provided identifier](https://support.google.com/dfp_premium/answer/2880055).

### streamActivityMonitorId

static

String

The ID to be used to debug the stream with the stream activity monitor.
This is used to provide a convenient way to allow publishers to find a
stream log in the stream activity monitor tool.

### videoId

static

String

Required for on-demand streams.
Identifier for the video content source.

### videoObject

static

(roVideo or Invalid)

The video object (such as the Video roSGNode) responsible for video playback
on the client app. This object will be polled for various data to be used in
properly timing Live HLS ID3 events.

### videoStitcherSessionOptions

static

Array of V

The session options are used to set video sticher specific parameters for
VideoStitcher streamRequests.

## Methods

### createLiveStreamRequest

static

createLiveStreamRequest(assetKey, apiKey, networkCode) returns [ima.StreamRequest](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.StreamRequest)

Initializes required properties of a Live `StreamRequest`. Using
this API causes any other `StreamType`-specific properties to be
ignored.
If any required parameters are empty strings, error logging occurs and the API
returns a generic `StreamRequest`, with no properties ignored.

| #### Parameter ||
|---|---|
| assetKey | string |
| apiKey | string Parameter assigned to the returned `ima.StreamRequest`'s `ima.StreamRequest.apiKey` property. If no API key exists, pass an empty string. |
| networkCode | string Network code for the publisher making the stream request. Including the network code is optional, but recommended. |

Returns

:   `https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.StreamRequest` `ima.StreamRequest` object with
    required Live properties.

### createPodLiveStreamRequest

static

createPodLiveStreamRequest(customAssetKey, networkCode, apiKey) returns StreamRequest

Initializes required properties of a Pod Live `ima.StreamRequest`.
Using this API causes any other `ima.StreamType`-specific
properties to be ignored.
If any required parameters are empty strings, error logging occurs and the API
returns a generic `StreamRequest`, with no properties ignored.

| #### Parameter ||
|---|---|
| customAssetKey | string |
| networkCode | string |
| apiKey | string Optional parameter assigned to the returned `ima.StreamRequest`'s `ima.StreamRequest.apiKey` property; defaults to empty string. |

Returns

:   `StreamRequest` `ima.StreamRequest` object with required
    PodLive properties.

### createPodVodStreamRequest

static

createPodVodStreamRequest(networkCode) returns StreamRequest

Initializes the required properties of a `ima.StreamRequest` to
register a VOD stream when using DAI Pod serving with a third party video
stitcher. This function sets the request type to
`ima.StreamType.POD_VOD` and validates all required properties
for missing data. Failed validations will log an error in the debug
console.

| #### Parameter ||
|---|---|
| networkCode | string the Google Ad Manager network code |

Returns

:   `StreamRequest` an `ima.StreamRequest` object. If all
    required properties are specified, the request type is set to
    `ima.StreamType.POD_VOD`.

### createStreamRequest

static

createStreamRequest() returns [ima.StreamRequest](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.StreamRequest)

Returns

:   `https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.StreamRequest` An empty `ima.StreamRequest` object.

### createVideoStitcherLiveStreamRequest

static

createVideoStitcherLiveStreamRequest(customAssetKey, networkCode, liveConfigId, region, projectNumber, oAuthToken) returns [ima.StreamRequest](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.StreamRequest)

Initializes required properties of a Video Stitcher Live
`StreamRequest`. Using this API causes any other
`StreamType`-specific properties to be ignored.
If any required parameters are empty strings, error logging occurs and the API
returns a generic `StreamRequest`, with no properties ignored.

| #### Parameter ||
|---|---|
| customAssetKey | string |
| networkCode | string |
| liveConfigId | string |
| region | string |
| projectNumber | string |
| oAuthToken | string |

Returns

:   `https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.StreamRequest` `ima.StreamRequest` object with
    required VideoStitcherLive properties.

### createVideoStitcherVodStreamRequest

static

createVideoStitcherVodStreamRequest(adTagUrl, networkCode, contentSourceUrl, region, projectNumber, oAuthToken) returns [ima.StreamRequest](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.StreamRequest)

Initializes required properties of a Video Stitcher VOD
`StreamRequest`. Using this API causes any other
`StreamType`-specific properties to be ignored.
If any required parameters are empty strings, error logging occurs and the API
returns a generic `StreamRequest`, with no properties ignored.

| #### Parameter ||
|---|---|
| adTagUrl | string |
| networkCode | string |
| contentSourceUrl | string |
| region | string |
| projectNumber | string |
| oAuthToken | string |

Returns

:   `https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.StreamRequest` `ima.StreamRequest` object with
    required VideoStitcherVod properties.

### createVideoStitcherVodStreamRequestWithVodConfig

static

createVideoStitcherVodStreamRequestWithVodConfig(vodConfigId, networkCode, region, projectNumber, oAuthToken) returns [ima.StreamRequest](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.StreamRequest)

Initializes required properties of a Video Stitcher VOD
`StreamRequest` using `vodConfigId` created from cloud
video stitcher.
Using this API causes any other `StreamType`-specific properties to
be ignored.
If any required parameters are empty strings, error logging occurs and the API
returns a generic `StreamRequest`, with no properties ignored.

| #### Parameter ||
|---|---|
| vodConfigId | string |
| networkCode | string |
| region | string |
| projectNumber | string |
| oAuthToken | string |

Returns

:   `https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.StreamRequest` `ima.StreamRequest` object with
    required VideoStitcherVod properties.

### createVodStreamRequest

static

createVodStreamRequest(contentSourceId, videoId, apiKey, networkCode) returns [ima.StreamRequest](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.StreamRequest)

Initializes required properties of a VOD `ima.StreamRequest`. Using
this API causes any other `ima.StreamType`-specific properties to
be ignored.
If any required parameters are empty strings, error logging occurs and the API
returns a generic `StreamRequest`, with no properties ignored.

| #### Parameter ||
|---|---|
| contentSourceId | string |
| videoId | string |
| apiKey | string Parameter assigned to the returned `ima.StreamRequest`'s `ima.StreamRequest.apiKey` property. If no API key exists, pass an empty string. |
| networkCode | string Network code for the publisher making the stream request. Including the network code is optional, but recommended. |

Returns

:   `https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/roku/reference/ima.StreamRequest` `ima.StreamRequest` object with
    required VOD properties.