GuidesAPI ReferenceRelease Notes
HomeLog InHome
Guides

BlazePlayerSourceDelegate - Android

BlazePlayerSourceDelegate is a interface that defines the delegate methods for various player source interactions within the Blaze framework. It facilitates handling events related to data loading, player visibility, and actions within the player, customized for different player types and sources. This interface is a crucial component for managing player-related events in a robust and flexible manner.

You can implement the following methods:

onDataLoadStarted

method signature

fun onDataLoadStarted(playerType: BlazePlayerType, sourceId: String?)

Called when the data loading process starts for a player of a specified type and source.

Parameters:

  • playerType: The type of the player (BlazePlayerType).
  • sourceId: The unique identifier of the player's source.

onDataLoadCompleted

method signature

fun onDataLoadComplete(playerType: BlazePlayerType, sourceId: String?, itemsCount: Int, result: BlazeResult)

Called when the data loading process is complete for a player of a specified type and source.

Parameters:

  • playerType: The type of the player (BlazePlayerType).
  • sourceId: The unique identifier of the player's source.
  • itemsCount: The number of items loaded.
  • result: The result of the loading process, either success or failure.

onPlayerDidAppear

method signature

fun onPlayerDidAppear(playerType: BlazePlayerType, sourceId: String?)

Called when a player of a specified type and source becomes visible.

Parameters:

  • playerType: The type of the player (BlazePlayerType).
  • sourceId: The unique identifier of the player's source.

onPlayerDidDismiss

method signature

fun onPlayerDidDismiss(playerType: BlazePlayerType, sourceId: String?)

Called when a player of a specified type and source is dismissed.

Parameters:

  • playerType: The type of the player (BlazePlayerType).
  • sourceId: The unique identifier of the player's source.

onTriggerCTA

method signature

fun onTriggerCTA(playerType: BlazePlayerType, sourceId: String?, actionType: BlazeCTAACtionType, actionParam: String) -> Bool

Called when a CTA (Call to Action) is triggered for a player of a specified type and source.

Use it to handle CTA actions like triggering deeplinks or opening webviews, if you wish to override the default handling.

Parameters:

  • playerType: The type of the player (BlazePlayerType).
  • sourceId: The unique identifier of the player's source.
  • actionType: The type of the action triggered (BlazeCTAActionType).
  • actionParam: The parameter associated with the action.

Returns:

  • A boolean value indicating whether the CTA action was handled.

onTriggerPlayerBodyTextLink

method signature

fun onTriggerPlayerBodyTextLink(playerType: BlazePlayerType, sourceId: String?, actionParam: String) -> BlazeLinkActionHandleType

Called when a body text link is triggered for a player of a specified type and source.

Use it to handle links actions like triggering deeplinks or opening webviews, if you wish to override the default handling.

Parameters:

  • playerType: The type of the player (BlazePlayerType).
  • sourceId: The unique identifier of the player's source.
  • actionParam: The parameter associated with the action.

Returns:

  • A BlazeLinkActionHandleType which action to perform.

onTriggerInteractionLink

method signature

fun onTriggerInteractionLink(
    playerType: BlazePlayerType,
    sourceId: String?,
    interactionId: String,
    interactionType: String,
    url: String
): BlazeInteractionLinkHandleType

Called when an interaction (engagement layer) inside a Stories or Moments player asks to open a link.

The URL is passed exactly as the interaction provided it - the SDK does not validate its scheme. If you want to restrict which links can be opened, do it in this method.

This method has a default implementation that returns BlazeInteractionLinkHandleType.DEEPLINK, so existing implementations don't need to override it.

Return a BlazeInteractionLinkHandleType to control what the SDK does with the link:

  • BlazeInteractionLinkHandleType.DEEPLINK (default): The SDK opens the URL externally (e.g. the device browser).
  • BlazeInteractionLinkHandleType.WEB: The SDK opens the URL in its full-screen in-app web view.
  • BlazeInteractionLinkHandleType.HANDLED: The SDK does nothing; the app handled the link.

Parameters:

  • playerType: The type of the player (BlazePlayerType).
  • sourceId: The unique identifier of the player's source.
  • interactionId: The identifier of the interaction that requested the link.
  • interactionType: The type of the interaction that requested the link.
  • url: The URL requested by the interaction.

Returns:

  • A BlazeInteractionLinkHandleType indicating how the SDK should handle the link.

onPlayerEventTriggered

method signature

fun onPlayerEventTriggered(playerType: BlazePlayerType, sourceId: String?, event: BlazePlayerEvent)

Called when an event is triggered for a player of a specified type and source.

Parameters:

playerType: The type of the player (BlazePlayerType).

sourceId: The unique identifier of the player's source.

event: The event that was triggered (BlazePlayerEvent).

onTriggerCustomActionButton

method signature

fun onTriggerCustomActionButton(playerType: BlazePlayerType, sourceId: String?, customParams: BlazePlayerCustomActionButtonParams)

