BlazeWidgetItemClickHandlerState
BlazeWidgetItemClickHandlerState represents the different states when a widget is clicked within the application.
| Value | Description |
|---|---|
| handledByApp | Indicates 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. |
| sdkShouldHandle | Signifies 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?
}| Property | Type | Description |
|---|---|---|
| widgetId | String | The ID of the widget containing the clicked item. |
| contentIndex | Int | The zero-based index of the clicked item within the widget. |
| contentId | String | The 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. |
| contentThumbnailUrl | String? | 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
}Updated 25 days ago
Did this page help you?
