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
Set
FireworkVideoCTADelegatedelegate:
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
}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:):
Customize shopping CTA click behavior
Implement fireworkShopping(_:productVariantCTASelected:fromVideo:ctaCompletionHandler:):
Customize product link button click behavior
Implement fireworkShopping(_:didTapLinkButtonAt:fromVideo:withURL:):
Customize cart icon click behavior
Set
cartActiontocustom:
Implement
fireworkShopping(_:didTapCartIconForVideo:):
Custom livestream link interaction click behavior
Set
FireworkLiveStreamBehaviorDelegatedelegate:
Implement
fireworkLiveStream(_:didTapLinkInteraction:):
Navigate to the host app page
We have three ways to navigate to the host app page when customizing click behaviors.
Present the host app page over the SDK player.
Use the host app navigation controller to push the host app page.
Present the host app page
As the following code snippets, we use "present" to navigate to the host app PDP page. The code snippets are:
Use the host app navigation controller to push the host app page
When the SDK fullscreen player is displayed, the host app's navigation controller is positioned beneath it. When the host app navigates to a new page using its navigation controller while customizing click behaviors, it will be obscured by the Firework full-screen player.
As illustrated in the following code snippets, you can invoke our APIs to convert the Firework full-screen player (if it exists) into a floating player or close it (if it exists) when customizing click behaviors. This approach ensures that the new host app page will not be obscured by the Firework full-screen player.
Last updated
Was this helpful?