<?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>25298</bug_id>
          
          <creation_ts>2014-04-09 17:02:56 +0000</creation_ts>
          <short_desc>How to represent VideoFacingMode if browser is not able to detect the FacingMode of the camera.</short_desc>
          <delta_ts>2014-10-02 13:31:14 +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>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>25794</blocked>
    
    <blocked>25810</blocked>
    
    <blocked>26111</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Kiran">kiran.guduru</reporter>
          <assigned_to name="Cullen Jennings">fluffy</assigned_to>
          <cc>adam.bergkvist</cc>
    
    <cc>harald</cc>
    
    <cc>jib</cc>
    
    <cc>martin.thomson</cc>
    
    <cc>paul.neave</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>103601</commentid>
    <comment_count>0</comment_count>
    <who name="Kiran">kiran.guduru</who>
    <bug_when>2014-04-09 17:02:56 +0000</bug_when>
    <thetext>In certain scenarios, for example if an external webcam is connected through USB cable or bluetooth, it may not be possible for the browser to identify the exact facing direction of the camera.

In such scenarios,(if browser is not able to identify the facing direction of the camera), there is no attribute in the VideoFacindMode enum to represent/initialize.

I prefer to add new &quot;unknown&quot; attribute to videoFacingMode enum, so that if browser is not able to detect the videoFacingMode, then it must be set to &quot;unknown&quot;.

The new enum might be like this

enum VideoFacingModeEnum {
    &quot;user&quot;,
    &quot;environment&quot;,
    &quot;left&quot;,
    &quot;right&quot;,
    &quot;unknown&quot;
};</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103605</commentid>
    <comment_count>1</comment_count>
    <who name="Martin Thomson">martin.thomson</who>
    <bug_when>2014-04-09 17:29:44 +0000</bug_when>
    <thetext>Sounds reasonable.  Presumably, this would not be a useful input to gUM as a constraint.  Do you believe that this needs to be addressed somehow?  Could we reasonably forbid its use as a constraint?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103606</commentid>
    <comment_count>2</comment_count>
    <who name="Paul Neave">paul.neave</who>
    <bug_when>2014-04-09 17:32:13 +0000</bug_when>
    <thetext>Agree, but perhaps rather than &quot;unknown&quot; this case should simply be JS&apos;s undefined property?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103609</commentid>
    <comment_count>3</comment_count>
    <who name="Kiran">kiran.guduru</who>
    <bug_when>2014-04-09 17:48:49 +0000</bug_when>
    <thetext>I suggested this by considering the following scenario.

If MediaStreamTrack.states() is invoked from the JS, it will return &quot;MediaSourceStates&quot;, which internally contains &quot;VideoFacingMode&quot;.
This attribute should be filled inside the browser. 

If browser don&apos;t know the exact direction facing of the camera, then spec is not providing any option to fill in. Then browser has to fill in either assumed or wrong default value or fill it with a NULL-String (&quot;&quot;).