Called when a custom action button is triggered for a player of a specified type and source.

Parameters:

playerType: The type of the player (BlazePlayerType).

sourceId: The unique identifier of the player's source.

customParams: The custom parameters associated with the action (BlazePlayerCustomActionButtonParams).

onSearchButtonClicked

method signature

fun onSearchButtonClicked(playerType: BlazePlayerType, sourceId: String?): BlazeSearchHandleType?

Called when the search button is clicked in a player.

Return a BlazeSearchHandleType to control the search behavior:

  • BlazeSearchHandleType.BySDK: The SDK opens the search screen with the provided BlazeSearchScreenParams.
  • BlazeSearchHandleType.ByApp: The SDK does nothing; the client handles the action.
  • null (default): The SDK opens the search screen using the player's own data source as suggestions.

Parameters:

  • playerType: The type of the player (BlazePlayerType).
  • sourceId: The unique identifier of the player's source.

Returns:

  • A BlazeSearchHandleType indicating how to handle search, or null for default SDK behavior. See BlazeSearchHandleType for details.

onShareClicked

method signature

fun onShareClicked(playerType: BlazePlayerType, sourceId: String?, shareParams: BlazeShareParams): String?

Called when the share button is clicked for a player of a specified type and source. Return a custom share link to override the SDK's default share link, or return null to use the SDK's internal link generator.

Parameters:

  • playerType: The type of the player (BlazePlayerType).
  • sourceId: The unique identifier of the player's source.
  • shareParams: Parameters containing information about the content being shared (BlazeShareParams).

Returns:

  • A custom share link (String), or null to use the SDK's default link.

Note: When using custom share links, the SDK's BlazeSDK.handleUniversalLink will not be able to parse them. Your app must handle these links on its own by parsing the URL and calling the appropriate entry point methods directly (e.g. BlazeSDK.playStory, BlazeSDK.playMoment, BlazeSDK.playVideo).

onContentRestricted

method signature

fun onContentRestricted(
    playerType: BlazePlayerType,
    sourceId: String?,
    reason: BlazeContentRestrictionReason,
    contentParams: BlazeRestrictedContentParams
): BlazeContentRestrictionHandleType

Called when a piece of content cannot be played because the viewer is not entitled to it. Entitlement is enforced server-side; the SDK does not gate, redirect, or present anything of its own here. Whatever is returned, the SDK holds the item rather than skipping it and removes the controls and indicators that promise playback. Playback does not start.

The return value is reserved for a later version, in which it will choose between the SDK's own presentation of the refused item (SDK_SHOULD_HANDLE, the default) and the host's (HANDLED_BY_APP).

Parameters:

  • playerType: The type of the player (BlazePlayerType).
  • sourceId: The unique identifier of the player's source.
  • reason: Why playback was refused. See BlazeContentRestrictionReason.
  • contentParams: Which item was refused, in the same vocabulary as a widget tap. See BlazeRestrictedContentParams.

Returns:

Note: For the concept and the end-to-end flow, see Content entitlements.

Models

BlazeShareParams

Parameters provided to the app when the share button is clicked.

PropertyTypeDescription
idStringThe unique identifier of the content being shared.
contentTypeBlazeShareContentTypeThe type of content being shared (Story, Moment, or Video).
titleString?The title of the content.
descriptionString?Optional description of the content.
sdkGeneratedLinkStringThe link that the SDK would generate by default.
extraInfoMap<String, String>Content-level extra info metadata for the shared item. For Stories this is the story's extra info; for Moments and Videos it is the item's own extra info. Defaults to an empty map when the content has no extra info. Always populated — not gated by the analyticsAddExtraInfo remote flag.

BlazeShareContentType

A sealed interface representing the type of content being shared.

ValueDescription
StoryStory content type. Contains a pageId property for the specific story page.
MomentMoment content type.
VideoVideo content type.

Enums

BlazeLinkActionHandleType

A type representing the available action for handling a link trigger.

ValueDescription
WEBOpens the link in an internal web view.
DEEPLINKOpens the link in an external browser if possible.
HANDLEDDoes nothing since the link has been handled already.

BlazeInteractionLinkHandleType

A type representing the available action for handling a link requested by an interaction (engagement layer).

ValueDescription
DEEPLINKOpens the link externally (e.g. the device browser). This is the default.
WEBOpens the link in the SDK's full-screen in-app web view.
HANDLEDDoes nothing since the app has handled the link.

BlazePlayerType

BlazePlayerType is an enumeration within the Blaze framework that categorizes different types of players. It is essential for distinguishing various player styles and functionalities, thereby enabling specific behaviors and features for each type.

ValueDescription
MOMENTSRepresents a player type specifically designed for 'moments'.
STORIESRepresents a player type specifically designed for 'stories'.
VIDEOSRepresents a player type specifically designed for videos.

Did this page help you?