<?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>10421</bug_id>
          
          <creation_ts>2010-08-24 22:54:12 +0000</creation_ts>
          <short_desc>Setting media element&apos;s src and autoplay attribute may expose a race</short_desc>
          <delta_ts>2010-10-04 14:49:22 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>pre-LC1 HTML5 spec (editor: Ian Hickson)</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc>http://dev.w3.org/html5/spec/video.html#attr-media-autoplay</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Adrian Bateman [MSFT]">adrianba</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>37802</commentid>
    <comment_count>0</comment_count>
    <who name="Adrian Bateman [MSFT]">adrianba</who>
    <bug_when>2010-08-24 22:54:12 +0000</bug_when>
    <thetext>In the following code, a video element is constructed and it&apos;s src attribute set. This initiates the resource retrieval. For a fast (e.g. local) resouce, the readystate could be set to HAVE_ENOUGH_DATA before the following line that sets the autoplay attribute. Because the user agent only considers the autoplay value on the readystate change then it would not play in this scenario. Setting the autoplay value first would succeed but web developers don&apos;t expect the order to matter.

var v = document.createElement(video);
v.src = ...;
v.autoplay = true;

Proposal:

Update the spec to say, &quot;The autoplay IDL attribute must reflect the content attribute of the same name.  Upon setting, if the ready state is HAVE_ENOUGH_DATA or greater, the user agent must behave as if the play() method was invoked.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38502</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2010-09-07 09:52:58 +0000</bug_when>
    <thetext>I think you might not have implemented the spec correctly.

[[
If a src attribute of a media element is set or changed, the user agent must invoke the media element&apos;s media element load algorithm.
]]

The media element load algorithm invokes the resource selection algorithm, which changes networkState to NETWORK_NO_SOURCE and then awaits a stable state, which will let the script continue to run before the resource selection algorithm continues (and thus before the resource retrieval is initiated and readyState is changed).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38976</commentid>
    <comment_count>2</comment_count>
    <who name="Adrian Bateman [MSFT]">adrianba</who>
    <bug_when>2010-09-13 18:16:12 +0000</bug_when>
    <thetext>Thanks Simon. We&apos;ve reviewed this and agree.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>