Skip to main content

API Reference

Complete reference for the BB Channel Compose SDK.

BBChannelView

The main Composable that renders a Blue Billywig channel.

@Composable
fun BBChannelView(
channelUrl: String,
modifier: Modifier = Modifier,
options: BBChannelOptions? = null,
initialNavigationState: BBNavigationState? = null,
viewModel: BBChannelViewModel,
callbacks: BBChannelCallbacks
)
ParameterTypeDescription
channelUrlStringRequired. URL to the channel JSON configuration.
modifierModifierCompose modifier for sizing and layout.
optionsBBChannelOptions?Configuration options.
initialNavigationStateBBNavigationState?Open at a specific page on load.
viewModelBBChannelViewModelView model for programmatic control.
callbacksBBChannelCallbacksEvent callbacks.

BBChannelViewModel

Exposes channel state and control methods.

State Properties

PropertyTypeDescription
canGoBackBoolean (State)Whether back navigation is available.
isReadyBoolean (State)Whether the channel has finished loading.
MethodDescription
navigateTo(page, clipId?, clipListId?, query?)Navigate to a specific page.
goBack()Go back in the navigation stack.
search(query: String)Trigger a search.
playVideo(clipId: String)Navigate to and play a specific clip.
navigateToEntity(entityType, entityId)Navigate to a clip or playlist by ID.
navigateToSubChannel(subChannelId: String)Switch to a sub-channel (multi-channel).
resetNavigation()Return to the main page, clearing the stack.

Authentication Methods

MethodDescription
setJwt(jwt: String)Set or update the JWT for restricted content.
setRpcToken(token: String)Set or update the RPC token (legacy).

Player Control Methods

All player methods accept an optional playerId parameter. Without it, they target the active player.

MethodDescription
play(playerId: String?)Start or resume playback.
pause(playerId: String?)Pause playback.
seek(time: Double, playerId: String?)Seek to position in seconds.
setVolume(level: Double, playerId: String?)Set volume (0.0 -- 1.0).
setMuted(muted: Boolean, playerId: String?)Mute or unmute.
enterFullscreen(playerId: String?)Enter fullscreen mode.
exitFullscreen(playerId: String?)Exit fullscreen mode.

BBChannelOptions

Configuration options for channel behavior and appearance.

@Serializable
data class BBChannelOptions(
val autoPlay: Boolean? = null,
val searchBar: Boolean? = null,
val noStats: Boolean? = null,
val playout: String? = null,
val jwt: String? = null,
val rpcToken: String? = null,
val nativePlayerMode: Boolean? = null,
val bundleUrl: String? = null
)
PropertyTypeDefaultDescription
autoPlayBoolean?trueAuto-play the first video.
searchBarBoolean?channel configShow the search bar.
noStatsBoolean?falseDisable analytics.
playoutString?channel configOverride the playout.
jwtString?nullJWT for restricted content.
rpcTokenString?nullRPC token (legacy).
nativePlayerModeBoolean?falseUse native player via BB Native Player SDK.
bundleUrlString?CDNOverride the JS bundle base URL.

BBChannelCallbacks

Event callbacks. All callbacks are optional.

data class BBChannelCallbacks(
// Lifecycle
val onReady: (() -> Unit)? = null,
val onError: ((BBErrorEvent) -> Unit)? = null,

// Navigation
val onNavigate: ((BBNavigationEvent) -> Unit)? = null,
val onNavigationStateChange: ((BBNavigationState) -> Unit)? = null,
val onCanGoBackChange: ((Boolean) -> Unit)? = null,

// Media
val onMediaPlay: ((BBMediaInfo) -> Unit)? = null,
val onMediaPause: ((BBMediaInfo) -> Unit)? = null,
val onMediaEnd: ((BBMediaInfo) -> Unit)? = null,
val onFirstPlayerMedia: ((BBMediaInfo) -> Unit)? = null,

// Player
val onPlayerStateChange: ((BBPlayerStateEvent) -> Unit)? = null,
val onPlayerEvent: ((BBPlayerEvent) -> Unit)? = null,
val onTimeUpdate: ((BBTimeUpdateEvent) -> Unit)? = null,
val onClipLoaded: ((BBClipLoadedEvent) -> Unit)? = null,
val onAdStart: ((BBAdEvent) -> Unit)? = null,
val onAdEnd: ((BBAdEvent) -> Unit)? = null,

// Multi-player
val onPlayersChange: ((List<BBRegisteredPlayer>) -> Unit)? = null,
val onActivePlayerChange: ((BBRegisteredPlayer) -> Unit)? = null,

// Other
val onSearch: ((BBSearchEvent) -> Unit)? = null,
val onExternalLink: ((String) -> Unit)? = null,
val onAnalyticsEvent: ((BBAnalyticsEvent) -> Unit)? = null
)

Event Types

All event types are @Serializable data classes.

BBMediaInfo

@Serializable
data class BBMediaInfo(
val clipId: String,
val title: String? = null,
val description: String? = null,
val jsonUrl: String? = null,
val thumbnailUrl: String? = null,
val duration: Double? = null,
val isInlinePlayer: Boolean = false,
val playerId: String? = null,
val clipListId: String? = null,
val clipListTitle: String? = null,
val index: Int? = null,
val context: Map<String, Any>? = null
)

BBNavigationState

@Serializable
data class BBNavigationState(
val page: String, // "main", "detail", "overview", "search"
val clipId: String? = null,
val clipListId: String? = null,
val query: String? = null,
val subChannelId: String? = null
)

BBNavigationEvent

@Serializable
data class BBNavigationEvent(
val pageType: String,
val canGoBack: Boolean,
val stackDepth: Int,
val clipId: String? = null,
val clipListId: String? = null,
val query: String? = null
)

BBErrorEvent

@Serializable
data class BBErrorEvent(
val code: String,
val message: String,
val details: Map<String, Any>? = null
)

BBSearchEvent

@Serializable
data class BBSearchEvent(
val query: String,
val resultCount: Int
)

BBPlayerEvent

@Serializable
data class BBPlayerEvent(
val playerId: String,
val eventType: String,
val data: Map<String, Any>? = null
)

BBTimeUpdateEvent

@Serializable
data class BBTimeUpdateEvent(
val playerId: String,
val currentTime: Double,
val duration: Double
)

BBPlayerStateEvent

@Serializable
data class BBPlayerStateEvent(
val playerId: String,
val isPlaying: Boolean,
val currentTime: Double,
val duration: Double,
val volume: Double,
val isMuted: Boolean,
val isFullscreen: Boolean
)

BBClipLoadedEvent

@Serializable
data class BBClipLoadedEvent(
val playerId: String,
val clipId: String,
val title: String? = null,
val duration: Double? = null
)

BBAdEvent

@Serializable
data class BBAdEvent(
val playerId: String,
val adType: String? = null,
val adPosition: String? = null
)

BBRegisteredPlayer

@Serializable
data class BBRegisteredPlayer(
val playerId: String,
val context: String? = null // "player", "detailPage", "overviewPage"
)

BBAnalyticsEvent

@Serializable
data class BBAnalyticsEvent(
val eventType: String,
val data: Map<String, Any>? = null
)