Function: capRootTabs()
function capRootTabs(items: readonly BrowseItem[], limit?: number): RootTabs;
Defined in: packages/media-session/src/browse.ts:262
Enforce the two rules every car's root has, in one place for both platforms.
- Browsable only. Android Auto's root supports
FLAG_BROWSABLEand nothing else — a playable root entry is not "a shortcut that plays", it is an entry the car may drop or hide. CarPlay's root is a tab bar of templates, which a playable leaf cannot be either. - At most MAX_ROOT_TABS.
Dropping is right and rejecting the whole root is not: a fifth tab must not
cost the user the four that fit. But it is never silent — every caller feeds
rejected to the session-error channel as browseRootRejected
(ARCHITECTURE §27).
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
items | readonly BrowseItem[] | undefined | - |
limit | number | MAX_ROOT_TABS | the effective cap; defaults to MAX_ROOT_TABS. Android passes the browser's own EXTRAS_KEY_ROOT_CHILDREN_LIMIT when it is smaller. |
Returns
RootTabs