Player Entry Point Delegate - React Native
This delegate will be invoked upon different events happening in the player after using playStory or any of those global functions to launch the player directly. You can find more information about the different delegates functions on the native section here.
Declaration
BlazeSDK.init({
...,
playerEntryPointDelegate: {
onDataLoadStarted: (params => {
console.log('EntryPointDelegate - onDataLoadStarted - playerType: ' + params.playerType + ' sourceId: ' + params.sourceId);
}),
onDataLoadComplete: (params => {
console.log('EntryPointDelegate - onDataLoadComplete - playerType: ' + params.playerType + ' sourceId: ' + params.sourceId + ' itemsCount: ' + params.itemsCount + ' error: ' + params.error);
}),
onPlayerDidAppear: (params => {
console.log('EntryPointDelegate - onPlayerDidAppear - playerType: ' + params.playerType + ' sourceId: ' + params.sourceId);
}),
onPlayerDidDismiss: (params => {
console.log('EntryPointDelegate - onPlayerDidDismiss - playerType: ' + params.playerType + ' sourceId: ' + params.sourceId);
}),
onTriggerCTA: (params => {
console.log('EntryPointDelegate - onTriggerCTA - playerType: ' + params.playerType + ' sourceId: ' + params.sourceId + ' actionType: ' + params.actionType + ' actionParam: ' + params.actionParam);
}),
onTriggerPlayerBodyTextLink: (params => {
console.log('EntryPointDelegate - onTriggerPlayerBodyTextLink - playerType: ' + params.playerType + ' sourceId: ' + params.sourceId + ' actionParam: ' + params.actionParam);
}),
onPlayerEventTriggered: (params => {
const playerEvent = params.event
switch (playerEvent.type) {
case 'OnMomentStart': {
console.log('EntryPointDelegate - onPlayerEventTriggered - playerType: ' + params.playerType + ' sourceId: ' + params.sourceId + ' playerEvent: MomentId ' + playerEvent.momentId);
break
}
case 'OnStoryStart': {
console.log('EntryPointDelegate - onPlayerEventTriggered - playerType: ' + params.playerType + ' sourceId: ' + params.sourceId + ' playerEvent: StoryId ' + playerEvent.storyId);
break
}
}
}),
onTriggerCustomActionButton: (params => {
console.log('EntryPointDelegate - onTriggerCustomActionButton - buttonId: ' + params.buttonId + ' buttonName: ' + params.buttonName + ' appMetadata: ' + JSON.stringify(params.appMetadata) + ' sdkMetadata: ' + JSON.stringify(params.sdkMetadata));
}),
onShareClicked: (params => {
console.log('EntryPointDelegate - onShareClicked - contentType: ' + params.contentType + ' id: ' + params.id + ' sdkGeneratedLink: ' + params.sdkGeneratedLink + ' extraInfo: ' + JSON.stringify(params.extraInfo));
}),
onTriggerInteractionLink: (params => {
console.log('EntryPointDelegate - onTriggerInteractionLink - interactionId: ' + params.interactionId + ' interactionType: ' + params.interactionType + ' url: ' + params.url);
}),
onContentRestricted: (params => {
console.log('EntryPointDelegate - onContentRestricted - reason: ' + params.reason + ' isRetriable: ' + params.isRetriable + ' contentId: ' + params.contentParams.contentId);
}),
}
})onTriggerCustomActionButton
Invoked when a viewer taps one of the player's custom action buttons. Its BlazeOnTriggerCustomActionButtonParams:
playerType: The player the button was tapped in.sourceId: The id of the content source, when available.buttonId: The id of the tapped button.buttonName: The name of the tapped button.appMetadata: The metadata your app attached to the button when configuring it.sdkMetadata: Metadata populated by the SDK, reflecting the content's extra info at the moment of the click. It is read-only. There is no way to set it.
onShareClicked
Invoked when a viewer taps the share button, with the share parameters the SDK is about to use. Its BlazeShareParams:
playerType: The player the share was triggered from.sourceId: The id of the content source, when available.id: The id of the shared content.contentType:'Story','Moment', or'Video'.pageId: The specific page being shared. Present only whencontentTypeis'Story'.title: The title of the shared content, when available.description: The description of the shared content, when available.sdkGeneratedLink: The link the SDK shares, generated by its own universal-links generator.extraInfo: The extra info of the shared content, as a map of strings. It is always populated.
This callback is an observer: it reports the share click, and cannot change the link that is shared. The SDK always shares sdkGeneratedLink.
onTriggerCTA
Invoked when a viewer taps a CTA button in a player opened from an entry point, such as playStory. Its parameters:
playerType: The player the CTA was tapped in.sourceId: The id of the content source, when available.actionType:'Deeplink'or'Web'.actionParam: The link assigned to the CTA.
This callback is a notification: the appOverridesCTAHandling init option decides who opens the link. See appOverridesCTAHandling. Open the link yourself only when you set it to true; otherwise it opens twice. The SDK doesn't close the player on a CTA tap, so call BlazeSDK.dismissPlayer() before your app navigates to its own screen.
onTriggerInteractionLink
Added in React Native SDK 1.21.0. Invoked when an Engagement Layer interaction inside a Stories or Moments player asks to open a link. Its BlazeOnTriggerInteractionLinkParams:
playerType: The player the interaction is in.sourceId: The id of the content source, when available.interactionId: The id of the interaction that requested the link.interactionType: The type of the interaction that requested the link.url: The URL requested by the interaction, exactly as the interaction provided it.
This callback is a notification: the interactionLinkHandling init option decides what the SDK does with the link. See interactionLinkHandling. Open the link yourself only when you declared 'Handled'; otherwise it opens twice. With 'Handled', the SDK neither pauses nor dismisses the player, so call BlazeSDK.dismissPlayer() if your app navigates to its own screen.
On iOS, a URL that can't be parsed or has no scheme opens nothing, although this callback is still invoked. Android does not validate the URL.
onContentRestricted
Added in React Native SDK 1.21.0. Invoked when an item cannot be played because the viewer is not entitled to it. Playback of the refused item does not start, and the SDK shows no restriction UI of its own. Its BlazeOnContentRestrictedParams:
playerType: The player the item was refused in.sourceId: The id of the content source, when available.reason: Why playback was refused. See the table below.isRetriable: Whether the same request could succeed later without anything changing for the viewer.contentParams: The refused item:contentIndex: The zero-based index of the item in the list, ads excluded.contentId: The unique content ID of the refused item. For a story, the story, not the page.extraInfo: Content-level metadata for the item, as a map of strings. Empty when there is none.contentThumbnailUrl: The URL of the item's main thumbnail, absent when it has none.
reason decides the next step, such as a paywall, a sign-in, or a fresh token through setExternalUserToken. isRetriable says when trying again later is enough.
reason | isRetriable |
|---|---|
'SubscriptionRequired' | false |
'GeoBlocked' | false |
'VpnBlocked' | false |
'DeviceLimitReached' | false |
'ContentNotAvailable' | false |
'ExternalUserTokenMissing' | false |
'ExternalUserTokenInvalid' | false |
'ExternalUserTokenExpired' | false |
'RateLimited' | true |
'TemporarilyUnavailable' | true |
'Unknown' | false |
'Unknown' also covers reasons added after this SDK version.
This callback is an observer: the SDK's handling of the refused item does not depend on your app. It is not called for players opened from showSearchScreen. See Content entitlements.
Updated 11 days ago
