Skip to content
Client
Server

Reference / @open-music-sdk/browser / createBrowserClient

Function: createBrowserClient() ​

ts
function createBrowserClient(options): tBrowserMusic;

Defined in: integrations/browser/src/client.ts:114

A client that fetches its developer token from tokenUrl, reused and replaced in the background halfway through its life, and fetched again when Apple rejects it, with the catalog, the listener's library and the playlist verbs on it. Whatever goes wrong at the endpoint is a DeveloperTokenUnavailable, never taken for Apple's answer. The options are checked and taken here, once: what the fetcher checks it names itself, and so does createClient. Nothing is fetched until a call.

Parameters ​

options ​

tBrowserClientOptions

Where the token endpoint is, the endpoint's own options, and every option of core's client but the developer token.

Returns ​

tBrowserMusic

The client, frozen, with the three namespaces and the provider on it.

Throws ​

TypeError if options is not a plain object, tokenUrl is neither a string nor a URL, endpoint is not a plain object, the URL is neither http nor https or carries a username or password, or a value is not what the fetcher or createClient takes.

MIT licensed. Not affiliated with, endorsed by, or sponsored by Apple Inc. Apple Music and MusicKit are trademarks of Apple Inc.