import VideoRendition from '../models/VideoRendition'; /** * Returns the list of available **video renditions** (quality levels) for the currently active video track. * * This hook provides a reactive way to observe updates to the player’s video track model and its available * renditions. A **rendition** represents a specific combination of resolution, bitrate, and codec for a given track. * * ⚠️ Must be used within a {@link PlayerProvider} or * [AVPlayerViewControllerProvider](../../ios-avplayerviewcontroller-plugin-api/variables/AVPlayerViewControllerProvider.md) component. * * @returns `{VideoRendition[]}` An array of available {@link VideoRendition} for the active video track. * * ### Behavior * - Updates automatically when the active video track changes (via the `TrackModelChanged` event). * - Initial value reflects the renditions of the current active video track. * * @example * ```tsx * import React, { useEffect, useState } from 'react'; * import { View, Text, Button } from 'react-native'; * import { * usePlayer, * useVideoRenditions, * useAdaptiveVideoEnabled, * } from '@castlabs/react-native-prestoplay'; * * const AUTO_ID = 'auto'; * * export default function PlaybackQualitySelector() { * const player = usePlayer(); * const renditions = useVideoRenditions(); * const adaptive = useAdaptiveVideoEnabled(); * const [selected, setSelected] = useState(AUTO_ID); * * useEffect(() => { * if (adaptive) return setSelected(AUTO_ID); * const active = renditions.find(r => r.active); * if (active) setSelected(active.id); * }, [adaptive, renditions]); * * const select = (id: string) => { * setSelected(id); * const manager = player.getTrackManager(); * if (id === AUTO_ID) manager.enableAdaptiveVideo(); * else { * const rendition = renditions.find(r => r.id === id); * if (rendition) manager.setVideoRendition(rendition); * } * }; * * return ( * * Playback Quality *