import PlaybackStats from '../models/PlaybackStats'; /** * Returns the latest **playback statistics** from the player. * * This hook provides a reactive way to monitor low-level playback metrics such as * bitrate, dropped frames, buffer length, and other statistics related to playback * performance and quality. * * ### Platform behavior * - **Android:** Updates are emitted **every second**. * - **iOS / tvOS:** Updates are emitted **only when the statistics change**. * * Typical use cases include displaying metrics in a developer overlay, tracking playback * health for monitoring tools, or adapting UI based on quality indicators. * * ⚠️ Must be used within a {@link PlayerProvider} or * [AVPlayerViewControllerProvider](../../ios-avplayerviewcontroller-plugin-api/variables/AVPlayerViewControllerProvider.md) component. * * @returns `{PlaybackStats | null}` The most recent playback statistics, or **null** if unavailable. * * @example * ```tsx * import React from 'react'; * import { View, Text } from 'react-native'; * import { usePlaybackStats } from '@castlabs/react-native-prestoplay'; * * export default function PlaybackStatsDisplay() { * const stats = usePlaybackStats(); * * if (!stats) return No playback stats available.; * * return ( * * Bitrate: {stats.streamBandwidth} bps * Estimated Bandwidth: {stats.estimatedBandwidth} bps * Dropped Frames: {stats.droppedFrames} * * ); * } * ``` * * @group Hooks */ export default function usePlaybackStats(): PlaybackStats | null;