<?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>24928</bug_id>
          
          <creation_ts>2014-03-04 22:52:40 +0000</creation_ts>
          <short_desc>the spec defines the addtrack event as part of the MediaStream interface, but never calls out when the event should be fired.</short_desc>
          <delta_ts>2014-04-04 07:31:27 +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>WONTFIX</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Shijun Sun">shijuns</reporter>
          <assigned_to name="public-media-capture@w3.org">public-media-capture</assigned_to>
          <cc>adam.bergkvist</cc>
    
    <cc>public-media-capture</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>101866</commentid>
    <comment_count>0</comment_count>
    <who name="Shijun Sun">shijuns</who>
    <bug_when>2014-03-04 22:52:40 +0000</bug_when>
    <thetext>The Media Capture and Streams spec defines the addtrack event as part of the MediaStream interface, but never calls out when the event should be fired.

Propose to change the following in Section 4.2.3
 
When the addTrack() method is invoked, the user agent MUST run the following steps:
1. Let track be the MediaStreamTrack argument and stream this MediaStream object.
2. If stream is finished, throw an INVALID_STATE_ERR exception.
3. If track is already in stream&apos;s track set, then abort these steps.
4. Add track to stream&apos;s track set.
 
to the following:
 
When the addTrack() method is invoked, the user agent MUST run the following steps:
1. Let track be the MediaStreamTrack argument and stream this MediaStream object.
2. If track is ended, throw an INVALID_STATE_ERR exception.
3. If track is already in stream&apos;s track set, then abort these steps. 
4. Add track to stream&apos;s track set, then queue a task to fire an addtrack event.
 
Note: this will also fix a couple typos in step #2, i.e. from &quot;stream is finished&quot; to &quot;track is ended&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101898</commentid>
    <comment_count>1</comment_count>
    <who name="Adam Bergkvist">adam.bergkvist</who>
    <bug_when>2014-03-05 13:52:29 +0000</bug_when>
    <thetext>Hi and thanks for providing feedback on the spec.

The question whether the &quot;addtrack&quot; event should be fired as a result of MediaStreamTrack.addTrack() has been brought up a few times before.

The event is intended to asynchronously notify the script that the platform has updated the stream&apos;s track set. The new track is added to the track set as the event is dispatched. Direct manipulation with addTrack() doesn&apos;t need the event since the new track is added synchronously; i.e. you can, e.g., read out the new track set length on the next line of code. Having the event could on the other hand complicate things since by the time the event is dispatched, the track could have been removed already.

The question is if the definition of the event should be in this spec or if it should be defined where it&apos;s actually used.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102040</commentid>
    <comment_count>2</comment_count>
    <who name="Shijun Sun">shijuns</who>
    <bug_when>2014-03-07 00:10:22 +0000</bug_when>
    <thetext>It seems okay to remove the addtrack event from the spec as long as the addtrack() call is synchronous.  Same to the removetrack event (as mentioned in bug 24930).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102057</commentid>
    <comment_count>3</comment_count>
    <who name="Adam Bergkvist">adam.bergkvist</who>
    <bug_when>2014-03-07 09:33:45 +0000</bug_when>
    <thetext>But your comment regarding the stream state check is still valid. That needs to be fixed.

I noted that the MediaStrem() constructor, which takes an other MediaStream or a sequence of MediaStreamTracks, ignores ended tracks when constructing the track set of the new stream. Should we do the same here or throw? I think it&apos;s could be motivated to throw for addTrack() since you&apos;re only adding a single track. The ignore-approach for the constructor acts like a filter for ended tracks since several tracks can be added at once.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102066</commentid>
    <comment_count>4</comment_count>
    <who name="Shijun Sun">shijuns</who>
    <bug_when>2014-03-07 17:15:13 +0000</bug_when>
    <thetext>Agree, &quot;throw&quot; is more intuitive for addTrack(), but not so for the MediaStream() constructor.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>