Skip to main content

Product highlights

Product highlights allow the host of a live show to pin a product in the player overlay, drawing viewer attention to it. Your app is notified whenever the highlighted product changes, and can react by updating custom UI elements.

Handle Highlight Updates

Listen for the should-update-product-highlight event in your BambuserVideoPlayerDelegate to receive the currently highlighted product.

func onNewEventReceived(id: String, event: BambuserEventPayload) {
switch event.type {

case "should-update-product-highlight":
guard let productData = event.data["event"] as? [String: Sendable] else { return }
let productId = productData["id"] as? String
let sku = productData["ref"] as? String
let title = productData["title"] as? String

DispatchQueue.main.async {
// Fetch your own product data to hydrate the products
}

default:
break
}
}

Handle Product View (Custom Navigation)

When the product button is configured as "none", tapping a highlighted product fires should-show-product-view instead of opening the player's built-in product modal. Use this to navigate to your native product detail screen.

case "should-show-product-view":
guard let productData = event.data["event"] as? [String: Sendable],
let sku = productData["ref"] as? String else { return }

DispatchQueue.main.async {
self.navigateToProduct(sku: sku)
}

To enable this behavior, set the product button to "none" in your player configuration:

configuration: [
"buttons": [
"product": "none"
]
]

Handle Product List

When a user opens the product list in the player with product set to "none", the should-show-product-list and should-hide-product-list events fire. You can use these to coordinate your own product list overlay with the player.

case "should-show-product-list":
DispatchQueue.main.async {
self.showProductListOverlay()
}

case "should-hide-product-list":
DispatchQueue.main.async {
self.hideProductListOverlay()
}

Note: Product data for highlights is provided to the player via product hydration. See Product hydration for how to supply product details using invoke("updateProductWithData", ...).