PlayerMode.FIT_MODE: This state causes the player surface cuts into a smaller area of the screen while it maintains the 9:16 aspect ratio. Also, it makes the corner of the player rounded. (default value)
PlayerMode.FULL_BLEED_MODE: This state causes the player surface to fill the mobile screen without rounding the corner of the screen, Also while the source video maintains the 9:16 aspect ratio, the visible player fills the screen of the device, thus causing a minimal part of the video cut off in the edges.
Player Mode needs to be configured along with FwVideoFeedView
Alternatively, this can be set as below in the class where ViewOptions are set for the FwideoFeedView
val playerOption = PlayerOption.Builder() .playerMode(PlayerMode.FIT_MODE) // Set the player mode .build()val viewOptions = ViewOptions.Builder() .playerOption(playerOption) .build()val videoFeedView =findViewById<FwVideoFeedView>(R.id.videoFeedView)videoFeedView.init(viewOptions)
PlayerOption playerOptions =new PlayerOption.Builder().playerMode(PlayerMode.FIT_MODE).build();ViewOptions viewOptions =new ViewOptions.Builder().playerOption(playerOptions).build();// init video feed view with view optionsvideoFeedView.init(viewOptions);
Start the next video automatically
Use fw_autoPlayOnComplete attribute of FwVideoFeedView to control if the next video is automatically played after the previous one has ended. When true the player will play the next video after the current video finishes. Whenfalse, playing video will loop until users explicitly swipe away. Default value is true.
PlayerOption playerOptions =new PlayerOption.Builder().enablePipMode(true).build();ViewOptions viewOptions =new ViewOptions.Builder().playerOption(playerOptions).build();// init video feed view with view optionsvideoFeedView.init(viewOptions);ab
PiP Note
In Android 11, removing the app's task from the task manager doesn't kill the player in PiP mode. Therefore we suggest using the close PiP method to avoid any invalid state after returning from PiP mode while the task is removed.
This can be done on you Acitivity's onDestroy method:
Alternatively, this attribute can be set via ViewOptions class:
val playerOptions = PlayerOption.Builder() .showShareButton(true) .build()val viewOptions = ViewOptions.Builder() .playerOption(playerOptions) .build()// init video feed view with view options videoFeedView.init(viewOptions);
PlayerOption playerOptions =new PlayerOption.Builder().showShareButton(true).build();ViewOptions viewOptions =new ViewOptions.Builder().playerOption(playerOptions).build();// init video feed view with view optionsvideoFeedView.init(viewOptions);
Enable/disable autoplay
Use fw_feedAutoplay attribute of FwVideoFeedView to control if the video feed should use autoplay, this means that the first visible item of the feed will start playing. Default value is false.
PlayerOption playerOptions =new PlayerOption.Builder().autoplay(true).build();ViewOptions viewOptions =new ViewOptions.Builder().playerOption(playerOptions).build();// init video feed view with view optionsvideoFeedView.init(viewOptions);
Custom CTA button visibility delay
CtaDelayUnit.SECONDS: This unit type makes the CTA button become visible at the number of seconds set, this unit type only supports values from 0.0f inclusive to 10.0f inclusive [0.0f, 10.0f], otherwise when trying to play a video it will use 3 seconds default value.
CtaDelayUnit.PERCENTAGE: This unit type makes the CTA button become visible at the percentage set of the video, for example, if the video is 20 seconds and the percentage is set to 0.6f (60%) the CTA button will become visible at 12 seconds, this unit type only supports values from 0.0f inclusive to 1.0f exclusive [0%, 100%), otherwise when trying to play a video it will use 0.2f (20%) default value.
Use fw_ctaButtonDelayUnitType and fw_ctaButtonDelayDuration attribute of VideoFeedView to control the visibility delay of CTA button.
CtaDelayUnit.SECONDS: This unit type makes the CTA button highlight at the number of seconds set after cta visibility delay ended, this unit type only supports values from 0.0f inclusive to 10.0f inclusive [0.0f, 10.0f], otherwise when trying to play a video it will use 2 seconds default value.
CtaDelayUnit.PERCENTAGE: This unit type makes the CTA button highlight at the percentage set of the video, for example, if the video is 20 seconds and the percentage is set to 0.6f (60%) the CTA button will highlight at 12 seconds, this unit type only supports values from 0.0f inclusive to 1.0f exclusive [0%, 100%), otherwise when trying to play a video it will use 0.2f (20%) default value.
This attribute can only be set via ViewOptions class:
To override the CTA button shape properties (rounded corners radius for example) declare a separate style and apply it to shapeAppearanceOverlay style attribute:
<resources> <stylename="FwCtaButtonViewStyle"> <itemname="shapeAppearanceOverlay">@style/MyCustomCtaButtonShapeStyle</item> </style> <stylename="MyCustomCtaButtonShapeStyle"> <itemname="cornerFamily">rounded</item> <!-- possible values "rounded" and "cut" --> <itemname="cornerSizeTopLeft">6dp</item> <itemname="cornerSizeBottomLeft">6dp</item> <itemname="cornerSizeBottomRight">6dp</item> <itemname="cornerSizeTopRight">6dp</item> </style></resources>
Custom Handling of CTA
Refer to CTAClickHandler Section in
Customize player UI buttons
The SDK provides a way to modify some icons in the player. The following icons can be modified, if not set default value will be used:
Player detail button (More Button): The icon on the top left with three dots that show player details like caption or share options.
Mute button: The icon that represents the muted state of the player.
Unmute button: The icon that represents the unmuted state of the player.
Close button: The icon on the top right of the player that closes the player.
Play button (Playback Button): The icon that represents the paused state is shown at the center of the player when the player is paused.
Pause button (Playback Button): The icon that represents the play state and is shown at the center of the player when the player is playing (when WCAG Talkback is on).
These attributes can be set via ViewOptions class:
// You can define a custom icon for any of the following options.val customIcon =WidgetImage( drawableRes = R.drawable.drawable_1, // Your drawable tintColor = Color.WHITE, // Your tint )val customIcon2 =WidgetImage( drawableRes = R.drawable.drawable_2, // Your drawable tintColor = Color.WHITE, // Your tint )val videoDetailsOption = VideoDetailsOption.Builder() .buttonIcon(customIcon) .build()val closeButtonOption = CloseButtonOption.Builder() .icon(customIcon) .build()val pipButtonOption = PipButtonOption.Builder() .icon(customIcon) .build()val muteButtonOption = MuteButtonOption.Builder() .muteIcon(customIcon) .unmuteIcon(customIcon2) .build()val playbackButtonOption = PlaybackButtonOption.Builder() .playIcon(customIcon) .pauseIcon(customIcon2) .build()val playerUiOptions = PlayerUiOption.Builder() .videoDetailsOption(videoDetailsOption) .closeButtonOption(closeButtonOption) .pipButtonOption(pipButtonOption) .muteButtonOption(muteButtonOption) .playbackButtonOption(playbackButtonOption) .build()val playerOption = PlayerOption.Builder() .playerUiOptions(playerUiOptions) .build()val viewOptions = ViewOptions.Builder() .playerOption(playerOption) .build()val videoFeedView =findViewById<FwVideoFeedView>(R.id.videoFeedView)videoFeedView.init(viewOptions)
Player PIP/Floating player
For managing PIP/Floating player you can use the following functions:
#?## Enter PIP/Floating player
If you want to enter pip mode programmatically, you can call the following function:
FireworkSdk.enterPip( { onSuccess ->// true if entering PIP was a success },)
FireworkSdk.INSTANCE.enterPip();
Close PIP/Floating player
If you want to close PIP/Floating player for some reason, you can call the following function:
FireworkSdk.closePip()
FireworkSdk.INSTANCE.closePip();
Enable Livestream countdown
The Livesteam countdown is a feature that allows the host app to display a countdown timer before the livestream over the trailer video. This also allows the users to set a reminder for the livestream on their calendar.
The Player allows you to decide if you want to show the channel logo on the video or not. By default, the channel logo is not visible and we only have the Kebab menu.
val logo = LogoConfig.Logo.AggregatorLogo(logoChannelId)val playerOptions = PlayerOption.Builder() .logoConfig(logo) .build()val viewOptions = ViewOptions.Builder() .playerOption(playerOptions) .build()
Rearrange the order for mute/unmute button and closed captions button
The player lets you rearrange the icon order for those two buttons on the player screen.
viewOptions {playerOptions {// Define the order of mute/unmute and close captions button, default value is false. Ture: close captions button at the right of mute/unmute. False: close captions button at the left of mute/unmute.reverseAudioControls(false) }}
Change the color of the closed captions
We've added two options to let you customize the background and text colors of closed captions.