For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.
Interface RemotePlayback
onconnect: ((this: RemotePlayback, ev: Event) => any) | null;
onconnecting: ((this: RemotePlayback, ev: Event) => any) | null;
ondisconnect: ((this: RemotePlayback, ev: Event) => any) | null;
state: RemotePlaybackState;
addEventListener<K extends keyof RemotePlaybackEventMap>(
type: K,
listener: (this: RemotePlayback, ev: RemotePlaybackEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
cancelWatchAvailability(id?: number): Promise<void>;
dispatchEvent(event: Event): boolean;
prompt(): Promise<void>;
removeEventListener<K extends keyof RemotePlaybackEventMap>(
type: K,
listener: (this: RemotePlayback, ev: RemotePlaybackEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
watchAvailability(
callback: RemotePlaybackAvailabilityCallback,
): Promise<number>;
}
Hierarchy
- EventTarget
- RemotePlayback
Index
Properties
onconnect
onconnecting
ondisconnect
Readonlystate
The state read-only property of the RemotePlayback interface returns the current state of the RemotePlayback connection.
Methods
addEventListener
-
addEventListener<K extends keyof RemotePlaybackEventMap>(
type: K,
listener: (this: RemotePlayback, ev: RemotePlaybackEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Type Parameters
- K extends keyof RemotePlaybackEventMap
Parameters
- type: K
- listener: (this: RemotePlayback, ev: RemotePlaybackEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
-
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
cancelWatchAvailability
-
The
cancelWatchAvailability()method of the RemotePlayback interface cancels the request to watch for one or all available devices.Parameters
Optionalid: number
Returns Promise<void>
dispatchEvent
-
The
dispatchEvent()method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().Parameters
- event: Event
Returns boolean
prompt
-
The
prompt()method of the RemotePlayback interface prompts the user to select an available remote playback device and give permission for the current media to be played using that device.Returns Promise<void>
removeEventListener
-
removeEventListener<K extends keyof RemotePlaybackEventMap>(
type: K,
listener: (this: RemotePlayback, ev: RemotePlaybackEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.Type Parameters
- K extends keyof RemotePlaybackEventMap
Parameters
- type: K
- listener: (this: RemotePlayback, ev: RemotePlaybackEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
-
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
watchAvailability
-
The
watchAvailability()method of the RemotePlayback interface watches the list of available remote playback devices and returns a Promise that resolves with the callbackId of a remote playback device.Parameters
- callback: RemotePlaybackAvailabilityCallback
Returns Promise<number>
The
RemotePlaybackinterface of the Remote Playback API allows the page to detect availability of remote playback devices, then connect to and control playing on these devices.MDN Reference