[Bug 24015] Add callback to indicate when available media devices change

https://www.w3.org/Bugs/Public/show_bug.cgi?id=24015

Adam Bergkvist <adam.bergkvist@ericsson.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adam.bergkvist@ericsson.com

--- Comment #5 from Adam Bergkvist <adam.bergkvist@ericsson.com> ---
Here's a proposal.

Regarding the name, I don't think the -handler or -manager suffixes add much.
The sibling object for geolocation is simply called "geolocation" so I suggest
MediaDevices, UserMedia or something.

partial interface NavigatorUserMedia {
    // kept for legacy purposes
    void getUserMedia (MediaStreamConstraints? constraints,
        NavigatorUserMediaSuccessCallback successCallback,
        NavigatorUserMediaErrorCallback errorCallback);

    readonly attribute UserMedia userMedia;
};

Navigator implements NavigatorUserMedia;

interface UserMedia : EventTarget {
    // this belongs there
    void getUserMedia (MediaStreamConstraints? constraints,
        NavigatorUserMediaSuccessCallback successCallback,
        NavigatorUserMediaErrorCallback errorCallback);

             attribute EventHandler? ondevicechange;
    void enumerateDevices (MediaDeviceInfoCallback resultCallback);

    // place future function for constraint name probing here
};

MediaDeviceInfoCallback is already in the spec.

The function enumerateDevices() replaces the current async getMediaDevices()
function. The new function could be synchronous (as in Martins proposal) if we
do the work of preparing the return value in advance every time the device list
changes. I don't have a strong opinion about it.

We don't need a new event type since the event only notifies that there's new
info available elsewhere (accessed by querying an other function). If the app
wants to know about changes, it has to keep a reference to an old list and
compare.

Once we have settled for a first version name, I think we can start editing
this into the spec.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.

Received on Monday, 26 May 2014 12:04:08 UTC