For the complete documentation index, see llms.txt. This page is also available as Markdown.

Customize click behaviors (iOS)

The SDK provides behavior delegate methods to customize click behaviors, including those for the video CTA button, product cards, and shopping CTA button.

Customize video overlay CTA button click behavior

  1. Set FireworkVideoCTADelegate delegate:

FireworkVideoSDK.ctaDelegate = <FireworkVideoCTADelegate delegate>

2. Implement handleCustomCTAClick(_:url:for:):

func handleCustomCTAClick(
    _ viewController: PlayerViewController,
    url: URL,
    for video: VideoDetails
) -> Bool {
    // Here, you could write codes to navigate to the host app page.
    // For best practices on navigating to the host page,
    // please consult "Navigate to the host app page" below.

    // Return true to customize video overlay CTA button click behavior
    return true
}

You could write codes to navigate to the host app page within the delegate method. For best practices on navigating to the host page, please consult Navigate to the host app page below.

Customize click behaviors for shopping

To customize click behaviors for shopping, you need to set FireworkVideoShoppingDelegate delegate first:

Customize product card click behavior

Implement fireworkShopping(_:didTapProductVariant:forVideo:):

You could write codes to navigate to the host app page within the delegate method. For best practices on navigating to the host page, please consult Navigate to the host app page below.

Customize shopping CTA click behavior

Implement fireworkShopping(_:productVariantCTASelected:fromVideo:ctaCompletionHandler:):

You could write codes to navigate to the host app page within the delegate method. For best practices on navigating to the host page, please consult Navigate to the host app page below.

Implement fireworkShopping(_:didTapLinkButtonAt:fromVideo:withURL:):

You could write codes to navigate to the host app page within the delegate method. For best practices on navigating to the host page, please consult Navigate to the host app page below.

Customize cart icon click behavior

  1. Set cartAction to custom:

  1. Implement fireworkShopping(_:didTapCartIconForVideo:):

You could write codes to navigate to the host app page within the delegate method. For best practices on navigating to the host page, please consult Navigate to the host app page below.

  1. Set FireworkLiveStreamBehaviorDelegate delegate:

  1. Implement fireworkLiveStream(_:didTapLinkInteraction:):

You could write codes to navigate to the host app page within the delegate method. For best practices on navigating to the host page, please consult Navigate to the host app page below.

Customize social attribution click behavior

  1. Set FireworkVideoSocialDelegate delegate:

  1. Implement handleSocialAttributionClick(_:fromVideo:):

Customize video feed item click behavior

  1. Set VideoFeedViewControllerDelegate delegate:

  1. Implement videoFeed(_:didTapFeedItem:):

We have three ways to navigate to the host app page when customizing click behaviors.

  1. Present the host app page over the SDK player.

  2. Push the host app page inside the SDK player.

  3. Use the host app navigation controller to push the host app page.

Present the Host App Page Over the SDK Player

Use present to display the host app PDP page over the SDK player:

Push the Host App Page Inside the SDK Player

UIViewController.topNavigationController() resolves to different navigation controllers depending on the current context:

  • Inside the fullscreen player: returns the player's own navigation controller, so the page is pushed within the player context.

  • Inside a story block: falls back to the host app's navigation controller.

Because the fullscreen player hides the navigation bar, the pushed view controller must explicitly show and configure it in viewWillAppear. Using viewWillAppear (rather than viewDidLoad) is important — when the user navigates back, UIKit calls viewWillAppear on the player, allowing it to hide the bar again and restore its original state.

Use the Host App Navigation Controller to Push the Host App Page

When the fullscreen player is visible, the host app's navigation controller sits beneath it, so any page pushed directly would be obscured by the player.

FireworkVideoSDK.startPiPOrDismissFullScreenPlayer handles this by transitioning the player to a floating window (if PiP is enabled) or dismissing it (if PiP is disabled), ensuring the new page is fully visible. To always dismiss the player regardless of PiP, use FireworkVideoSDK.dismissFullScreenPlayer instead.

The above code snippets are based on fireworkShopping(_:didTapProductVariant:forVideo:). But they are also applicable to other behavior delegate methods.

Last updated

Was this helpful?