Skip to main content

Interface: AssetLibrary

High-level asset library abstraction used by @twick/video-editor and @twick/studio. Implementations may back this with:

  • Local IndexedDB (BrowserMediaManager)
  • Twick Cloud asset services
  • Host application backends (Next.js / Node / serverless)

The interface is intentionally minimal and provider-agnostic so that Studio and the editor do not need to know about individual vendors like Pexels or Unsplash.

Table of contents

Methods

Methods

listAssets

listAssets(params): Promise<AssetPaginated<MediaItem>>

List or search assets from the unified library.

  • For source='user', this should return user-owned assets.
  • For source='public', this should fan out to one or more public providers.

Parameters

NameType
paramsAssetListParams

Returns

Promise<AssetPaginated<MediaItem>>

Defined in

packages/video-editor/src/helpers/asset-library.ts:57


getAsset

getAsset(id): Promise<null | MediaItem>

Fetch a single asset by id, regardless of source.

Parameters

NameType
idstring

Returns

Promise<null | MediaItem>

Defined in

packages/video-editor/src/helpers/asset-library.ts:60


uploadAsset

uploadAsset(file, options?): Promise<MediaItem>

Upload a new user asset. Implementations are free to use browser uploads, presigned URLs, or any other storage strategy; the resulting MediaItem must be fully usable by the editor (url + type).

Parameters

NameTypeDescription
fileFile-
options?Object-
options.type?MediaType-
options.metadata?Record<string, unknown>Optional metadata the caller wants to persist (e.g. user-provided tags or attribution notes).

Returns

Promise<MediaItem>

Defined in

packages/video-editor/src/helpers/asset-library.ts:68


deleteAsset

deleteAsset(id): Promise<void>

Delete a user asset. Public/provider assets are read-only.

Parameters

NameType
idstring

Returns

Promise<void>

Defined in

packages/video-editor/src/helpers/asset-library.ts:81


listPublicProviders

listPublicProviders(): Promise<AssetProviderConfig[]>

Discover which public providers are available in the current environment (and their capabilities).

Returns

Promise<AssetProviderConfig[]>

Defined in

packages/video-editor/src/helpers/asset-library.ts:87