Join us online - 19th of November
Save your spot
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

The RemotePlayback interface 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

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
onconnect: ((this: RemotePlayback, ev: Event) => any) | null
onconnecting: ((this: RemotePlayback, ev: Event) => any) | null
ondisconnect: ((this: RemotePlayback, ev: Event) => any) | null

The state read-only property of the RemotePlayback interface returns the current state of the RemotePlayback connection.

MDN Reference

  • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

    MDN Reference

    Type Parameters

    Parameters

    Returns void

  • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

    MDN Reference

    Parameters

    Returns void

  • The cancelWatchAvailability() method of the RemotePlayback interface cancels the request to watch for one or all available devices.

    MDN Reference

    Parameters

    • Optionalid: number

    Returns Promise<void>

  • 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().

    MDN Reference

    Parameters

    • event: Event

    Returns boolean

  • 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.

    MDN Reference

    Returns Promise<void>

  • The 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.

    MDN Reference

    Type Parameters

    Parameters

    Returns void

  • The 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.

    MDN Reference

    Parameters

    Returns void

Was this helpful?