Skip to main content

Linear Channels / FAST

Methods​

changeChannelUrl​

function changeChannelUrl(nativeId: string, params: ChannelParams): Promise<string>;

Hands the player of the <Video nativeID={nativeId}> to the SDK and resolves with the local proxy URL to play instead of params.videoUrl.

The <Video> must already be mounted on the original URL: react-native-video only builds its player once a source is set, and the SDK needs that instance to pick an adapter. Waiting for onLoad is the reliable signal.

ParameterTypeDescription
nativeIdstringThe nativeID of the <Video> to hand over
paramsChannelParamsChannel and ad configuration

ChannelParams​

FieldTypeDescription
videoUrlstringOriginal playback URL
adTagUrlstringAd tag URL issued by an ad server
channelIdstringChannel ID
Channel IDs must be registered in the FLOWER backend system
playerTypePlayerType(Optional) Player library owning the view. Defaults to 'react-native-video'.
extraParamsStringMap(Optional) Additional information pre-agreed for targeting
adTagHeadersStringMap(Optional) HTTP headers added to ad requests
channelStreamHeadersStringMap(Optional) HTTP headers added to requests for the original stream
prerollAdTagUrlstring(Optional) Ad tag URL for a pre-roll break, played before the channel itself starts
export type ChannelParams = {
videoUrl: string;
adTagUrl: string;
channelId: string;
playerType?: PlayerType;
extraParams?: StringMap;
adTagHeaders?: StringMap;
channelStreamHeaders?: StringMap;
prerollAdTagUrl?: string;
};

Rejects when no view carries that nativeID, or when its player has not been built yet.

stop​

Stops the current ad break for one channel. Playback of the content itself continues. See stop.

Work Process​

  1. Mount <Video nativeID="…"> on the original stream URL so react-native-video builds its player.
  2. Subscribe to ad events with addAdEventListenerFor if your app needs to react to ad playback.
  3. Once onLoad fires, call changeChannelUrl() with that nativeID.
  4. Swap the <Video> source to the returned proxy URL. The player is reused, not rebuilt.
  5. Call release when the <Video> unmounts.
// arg0: nativeId, the nativeID of the <Video> to hand over
// params.videoUrl: original Linear TV stream url
// params.adTagUrl: url from the flower system
// You must file a request to Anypoint Media to receive an adTagUrl.
// params.channelId: unique channel id in your service
// params.extraParams: (Optional) values you can provide for targeting
// params.adTagHeaders: (Optional) values included in headers for ad requests
// params.channelStreamHeaders: (Optional) values included in headers for the channel stream
// params.prerollAdTagUrl: (Optional) ad tag url for a pre-roll break
const proxyUrl = await changeChannelUrl('channel-1', {
videoUrl: 'https://XXX',
adTagUrl: 'https://ad_request',
channelId: '100',
extraParams: {genre: 'horror'},
adTagHeaders: {'custom-ad-header': 'custom-ad-header-value'},
channelStreamHeaders: {'custom-stream-header': 'custom-stream-header-value'},
prerollAdTagUrl: 'https://preroll_ad_request',
});

setSourceUri(proxyUrl);