GuidesAPI ReferenceRelease Notes
HomeLog InHome
Guides

BlazeWidgetItemClickHandlerState

BlazeWidgetItemClickHandlerState represents the different states when a widget is clicked within the application.

ValueDescription
handledByAppIndicates that the application is responsible for handling the click event.
In this state, the SDK does not intervene, and the player isn't initiated by the SDK. This allows
the application developers to define custom behaviors or actions when a widget is clicked, without triggering
the default SDK player actions.
sdkShouldHandleSignifies that the SDK should take over the handling of the click event.
In this scenario, the SDK will initiate the player and will start to play content within the player.

BlazeWidgetItemClickParams

Parameters passed to the onWidgetItemClickHandler closure when a widget item is clicked.

public struct BlazeWidgetItemClickParams {
    public let widgetId: String
    public let contentIndex: Int
    public let contentId: String
    public let extraInfo: [String: String]
    public let contentThumbnailUrl: String?
}
PropertyTypeDescription
widgetIdStringThe ID of the widget containing the clicked item.
contentIndexIntThe zero-based index of the clicked item within the widget.
contentIdStringThe unique content ID of the clicked item.
extraInfo[String: String]Additional key-value metadata associated with the clicked item. Empty dictionary if no metadata is present.
contentThumbnailUrlString?The URL of the clicked item's main thumbnail, matching the thumbnail rendered by the widget. nil when the item has no thumbnail. Available for Stories, Moments, and Videos widgets.

Usage example

widgetView.onWidgetItemClickHandler = { params in
    print("Clicked item \(params.contentId), extraInfo: \(params.extraInfo)")
    if let thumbnailUrl = params.contentThumbnailUrl {
        print("Thumbnail URL: \(thumbnailUrl)")
    }
    return .sdkShouldHandle
}

Did this page help you?