<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>24015</bug_id>
          
          <creation_ts>2013-12-06 01:31:48 +0000</creation_ts>
          <short_desc>Add callback to indicate when available media devices change</short_desc>
          <delta_ts>2014-06-10 14:37:09 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebRTC Working Group</product>
          <component>Media Capture and Streams</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Justin Uberti">juberti</reporter>
          <assigned_to name="public-media-capture@w3.org">public-media-capture</assigned_to>
          <cc>adam.bergkvist</cc>
    
    <cc>harald</cc>
    
    <cc>praveen.j</cc>
    
    <cc>public-media-capture</cc>
    
    <cc>stefan.lk.hakansson</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>97227</commentid>
    <comment_count>0</comment_count>
    <who name="Justin Uberti">juberti</who>
    <bug_when>2013-12-06 01:31:48 +0000</bug_when>
    <thetext>Forked from https://www.w3.org/Bugs/Public/show_bug.cgi?id=23263. The idea here is to have a callback that apps can register for to learn when a new device becomes available (or is removed). The main use case here is for a Bluetooth headset - if one shows up, the app may want to display a button indicating the call can be transferred to the headset, and remove that button if the headset disappears.

Currently this would require the app poll the getMediaDevices API on a regular basis, which is inefficient at best.

I suggest the name navigator.onmediadeviceschange for this API.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97741</commentid>
    <comment_count>1</comment_count>
    <who name="Stefan Hakansson LK">stefan.lk.hakansson</who>
    <bug_when>2013-12-17 13:08:33 +0000</bug_when>
    <thetext>When this was last discussed, it was deemed that it was sufficient to poll for new devices.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97756</commentid>
    <comment_count>2</comment_count>
    <who name="Justin Uberti">juberti</who>
    <bug_when>2013-12-17 20:07:09 +0000</bug_when>
    <thetext>Agreed, but after actually working with the API I think that polling is clumsy; to get the behavior described below, you would have to poll the API about every second for the entire lifetime of the call.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105675</commentid>
    <comment_count>3</comment_count>
    <who name="Praveen R Jadhav">praveen.j</who>
    <bug_when>2014-05-12 05:42:26 +0000</bug_when>
    <thetext>Implementations like navigator.geolocation.watchPosition makes sense when there is a continuous update as in case of location co-ordinates(ex: travelling in a car). Also, these attributes have wide range of values.

In case of WebRTC calls, you have limited no. of media input/output devices and they are either plugged or unplugged. Polling mechanism in this scenario will be a burden on overall system. Callback mechanism should be fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106788</commentid>
    <comment_count>4</comment_count>
    <who name="Harald Alvestrand">harald</who>
    <bug_when>2014-05-26 10:08:03 +0000</bug_when>
    <thetext>Discussed at the Media Capture TF on May 19. Consensus that this is needed.

Suggestion (made later in the meeting):

Create a Navigator.mediaDeviceHandler object that can hold the ondevicechange handler event, as well as a possible getUnderstoodConstraintNames function that was suggested in another context.

A concrete proposal is expected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106793</commentid>
    <comment_count>5</comment_count>
    <who name="Adam Bergkvist">adam.bergkvist</who>
    <bug_when>2014-05-26 12:04:07 +0000</bug_when>
    <thetext>Here&apos;s a proposal.

Regarding the name, I don&apos;t think the -handler or -manager suffixes add much. The sibling object for geolocation is simply called &quot;geolocation&quot; 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&apos;t have a strong opinion about it.

We don&apos;t need a new event type since the event only notifies that there&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106913</commentid>
    <comment_count>6</comment_count>
    <who name="Adam Bergkvist">adam.bergkvist</who>
    <bug_when>2014-05-28 12:37:20 +0000</bug_when>
    <thetext>Proposed fix: https://github.com/fluffy/webrtc-w3c/commit/de3bdaf83d2cc1350cc3be970baf1d11219add1d</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>