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
  • provideStream & 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 mediaTransportsprovideStream & 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/svelteuseMediaURL
Functionā—Since v1.0

useMediaURL

Copy
useMediaURL(media: ValueOrGetter<MediaBase | undefined>): ReactiveValue<string | undefined>
View source on GitHub

Parameters

NameTypeDescription
media*ValueOrGetter<MediaBase | undefined>

Resolve the lazy MediaBase.objectURL promise into a reactive string suitable for <audio src>, <img src>, <video src>, or <a download href>. Reads .current for the latest URL, or undefined until the promise settles.

Lifecycle:

  • On first $effect (or whenever the supplied media value changes), awaits media.objectURL and commits the resolved string to state.
  • On cleanup (or when media changes), calls media.revoke() to free the blob-URL slot. The next consumer that accesses media.objectURL mints a fresh URL from the same Blob, so live re-renders just work.
  • If the underlying handle errored before settling, the URL stays undefined. Surface the failure via media.error.

media accepts a raw handle or a getter so the composable rebinds automatically to the latest media without a manual effect at the call site.