Configure Video Feed View
FwVideoFeedView is a custom view that displays video thumbnails in a scrollable feed. Users can tap on any thumbnail to launch the fullscreen video player. The feed supports multiple layout types (horizontal, vertical, grid) and can display content from various sources.
Integration
Add to Layout
Add FwVideoFeedView to your layout XML file:
<com.firework.videofeed.FwVideoFeedView
android:id="@+id/videoFeedView"
android:layout_width="match_parent"
android:layout_height="match_parent" />Initialize
Initialize the feed view by calling init():
class MainActivity : AppCompatActivity() {
private lateinit var videoFeedView: FwVideoFeedView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
videoFeedView = findViewById(R.id.videoFeedView)
// Simple initialization with defaults
videoFeedView.init()
}
override fun onDestroy() {
videoFeedView.destroy()
super.onDestroy()
}
}Initialize with ViewOptions
Provide ViewOptions to customize the feed:
Configuration Options
Feed Source (BaseOption)
Configure the content source for the feed. See Feed Sources for detailed information on each type.
For more feed types (HashtagPlaylist, DynamicContent, ShareUrl), see BaseOption Configuration.
Layout Configuration (LayoutOption)
Control the visual layout and appearance of the video feed.
Feed Layout Types
Spacing and Appearance
Title Position
For complete layout options, see LayoutOption Configuration.
Title Configuration (TitleOption)
Customize the appearance of feed titles.
Gradient Background
For complete title options, see TitleOption Configuration.
Player Configuration (PlayerOption)
Configure the fullscreen video player that opens when users tap on video thumbnails.
For complete player configuration options, see Video Player Configuration.
CTA Configuration (CtaOption)
Configure Call-to-Action button behavior.
Delay Units:
CtaDelayUnit.SECONDS- Delay in seconds (0.0 - 10.0, default: 3)CtaDelayUnit.PERCENTAGE- Percentage of video duration (0.0 - 1.0, default: 0.2)
For CTA handling, see Shopping Integration.
Ad Badge Configuration (AdBadgeOption)
Customize the ad badge appearance on sponsored content.
Chat Configuration (ChatOption)
Configure livestream chat appearance.
Feed Refresh
Manually refresh the feed to reload content:
Example with SwipeRefreshLayout:
Feed State Monitoring
Feed View State Listener
Monitor feed loading states and respond to state changes:
Feed View States:
Loading- Feed is currently loading contentLoadData- Data has been successfully loadedEmptyFeed- Feed has no content to displayEndOfFeed- End of available content reachedError- Error occurred with message
Error Listener
Handle errors during feed operations:
Error Types:
SdkLevelError.SdkNotInitialized- SDK not initializedVideoFeedError.LoadingFailed- Feed loading failedAdsError- Ad-related errors (VideoLoadFailed, PlaybackFailed, ImaAdFailed)LivestreamError- Livestream errors (MissingLivestreamInitializer, EngineFailed)ShareContentError- Share errors (EmptyShareUrl, SharingFailed)NetworkError- Network-related errorsPlayerError- Video playback errors
Feed Item Click Listener
Track when users tap on feed items:
FeedItem Properties:
id- Video content IDtitle- Video titleindexInTheList- Position in feedduration- Video duration in millisecondsvideoInfo- Detailed video information
Lifecycle Management
Destroy in Activity
Call destroy() when the feed view is no longer needed:
Destroy in Fragment
In fragments, call destroy() in onDestroyView():
Complete Configuration Examples
Grid Layout Feed
Horizontal Story Feed
Product Video Gallery
Important Notes
Always call
init()before the feed view can display contentThe SDK must be initialized (via
FireworkSdk.init()) before callinginit()on the feed viewAlways call
destroy()when the feed view is no longer needed to free resourcesViewOptions provided to
init()allow complete customization of the feedFor grid layout,
columnCountdetermines the number of columnsAutoplay on thumbnails can impact battery and data usage
Use
dpToPx()for density-independent pixel valuesUse
spToPx()for text size values
See Also
Feed Sources - Learn about different content sources
ViewOptions Configuration - Complete configuration system
BaseOption - Feed source configuration
LayoutOption - Detailed layout customization
TitleOption - Title styling options
Video Player Configuration - Player configuration and features
Shopping Integration - CTA and shopping features
Widgets Overview - All available widgets
Last updated
Was this helpful?