The CTA button behavior and style can be customized using the CTA Options.
val ctaOptions = CtaOption.Builder()
.ctaDelay(CtaDelay(ctaDelayDuration, ctaDelayUnit.toCtaDelayUnit()))
.ctaHighlightDelay(CtaDelay(ctaHighlightDelayDuration, ctaHighlightDelayUnit.toCtaDelayUnit()))
.ctaMode(CtaMode.FULL_WIDTH)
.build()
Mode includes:
enum class CtaMode {
FULL_WIDTH,
COMPACT,
SIZE_TO_FIT,
}
It is possible to control the appearance of the CTA button using delay and highlight delay values, as well as defining the unit type, which can be either seconds elapsed from the video playback start or a percentage. This allows you to choose when the CTA appears as a grayed button and when it becomes fully visible:
enum class CtaDelayUnit {
SECONDS,
PERCENTAGE,
}
CTA Handling
The CTA functionality can be handled by the SDK if you set sdkHandleCtaButtonClick to true or by the host app if you set it to false while setting the View Options during initialization:
val playerOptions = PlayerOption.Builder()... .sdkHandleCtaButtonClick(true|false)...
If the host app wants to handle the CTA, you can use the analytic callback to get informed that a CTA button is clicked and act on it. You can read more about analytic callbacks here.
Later you can start that activity in the callback:
@FwAnalyticCallable
fun onCtaButtonClicked(event: CtaButtonClickAnalyticsEvent) {
...
if (!isCtaHandledBySDK) {
CtaModalActivity.start(this, event)
}
}
All the necessary logic for the popup modal can be held within the activity. The Player will pause when the activity is opened on top and later continue playback of the content after the activity is finished or the user presses the back button.