index ↓
capabilities
client.capabilities What the connected companion app can do. get reads it, onUpdate delivers it as it changes.
requests
you ask, the daemon answers. await the tagged result and check .ok
get(): Promise<TypedRequestResult<CapabilitiesSnapshot, never>>
push form: onSnapshot (subscribe instead of awaiting)
const res = await client.capabilities.get();
if (res.ok) {
console.log(res.response.capabilities);
} type Result =
| { ok: true; response: CapabilitiesSnapshot }
| { ok: false; kind: 'domain'; error: never }
| { ok: false; kind: 'protocol'; error: WireError }; events
the daemon pushes these unprompted. subscribing returns an unsubscribe function
onUpdate(handler: (CapabilitiesSnapshot) => void): () => void
const off = client.capabilities.onUpdate((snapshot) => {
console.log(snapshot.capabilities);
});
// call off() to unsubscribe types
shapes referenced above, as the sdk types them
type CapabilitiesSnapshot = {
capabilities: Capabilities;
}; type Capabilities = {
gateway?: GatewayInfo;
available: SurfaceAvailability;
authority: CompanionAuthorityScope[];
uriSchemes: string[];
network: NetworkInfo;
audio: AudioCapabilities;
musicProvider: MusicProvider;
}; type GatewayInfo = {
address: string;
name: string;
osName: string;
appName: string;
appVersion: string;
adapterVersion: string;
libVersion: string;
libbridgethingVersion: string;
}; type SurfaceAvailability = {
geo: boolean;
notifications: boolean;
netFetch: boolean;
netWs: boolean;
audioTts: boolean;
lyrics: boolean;
playbackTargets: boolean;
forward: boolean;
}; type CompanionAuthorityScope = 'nowPlayingMetadata' | 'nowPlayingPlayback' | 'volume'; type NetworkInfo = {
kind: NetworkKind;
metered: boolean;
}; type AudioCapabilities = {
earcons: string[];
voices: VoiceDescriptor[];
}; type MusicProvider = 'none' | 'spotify' | 'appleMusic'; type NetworkKind = 'unknown' | 'wifi' | 'cellular' | 'ethernet'; type VoiceDescriptor = {
id: string;
name: string;
locale: string;
};