VideoFeedPlayerController

com.bitmovin.player.api.videofeed

VideoFeedPlayerController

@ExperimentalBitmovinApi

class VideoFeedPlayerController

Controls a pool of players for video feed playback.

Typical UI integration:

  1. Create one controller for the feed, usually in a ViewModel, on the main thread.
  2. Observe items. When a VideoFeedItemState.player is non-null, attach it to your player view.
  3. Call prepare for the initial item, or call select for the first visible item and let it prepare.
  4. Call select whenever the visible/current item changes. Do not create or destroy players per row.
  5. Forward host lifecycle events to onStart, onResume, onPause, and onStop.
  6. Call release when the feed owner is disposed.

For Compose, keep scroll state in the UI, map the visible index to the matching VideoFeedItem, and pass that item to select.

This controller must be created and accessed on the application's main thread.

Constructors

VideoFeedPlayerControllerconstructor(context: Context, items: List<VideoFeedItem>, config: VideoFeedPlayerConfig)

Properties

NameSummary
itemsval items: StateFlow<List<VideoFeedItemState>>

Functions

NameSummary
appendItemsfun appendItems(items: List<VideoFeedItem>)
Appends items to the feed. Item IDs must be unique across existing and appended items.
itemAtfun itemAt(index: Int): VideoFeedItem
Returns the feed item at index.
onPausefun onPause()
Forwards the host Activity or Fragment onPause event to all pooled players.
onResumefun onResume()
Forwards the host Activity or Fragment onResume event to all pooled players.
onStartfun onStart()
Forwards the host Activity or Fragment onStart event to all pooled players.
onStopfun onStop()
Forwards the host Activity or Fragment onStop event to all pooled players.
pausefun pause()
Pauses playback of the current item.
playfun play()
Starts playback of the current item.
preloadfun preload(item: VideoFeedItem)
Optionally loads item before the feed is shown.
fun preload(index: Int)
Optionally loads the item at index before the feed is shown.
preparefun prepare(item: VideoFeedItem)
Selects the initial current item, starts its player, and preloads neighboring items.
fun prepare(index: Int)
Selects the initial current item at index, starts its player, and preloads neighboring items.
releasefun release()
Releases all pooled players. This function is idempotent; other functions must not be called afterward.
retryfun retry()
Reloads the failed current item and starts playback.
selectfun select(item: VideoFeedItem)
Makes item current.
fun select(index: Int)
Makes the item at index current.