The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { useReleasingSharedObjectWithLifecycle } from "expo"; |
| 2 | import { createAudioPlayer } from "expo-audio"; |
| 3 | import { disposeAudioPlayer } from "../../lib/audioSession"; |
| 4 | |
| 5 | export function usePlaybackAudioPlayer(uri: string | null) { |
| 6 | // Keep the native ref alive until any pending activation and release finish. |
| 7 | return useReleasingSharedObjectWithLifecycle( |
| 8 | { |
| 9 | factory: () => createAudioPlayer(uri, { updateInterval: 500 }), |
| 10 | release: disposeAudioPlayer, |
| 11 | }, |
| 12 | [uri], |
| 13 | ); |
| 14 | } |