LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
  • Stream
  • Overview
  • Getting started
  • useStream
  • Selectors
  • Interrupts & headless tools
  • Subagents & subgraphs
  • Fork & edit from a checkpoint
  • Submission queue
  • Multimodal media
  • Transports
  • Suspense
  • StreamProvider & context
  • Type safety
  • Migrating to v1
LangGraph SDK
  • Ui
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Utils
  • Server
  • Stream
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
  • Store
LangGraph Checkpoint Redis
  • Shallow
  • Store
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
  • Cli
LangGraph API
LangGraph CLI
LangGraph CUA
  • Utils
LangGraph Supervisor
LangGraph Swarm
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangGraph
WebChannelsPregelPrebuiltRemoteStream
OverviewGetting starteduseStreamSelectorsInterrupts & headless toolsSubagents & subgraphsFork & edit from a checkpointSubmission queueMultimodal mediaTransportsSuspenseStreamProvider & contextType safetyMigrating to v1
LangGraph SDK
UiClientAuthReactLoggingReact UiUtilsServerStream
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
Store
LangGraph Checkpoint Redis
ShallowStore
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
Cli
LangGraph API
LangGraph CLI
LangGraph CUA
Utils
LangGraph Supervisor
LangGraph Swarm
Language
Theme
JavaScript@langchain/reactAudioPlayerHandle
Interfaceā—Since v1.0

AudioPlayerHandle

Player controls + live state returned by useAudioPlayer.

Shape is shared with useVideoPlayer where possible — learn one surface, use it for both.

Copy
interface AudioPlayerHandle

Properties

Methods

View source on GitHub
property
currentTime: number
property
duration: number
property
error: Error | undefined
property
level: number
property
status: PlayerStatus
property
strategy: "pcm" | "element"
method
getFrequencyData→ Uint8Array<ArrayBufferLike> | undefined
method
getTimeDomainData→ Uint8Array<ArrayBufferLike> | undefined
method
pause
method
play
method
playToEnd→ Promise<void>
method
reset
method
seek
method
stop
method
toggle

Seconds of audio consumed since the current play() call. Resets on reset() and on media changes.

Total duration in seconds, when knowable. The element strategy exposes this once loadedmetadata fires; the pcm strategy leaves it undefined (PCM duration isn't known until message-finish).

Last error raised by the stream reader, decoder, or element.

RMS level of the last analysed frame, normalised to [0, 1]. Drop-in for a VU meter. 0 when no analyser frame has been read yet, when paused, or before play().

Current lifecycle state. See PlayerStatus.

Which implementation is active. "pcm" scheduling through AudioContext starts within one chunk of the first byte; "element" waits for message-finish before a hidden HTMLAudioElement takes over.

Current 256-bin frequency-domain snapshot from the internal AnalyserNode. Returns undefined before the graph is connected or on environments without Web Audio. Safe to poll inside requestAnimationFrame.

Current 256-sample waveform snapshot (byte time-domain) from the internal AnalyserNode. Returns undefined before the graph is connected or on environments without Web Audio.

Pause without discarding buffered samples / element position.

Start (or resume) playback. No-op while status === "error".

Resolve on the next terminal transition (finished | paused | idle). Reject on transitions to "error". Calling stop() or reset() resolves the pending promise immediately. Calling playToEnd also triggers play() if currently paused/idle.

Reset back to "idle" and drop any transient error. The next play() starts fresh from the current position.

Seek to an absolute timestamp in seconds. Only defined on the element strategy; undefined on pcm (random-access seeking of a live scheduled buffer is not supported).

Hard stop: tears down the AudioContext (PCM) or detaches the element (element) and drops any scheduled work.

Sugar for status === "playing" ? pause() : play().