AFAIK Instead of returning NULL-String to JS, it is good to fill some predefined value like &quot;unknown&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103611</commentid>
    <comment_count>4</comment_count>
    <who name="Martin Thomson">martin.thomson</who>
    <bug_when>2014-04-09 17:58:47 +0000</bug_when>
    <thetext>I actually like Paul&apos;s suggestion.  If you don&apos;t know the value, don&apos;t provide one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103613</commentid>
    <comment_count>5</comment_count>
    <who name="Kiran">kiran.guduru</who>
    <bug_when>2014-04-09 18:07:51 +0000</bug_when>
    <thetext>I feel, if the value is not known, then browser should convey the same to JS. Other wise spec should explicitly specify that browser should return a NULL string in case of unknown facing mode.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103614</commentid>
    <comment_count>6</comment_count>
    <who name="Jan-Ivar Bruaroey [:jib]">jib</who>
    <bug_when>2014-04-09 18:13:14 +0000</bug_when>
    <thetext>(In reply to Kiran from comment #5)
&gt; I feel, if the value is not known, then browser should convey the same to
&gt; JS. Other wise spec should explicitly specify that browser should return a
&gt; NULL string in case of unknown facing mode.

All members in dictionaries are optional - and constraints/settings/capabilities work like dictionaries in most respects - so I believe the browser can omit the facingMode member entirely rather than fill it with an empty string (which would be an illegal enum member currently).

Similarly, I would expect getCapabilities() to only contain facingMode when it is known.

However we achieve it, I agree this needs clarification.

I would also like clarification on whether the following excludes a &quot;camera of unknown direction&quot;:

{video:{mandatory:{facingMode:[&apos;user&apos;,&apos;environment&apos;,&apos;left&apos;,&apos;right&apos;]}}}

I assume yes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103615</commentid>
    <comment_count>7</comment_count>
    <who name="Martin Thomson">martin.thomson</who>
    <bug_when>2014-04-09 18:17:34 +0000</bug_when>
    <thetext>(In reply to Jan-Ivar Bruaroey [:jib] from comment #6)
&gt; However we achieve it, I agree this needs clarification.

Sure.
 
&gt; I would also like clarification on whether the following excludes a &quot;camera
&gt; of unknown direction&quot;:
&gt; 
&gt; {video:{mandatory:{facingMode:[&apos;user&apos;,&apos;environment&apos;,&apos;left&apos;,&apos;right&apos;]}}}
&gt; 
&gt; I assume yes.

Likewise.  Perhaps the reason that the camera is not given a facing mode from the selected set is that it *is* known, but not one of the four provided options.  Unset wouldn&apos;t be strictly &quot;I don&apos;t know&quot; it would also encompass &quot;none of the above&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103616</commentid>
    <comment_count>8</comment_count>
    <who name="Gili">cowwoc</who>
    <bug_when>2014-04-09 18:20:42 +0000</bug_when>
    <thetext>+1 for omitting unknown properties because there is no way to guarantee that the browser can even see all properties to begin with. Meaning, some properties are unknown because we can see them but don&apos;t understand their meaning. Other properties are not visible because a browser may query &quot;basic&quot; properties but omit querying for more &quot;advanced&quot; properties. Under OSX, for example, the functionalities exposed by QtKit and AVFoundation driver APIs are not identical so depending on which interface you use to query a device you will see different capabilities.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103617</commentid>
    <comment_count>9</comment_count>
    <who name="Jan-Ivar Bruaroey [:jib]">jib</who>
    <bug_when>2014-04-09 18:21:34 +0000</bug_when>
    <thetext>Just to take both positions here, one argument FOR &quot;unknown&quot; would be to future-proof so we can add new enum values in the future. This would rely on Bug 19936 being addressed, which would let us write:

enum VideoFacingModeEnum {
    &quot;user&quot;,
    &quot;environment&quot;,
    &quot;left&quot;,
    &quot;right&quot;,
    &quot;unknown&quot; = default
};</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103618</commentid>
    <comment_count>10</comment_count>
    <who name="Kiran">kiran.guduru</who>
    <bug_when>2014-04-09 18:24:28 +0000</bug_when>
    <thetext>(In reply to Jan-Ivar Bruaroey [:jib] from comment #9)
&gt; Just to take both positions here, one argument FOR &quot;unknown&quot; would be to
&gt; future-proof so we can add new enum values in the future. This would rely on
&gt; Bug 19936 being addressed, which would let us write:
&gt; 
&gt; enum VideoFacingModeEnum {
&gt;     &quot;user&quot;,
&gt;     &quot;environment&quot;,
&gt;     &quot;left&quot;,
&gt;     &quot;right&quot;,
&gt;     &quot;unknown&quot; = default
&gt; };

This is what I expected it to be.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103937</commentid>
    <comment_count>11</comment_count>
    <who name="Adam Bergkvist">adam.bergkvist</who>
    <bug_when>2014-04-16 06:59:19 +0000</bug_when>
    <thetext>R</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103938</commentid>
    <comment_count>12</comment_count>
    <who name="Adam Bergkvist">adam.bergkvist</who>
    <bug_when>2014-04-16 07:10:09 +0000</bug_when>
    <thetext>(Above: New personal record for shortest message before accidentally hitting the submit button :) )

Do we have to rely on the resolution of bug Bug 19936 to future-proof the enum? I noted that, for ECMAScript, assignments to enum attributes are ignored if the new value isn&apos;t a valid enum value, but an invalid enum value as a function argument generates an error. I would expect an assignment to a dictionary member to be similar to the attribute assignment case. Not sure though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103966</commentid>
    <comment_count>13</comment_count>
    <who name="Jan-Ivar Bruaroey [:jib]">jib</who>
    <bug_when>2014-04-16 15:20:47 +0000</bug_when>
    <thetext>(In reply to Adam Bergkvist from comment #12)
&gt; Do we have to rely on the resolution of bug Bug 19936 to future-proof the
&gt; enum?

I don&apos;t think so, I marked it as a dependency more to revive the other bug.

&gt; I noted that, for ECMAScript, assignments to enum attributes are
&gt; ignored if the new value isn&apos;t a valid enum value, but an invalid enum value
&gt; as a function argument generates an error.

Yes, from http://www.w3.org/TR/WebIDL/#idl-enums

&gt; I would expect an assignment to a dictionary member to be similar to the
&gt; attribute assignment case. Not sure though.

Unfortunately, dictionaries are always function arguments (they can&apos;t be attributes), so invalid facingModes throw, hence Bug 19936.

I suggest two actions here:

1. Add &quot;unknown&quot; as Kiran suggests in comment 0.

2. Use DOMString for facingMode and refer to VideoFacingModeEnum in a
   comment as a workaround for now, as I suggest in Bug 19936 comment 5.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103967</commentid>
    <comment_count>14</comment_count>
    <who name="Jan-Ivar Bruaroey [:jib]">jib</who>
    <bug_when>2014-04-16 15:38:06 +0000</bug_when>
    <thetext>(In reply to Paul Neave from comment #2)
&gt; Agree, but perhaps rather than &quot;unknown&quot; this case should simply be JS&apos;s
&gt; undefined property?

&quot;unknown&quot; = not left, right, user or environment, but something else.
&quot;undefined&quot; = unconstrained.

These are different. I think it would be quite fun actually to constrain on &quot;unknown&quot;. Give me all your new and wonderfully odd cameras!

Also, since we don&apos;t have negative constraints, this lets us express things like &quot;not environment&quot; using exclusion [&apos;user&apos;, &apos;left&apos;, &apos;right&apos;, &apos;unknown&apos;].

Perhaps a better name would be &quot;other&quot;?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104013</commentid>
    <comment_count>15</comment_count>
    <who name="Adam Bergkvist">adam.bergkvist</who>
    <bug_when>2014-04-17 05:51:37 +0000</bug_when>
    <thetext>(In reply to Jan-Ivar Bruaroey [:jib] from comment #13)
&gt; (In reply to Adam Bergkvist from comment #12)
&gt; Unfortunately, dictionaries are always function arguments (they can&apos;t be
&gt; attributes), so invalid facingModes throw, hence Bug 19936.

I was referring to the value assignment of a dictionary member (not the entire dictionary).

foo.attr = &quot;not-in-the-enum&quot;; // ignored (from WebIDL spec example)

enumArgFunc(&quot;not-in-the-enum&quot;); // error  (from WebIDL spec example)

var dict = {
  member = &quot;not-in-the-enum&quot; // this is the case: ignored or error?
};</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104032</commentid>
    <comment_count>16</comment_count>
    <who name="Jan-Ivar Bruaroey [:jib]">jib</who>
    <bug_when>2014-04-17 12:31:08 +0000</bug_when>
    <thetext>(In reply to Adam Bergkvist from comment #15)
&gt; I was referring to the value assignment of a dictionary member (not the
&gt; entire dictionary).
&gt; 
&gt; foo.attr = &quot;not-in-the-enum&quot;; // ignored (from WebIDL spec example)

As I understand it, WebIDL dictionaries returned to JS are not browser objects but POS (plain old JavaScript objects), so foo here is a POS and I wouldn&apos;t derive much from that.

&gt; var dict = {
&gt;   member = &quot;not-in-the-enum&quot; // this is the case: ignored or error?
&gt; };

I think you mean: var dict = { member: &quot;not-in-the-enum&quot; ); and dict is also a POS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104143</commentid>
    <comment_count>17</comment_count>
    <who name="Adam Bergkvist">adam.bergkvist</who>
    <bug_when>2014-04-22 05:09:50 +0000</bug_when>
    <thetext>(In reply to Jan-Ivar Bruaroey [:jib] from comment #16)
&gt; (In reply to Adam Bergkvist from comment #15)
&gt; &gt; var dict = {
&gt; &gt;   member = &quot;not-in-the-enum&quot; // this is the case: ignored or error?
&gt; &gt; };
&gt; 
&gt; I think you mean: var dict = { member: &quot;not-in-the-enum&quot; ); and dict is also
&gt; a POS.

You&apos;re right (about the syntax too)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104316</commentid>
    <comment_count>18</comment_count>
    <who name="Kiran">kiran.guduru</who>
    <bug_when>2014-04-24 05:58:26 +0000</bug_when>
    <thetext>(In reply to Jan-Ivar Bruaroey [:jib] from comment #14)
&gt; (In reply to Paul Neave from comment #2)
&gt; &gt; Agree, but perhaps rather than &quot;unknown&quot; this case should simply be JS&apos;s
&gt; &gt; undefined property?
&gt; 
&gt; &quot;unknown&quot; = not left, right, user or environment, but something else.
&gt; &quot;undefined&quot; = unconstrained.
&gt; 
&gt; These are different. I think it would be quite fun actually to constrain on
&gt; &quot;unknown&quot;. Give me all your new and wonderfully odd cameras!
&gt; 
&gt; Also, since we don&apos;t have negative constraints, this lets us express things
&gt; like &quot;not environment&quot; using exclusion [&apos;user&apos;, &apos;left&apos;, &apos;right&apos;, &apos;unknown&apos;].
&gt; 
&gt; Perhaps a better name would be &quot;other&quot;?

I don&apos;t have any problem with name, whether it is &quot;unknown&quot; or &quot;other&quot;. I concentrated much on the feature.

The intention of proposing &quot;unknown&quot; is to cover the case where

1. Direction of facing is UNKNOWN in cases where we connect an external camera using USB / bluetooth (ofcourse user can change the direction in the middle of the session).
2. Rotating cameras apart from fixed top, down cameras.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106786</commentid>
    <comment_count>19</comment_count>
    <who name="Harald Alvestrand">harald</who>
    <bug_when>2014-05-26 10:04:42 +0000</bug_when>
    <thetext>Discussed at the May 19 Media Capture TF meeting.

Conclusions:
- &quot;Other/Unknown&quot; will be represented as a missing value - that is, JS &quot;undefined&quot;
- Due to the issues with Enum in a dictionary, DOMString will be used
- Jan-Ivar took on the task of creating a text proposal</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108320</commentid>
    <comment_count>20</comment_count>
    <who name="Jan-Ivar Bruaroey [:jib]">jib</who>
    <bug_when>2014-06-25 14:52:39 +0000</bug_when>
    <thetext>Pull request: https://github.com/fluffy/webrtc-w3c/pull/34</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108620</commentid>
    <comment_count>21</comment_count>
    <who name="Jan-Ivar Bruaroey [:jib]">jib</who>
    <bug_when>2014-07-01 16:07:10 +0000</bug_when>
    <thetext>Note that pull request in comment 20 adds an &quot;other&quot; enum entry for UAs to coerce unknown strings into. This is useful for implementations, as it lets them translate incoming strings into an enum internally, as a point of parsing. As a consequence, JS users may see this value in constraints returned to them from APIs that return constraints, in place of the original string, which is not kept.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108623</commentid>
    <comment_count>22</comment_count>
    <who name="Harald Alvestrand">harald</who>
    <bug_when>2014-07-01 18:36:14 +0000</bug_when>
    <thetext>*** Bug 25793 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111782</commentid>
    <comment_count>23</comment_count>
    <who name="Stefan Hakansson LK">stefan.lk.hakansson</who>
    <bug_when>2014-09-19 07:22:19 +0000</bug_when>
    <thetext>Re-assigned. To be reviewed now that PRs #14 and #16 have been merged.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112582</commentid>
    <comment_count>24</comment_count>
    <who name="Cullen Jennings">fluffy</who>
    <bug_when>2014-10-02 13:31:14 +0000</bug_when>
    <thetext>I think this was resolved with using JS undefined</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>