Skip to Content

Init & Config

⚡ 5 min read

The Transcodes SDK Dynamic mode (CDN / npm) The Dynamic SDK requires init({ projectId }) before use


API Modes

ModeEntry PointConfig sourceExtra methods

| Dynamic | CDN or npm | Runtime init() | init(), setConfig(), isInitialized(), getBuildInfo() |


TranscodesInitOptions

interface TranscodesInitOptions { /** Project ID from Transcodes dashboard */ projectId: string; }

Other runtime options (e.g. rpId, branding) are injected at build time for the Dynamic bundle where applicable.


init() (Dynamic SDK only)

transcodes.init(options: TranscodesInitOptions): Promise<void>

Example:

await transcodes.init({ projectId: 'proj_abc123xyz', });

Call init() before openAuthLoginModal, token, member, etc.


setConfig() (Dynamic SDK only)

transcodes.setConfig(options: { memberId?: string }): void

Example:

transcodes.setConfig({ memberId: 'external_member_ref' });

To change projectId, call init() again with new options


isInitialized() (Dynamic SDK only)

transcodes.isInitialized(): boolean

Example:

if (transcodes.isInitialized()) { const member = await transcodes.token.getCurrentMember(); } else { await transcodes.init({ projectId: 'proj_xxx' }); }

getBuildInfo() (Dynamic SDK only)

transcodes.getBuildInfo(): TranscodesBuildInfo
interface TranscodesBuildInfo { buildTimestamp: string; }

Type Definitions

TranscodesDynamicAPI

interface TranscodesDynamicAPI extends TranscodesBaseAPI { init: (options: TranscodesInitOptions) => Promise<void>; setConfig: (options: { memberId?: string }) => void; isInitialized: () => boolean; getBuildInfo: () => TranscodesBuildInfo; }

Last updated on