GuidesAPI ReferenceRelease Notes
HomeLog InHome
Guides

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));
    }),
  }
})

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. Added in React Native SDK 1.20.0. It is read-only — there is no way to set it.

onShareClicked

Added in React Native SDK 1.20.0. 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 when contentType is '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.


Did this page help you?