Configure Video Feed
Video Feed integration
You need to add the FwVideoFeedView
to your layout XML file
Later on your Activity's onCreate
or your Fragment's onViewCreated
find and initialize the FwVideoFeedView
:
After FwVideoFeedView
is not needed anymore it should be destroyed. Call videoFeedView.destroy()
to clean up all resources related to the instance of FwVideoFeedView
.
If FwVideoFeedView
is used inside a fragment, it should be destroyed in fragment's onDestroyView()
lifecycle callback:
If FwVideoFeedView
is used inside an Activity it should be destroyed in activity's onDestroy()
lifecycle callback:
FwLifecycleAwareVideoFeedView (Deprecated, please use FwVideoFeedView instead)
Is a wrapper around the FwVideoFeedView
which accepts lifecycle object in its init(
) function. This allows to clean up all the resources related to underlaying FwVideoFeedView
automatically without calling destroy()
function. This is convenient when activity or fragment does not hold the reference to FwVideoFeedView
(ex. when FwVideoFeedView
is used as an item inside RecyclerView
.
Video Feed options
Feed resource
In this table, you can check the different states of the state machine of the Feed type and its parameters.
✅ Means correct value
❌ Means invalid value or empty value
Feed Resource Type | ChannelId | PlaylistId | Result |
---|---|---|---|
Discovery | ✅ | ✅ | Discovery feed |
Discovery | ✅ | ❌ | Discovery feed |
Discovery | ❌ | ✅ | Discovery feed |
Discovery | ❌ | ❌ | Discovery feed |
Channel | ✅ | ✅ | Channel feed |
Channel | ✅ | ❌ | Channel feed |
Channel | ❌ | ✅ | Server returns an empty feed |
Channel | ❌ | ❌ | Server returns an empty feed |
Playlist | ✅ | ✅ | Playlist feed |
Playlist | ❌ | ✅ | Server returns an empty feed |
Playlist | ✅ | ❌ | Server returns an empty feed |
Playlist | ❌ | ❌ | Server returns an empty feed |
Feed autoplay
This value determines if the first complete visible item of the feed shows as a video instead of a static thumbnail.
Feed Layout
Feed layout is the way that Firework Android SDK shows video feeds to the user.
FeedLayout.HORIZONTAL: Shows video feeds as a horizontal list (default value)
FeedLayout.GRID: Shows video feeds as a grid layout
FeedLayout.VERTICAL: Shows video feeds as a vertical list
Column count
Using this parameter you can set the number of columns in a grid layout FeedLayout.GRID
. (default value is 1)
Background color
This is the background color of the video feed view. (default value is transparent)
Item spacing
This value determines the space between items in the list. (default value is 8dp)
Rounded corner
This value determines whether the video feed view should round the corner of the items in the video feeds or not. (default value is false)
Rounded corner radius
This value specifies the radius of the rounded corner if you set the rounded corner. (default value is 5dp)
Show feed title
This value is being used to show the title of each video item or not. (default value is false)
Feed title text typeface
You can change the font of video titles in feed, this can be the typeface of your choice, by default it uses Typeface.Default
.
Feed title position
This position defines where the video titles are displayed.
FeedTitlePosition.NESTED: Shows the video titles over the bottom part of the video thumbnail.
FeedTitlePosition.STACKED: Shows the video title below the thumbnail.
Feed title text color
The color of the video title. (default value is #80000000)
Feed title text number of lines
Number of lines of the video feed title. (default value is 2)
Feed title text padding
Padding of the feed title. (default value is 8dp)
Feed title text size
Feed title text size. (default value is 14sp)
Feed title background color
This is the background color of the feed title view, this applies to NESTED
and STACKED
feed title positions.
Feed title background drawable
This accepts a GradientDrawable
and it will be shown as the background of feed titles, this applies to NESTED
and STACKED
feed title positions, Note: This background will get priority over Feed title background color
Player Mode
Determines the player mode and can be one of
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 player maintains the 9:16 aspect ratio of the player.
Show play icon
This value determines whether the video feed view shows a play icon in the center of the feed item or not. (default value is false)
Play icon width
This value determines the width of the play icon shown on top of video feed thumbnails.
Ad badge background color
These values specify the color of the background of the ad badge on the top right corner of the ad videos. (default value is Transparent)
Ad badge is hidden
This value determines wheter the ad label is visible or not in player.
Ad badge is show on thumbnails
This value determines wheter the ad label is visible or not in FwVideoFeedView
.
Ad badge text typeface
You can change the font of ad badge, this can be the typeface of your choice, by default it uses Typeface.Default
.
Ad badge text color
These values specify the color of the text of the ad badge on the top right corner of the ad videos. (default value is White)
Ad badge label
The text is being shown on the ad badge view in the top right corner of the ad videos. It has two static options:
Sponsored (default value)
Ad
Show Firework Logo
This value determines if the firework logo is shown in player.
Feed item click listener
To track clicks on the feed item use setOnFeedItemClickListener
function of the FwVideoFeedView
class. Only one listener can be set per FwVideoFeedView
instance.
Share Base Url
Check Video Deep Linking section to learn more about custom share base URL.
Video Deep linkingVideo feed error listener
To receive any errors that may happen in the video feed, use the setOnErrorListener
function of the FwVideoFeedView
class. Only one listener can be set per FwVideoFeedView
instance.
The possible error types are:
Refresh video feed view
Call the videoFeedView.refresh()
function to refresh the content of FwVideoFeedView
.
Last updated