Skip to main content

Methods

All methods are available on the BBChannelRef obtained via a React ref.

import { useRef } from 'react';
import { BBChannel, BBChannelRef } from '@bluebillywig/react-native-channel';

function App() {
const ref = useRef<BBChannelRef>(null);

const handlePlay = () => {
ref.current?.playVideo('12345', 'mediaclip');
};

return <BBChannel ref={ref} channelUrl="https://demo.bbvms.com/ch/1152.json" />;
}
MethodSignatureDescription
navigateTo(page: BBPageType) => voidNavigate to a page type
goBack() => voidNavigate back in the history stack
canGoBack() => Promise<boolean>Check if back navigation is available

Content

MethodSignatureDescription
playVideo(id: string, type?: string) => voidPlay a video by ID
navigateToEntity(id: string, type: string, options?: NavigateToEntityOptions) => voidNavigate to a specific entity (clip, playlist, etc.)
search(query: string) => voidPerform a search
interface NavigateToEntityOptions {
playout?: string;
blockId?: string;
autoPlay?: boolean;
}

State

MethodSignatureDescription
getNavigationState() => Promise<BBNavigationState>Get the current navigation state
setNavigationState(state: BBNavigationState) => voidSet the navigation state
resetNavigation() => voidReset navigation to the main page

Multi-channel

MethodSignatureDescription
navigateToSubChannel(subChannelId: string) => voidSwitch to a sub-channel by ID

Player control

All player control methods accept an optional playerId parameter. When omitted, the active player is targeted.

MethodSignatureDescription
play(playerId?: string) => voidStart playback
pause(playerId?: string) => voidPause playback
seek(seconds: number, playerId?: string) => voidSeek to a position in seconds
setVolume(volume: number, playerId?: string) => voidSet volume (0 to 1)
setMuted(muted: boolean, playerId?: string) => voidMute or unmute
enterFullscreen(playerId?: string) => voidEnter fullscreen mode
exitFullscreen(playerId?: string) => voidExit fullscreen mode
getPlayerState(playerId?: string) => Promise<BBPlayerState | null>Get current player state
getPlayers() => Promise<BBRegisteredPlayer[]>Get all registered players
setActivePlayer(id: string) => voidSet the active player by ID

Example: player controls

const ref = useRef<BBChannelRef>(null);

// Play/pause toggle
const togglePlayback = async () => {
const state = await ref.current?.getPlayerState();
if (state?.isPlaying) {
ref.current?.pause();
} else {
ref.current?.play();
}
};

// Seek forward 10 seconds
const skipForward = async () => {
const state = await ref.current?.getPlayerState();
if (state?.currentTime != null) {
ref.current?.seek(state.currentTime + 10);
}
};

// Target a specific player
const players = await ref.current?.getPlayers();
if (players && players.length > 1) {
ref.current?.play(players[1].id);
}

Utility

MethodSignatureDescription
reload() => voidReload the channel
setJwt(jwt: string) => voidUpdate the JWT for authenticated content
setRpcToken(token: string) => voidUpdate the RPC token