Skip to content

features/browser

configureBrowser()

ts
function configureBrowser(configuration): void;

Configures the browser with routes, tabs, and other settings. Also registers the browser with the player to enable:

  • Media URL transformation for authenticated playback
  • Android Auto / CarPlay browsing integration
  • Playback of browsable tracks via navigate()

Parameters

ParameterTypeDescription
configurationBrowserConfigurationBrowser configuration including routes, tabs, media config, etc.

Returns

void

Example

ts
configureBrowser({
  routes: {
    '/albums/:id': { path: '/api/albums/:id' }
  },
  tabs: [
    { title: 'Home', url: '/' },
    { title: 'Search', url: '/search' }
  ]
})

useContent()

ts
function useContent(): 
  | ResolvedTrack
  | undefined;

Returns

| ResolvedTrack | undefined


getContent()

ts
function getContent(): 
  | ResolvedTrack
  | undefined;

Returns

| ResolvedTrack | undefined


onContentChanged

ts
const onContentChanged: NativeUpdatedValue<
  | ResolvedTrack
| undefined>;

ts
function navigate(pathOrTrack): void;

Parameters

ParameterType
pathOrTrackstring | Track

Returns

void


notifyContentChanged()

ts
function notifyContentChanged(path): void;

Notifies external media controllers (Android Auto, CarPlay) that content at the specified path has changed and should be refreshed.

Parameters

ParameterTypeDescription
pathstringThe path where content has changed (e.g., '/favorites')

Returns

void

Example

ts
// After adding a track to favorites
notifyContentChanged('/favorites')

usePath()

ts
function usePath(): string | undefined;

Returns

string | undefined


getPath()

ts
function getPath(): string | undefined;

Returns

string | undefined


onPathChanged

ts
const onPathChanged: NativeUpdatedValue<string | undefined>;

ts
function search(query): Promise<Track[]>;

Searches for tracks using the configured search source.

Parameters

ParameterTypeDescription
querystringThe search query string

Returns

Promise<Track[]>

Promise resolving to an array of matching tracks

See

configureBrowser

Example

ts
const results = await search('jazz')
console.log(`Found ${results.length} tracks`)

hasSearch()

ts
function hasSearch(): boolean;

Returns whether search functionality is configured via configureBrowser({ search: ... }).

Returns

boolean


useTabs()

ts
function useTabs(): Track[] | undefined;

Returns

Track[] | undefined


getTabs()

ts
function getTabs(): Track[] | undefined;

Returns

Track[] | undefined


onTabsChanged

ts
const onTabsChanged: NativeUpdatedValue<Track[] | undefined>;