/** * Returns the **live start time** in milliseconds since the Unix epoch. * * This hook provides a reactive way to observe and respond to changes in the live stream’s * **start time**, as reported by the manifest. This is typically used to calculate * absolute playback positions or to display timestamps in live and DVR playback UIs. * * A live HLS stream must include the `EXT-X-PROGRAM-DATE-TIME` tag for this value * to be available. * * ### Platform behavior * - **HLS:** Supported on both Android and iOS. * - **DASH:** Not available on iOS (value will always be `null`). * * ⚠️ Must be used within a {@link PlayerProvider} or * [AVPlayerViewControllerProvider](../../ios-avplayerviewcontroller-plugin-api/variables/AVPlayerViewControllerProvider.md) component. * * @returns `{number | null}` The live start time in **milliseconds since the epoch**, or `null` * if unavailable or not applicable (e.g., VOD playback). * * @example * ```tsx * import React from 'react'; * import { View, Text } from 'react-native'; * import { * useLive, * useLiveStartTime, * usePosition, * } from '@castlabs/react-native-prestoplay'; * * export default function LiveTimeDisplay() { * const isLive = useLive(); * const liveStartTime = useLiveStartTime(); * const position = usePosition(); * * if (!isLive || !liveStartTime) { * return Not a live stream; * } * * const wallClockTime = new Date(liveStartTime + position).toLocaleTimeString(); * * return ( * * Live start: {new Date(liveStartTime).toLocaleTimeString()} * Current time: {wallClockTime} * * ); * } * ``` * * @group Hooks */ export default function useLiveStartTime(): number | null;