com.bitmovin.player.api.videofeed
VideoFeedPlayerController
class VideoFeedPlayerController
Controls a pool of players for video feed playback.
Typical UI integration:
- Create one controller for the feed, usually in a ViewModel, on the main thread.
- Observe items. When a VideoFeedItemState.player is non-null, attach it to your player view.
- Call prepare for the initial item, or call select for the first visible item and let it prepare.
- Call select whenever the visible/current item changes. Do not create or destroy players per row.
- Forward host lifecycle events to onStart, onResume, onPause, and onStop.
- 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
| VideoFeedPlayerController | constructor(context: Context, items: List<VideoFeedItem>, config: VideoFeedPlayerConfig) |
Properties
| Name | Summary |
|---|---|
| items | val items: StateFlow<List<VideoFeedItemState>> |
Functions
| Name | Summary |
|---|---|
| appendItems | fun appendItems(items: List<VideoFeedItem>) Appends items to the feed. Item IDs must be unique across existing and appended items. |
| itemAt | fun itemAt(index: Int): VideoFeedItem Returns the feed item at index. |
| onPause | fun onPause() Forwards the host Activity or Fragment onPause event to all pooled players. |
| onResume | fun onResume() Forwards the host Activity or Fragment onResume event to all pooled players. |
| onStart | fun onStart() Forwards the host Activity or Fragment onStart event to all pooled players. |
| onStop | fun onStop() Forwards the host Activity or Fragment onStop event to all pooled players. |
| pause | fun pause() Pauses playback of the current item. |
| play | fun play() Starts playback of the current item. |
| preload | fun 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. |
| prepare | fun 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. |
| release | fun release() Releases all pooled players. This function is idempotent; other functions must not be called afterward. |
| retry | fun retry() Reloads the failed current item and starts playback. |
| select | fun select(item: VideoFeedItem) Makes item current. fun select(index: Int) Makes the item at index current. |