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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>25267</bug_id>
          
          <creation_ts>2009-04-17 08:22:43 -0700</creation_ts>
          <short_desc>Autobuffer on &lt;audio /&gt; and &lt;video /&gt; cannot be disabled</short_desc>
          <delta_ts>2010-03-21 10:22:36 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</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="David Deller">bugs</reporter>
          <assigned_to name="Eric Carlson">eric.carlson</assigned_to>
          <cc>adrian+applebugzilla</cc>
    
    <cc>ayg</cc>
    
    <cc>beidson</cc>
    
    <cc>bugs</cc>
    
    <cc>bugzilla</cc>
    
    <cc>darin</cc>
    
    <cc>dror</cc>
    
    <cc>emacemac7</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>farukates</cc>
    
    <cc>jeff</cc>
    
    <cc>jeremy</cc>
    
    <cc>Justin</cc>
    
    <cc>jwalden+bwo</cc>
    
    <cc>matthew</cc>
    
    <cc>mjs</cc>
    
    <cc>ml</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>vestbo</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>117913</commentid>
    <comment_count>0</comment_count>
    <who name="David Deller">bugs</who>
    <bug_when>2009-04-17 08:22:43 -0700</bug_when>
    <thetext>Scenario:
I have a podcast, and an archive page that provides for a user to listen to many podcast entries (let&apos;s say a dozen). Each one has an associated audio player using the HTML5 &lt;audio /&gt; tag. It is likely that a user who visits this page will only listen to a small fraction of the available audio files (or none at all).

Result:
Using WebKit, upon first navigating to the page, the complete data for all 12 audio files is downloaded before the user interacts with them at all. Our bandwidth use would go through the roof, and the user may not appreciate it either (maybe they&apos;re on Comcast).

Cause:
HTML5 indicates this element has an &apos;autobuffer&apos; attribute, but only defines behaviour when it is present or &apos;true&apos;. Apparently, it is not possible in HTML5 to indicate that a boolean attribute should be false except by its absence. Neither omitting the attribute nor setting it to &apos;false&apos; has the desired result of preventing automatic downloading.

Indeed, the spec does indicate &apos;[t]his attribute may be ignored altogether&apos;, but as WebKit is the leading implementor of HTML5 so far, I would be comfortable trusting its implementation for now.

Change needed:
Only autobuffer an audio element when the autobuffer attribute is specified and/or true. Alternatively, provide some other way to disable the autobuffer behaviour.

Workaround 1:
Initially load a temporary element that instructs the user to &apos;click to begin playing&apos;, and use JavaScript to replace it with an &lt;audio /&gt; tag once they do. This breaks when JS is not enabled, and also is not instantly recognisable to the user as their browser&apos;s native audio player.

Workaround 2:
Use an Adobe Flash widget. This is a leading cause of unhappiness amongst standards-compliant web devs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117959</commentid>
    <comment_count>1</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2009-04-17 13:00:38 -0700</bug_when>
    <thetext>Another option is to use a &lt;video&gt; element with a &apos;poster&apos; attribute. This will cause WebKit (and anyone that implements the media element spec correctly) to only load the poster image until the user clicks on the element.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>130584</commentid>
    <comment_count>2</comment_count>
    <who name="Jeremy Keith">jeremy</who>
    <bug_when>2009-07-08 17:39:20 -0700</bug_when>
    <thetext>Currently this bug is the only thing stopping me from implementing the AUDIO element on the site, http://huffduffer.com/

If there were some way of explicitly disabling autobuffer, that would be fine ...but because it&apos;s a Boolean attribute, the only way to disable it is not to use the attribute.[1] WebKit seems to be interpreting the lack of an autobuffer attribute as an implicit request for autobuffering when the opposite should be the case.

The indication in the HTML 5 spec that &quot;this attribute may be ignored altogether&quot;[2] means that an explicit request for autobuffering may be ignored. It does not mean that autobuffering should be enabled by default.

Disabling autobuffering by default, as well as being the behaviour indicated in the spec, is also the safest default behaviour for users&apos; bandwidth.

[1] http://dev.w3.org/html5/spec/Overview.html#boolean-attribute
[2] http://dev.w3.org/html5/spec/Overview.html#attr-media-autobuffer</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>171102</commentid>
    <comment_count>3</comment_count>
    <who name="Faruk Ates">farukates</who>
    <bug_when>2009-12-12 08:55:08 -0800</bug_when>
    <thetext>The VIDEO element suffers from the same autobuffer-impossibility problem. Even with the attribute absent Webkit immediately starts loading the video file.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>171115</commentid>
    <comment_count>4</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2009-12-12 12:23:05 -0800</bug_when>
    <thetext>In the Mac and Windows version of WebKit, QuickTime downloads media data. It is not currently possible to control QuickTime&apos;s download behavior - &lt;rdar://problem/7171445&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174020</commentid>
    <comment_count>5</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2009-12-21 11:29:56 -0800</bug_when>
    <thetext>According to John Gruber, WebKit will autobuffer the video even if a poster frame is used (http://daringfireball.net/2009/12/html5_video_unusable)

I have not independently verified this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174036</commentid>
    <comment_count>6</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2009-12-21 12:18:35 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; According to John Gruber, WebKit will autobuffer the video even if a poster
&gt; frame is used (http://daringfireball.net/2009/12/html5_video_unusable)
&gt; 
&gt; I have not independently verified this.

I threw together &lt;http://bdash.net.nz/files/video-with-poster-image.html&gt;, which shows quite clearly that WebKit will auto-buffer the video even when a poster frame is specified.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174040</commentid>
    <comment_count>7</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2009-12-21 12:25:46 -0800</bug_when>
    <thetext>(In reply to comment #6)
&gt; I threw together &lt;http://bdash.net.nz/files/video-with-poster-image.html&gt;,
&gt; which shows quite clearly that WebKit will auto-buffer the video even when a
&gt; poster frame is specified.

I filed bug 32835 about this since it’s not exactly the same issue as this bug talks about.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174044</commentid>
    <comment_count>8</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2009-12-21 12:46:51 -0800</bug_when>
    <thetext>My comment in about using the poster above is no longer correct. The spec now says that the poster should be displayed only &quot;When no video data is available&quot;. The presence of the &apos;poster&apos; attribute does not change the loading behavior, so if an element has both &apos;src&apos; and a &apos;poster&apos; attributes, the poster is only shown until the first frame of video data is available.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174119</commentid>
    <comment_count>9</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2009-12-21 15:31:04 -0800</bug_when>
    <thetext>(In reply to comment #8)
&gt; My comment in about using the poster above is no longer correct. The spec now
&gt; says that the poster should be displayed only &quot;When no video data is
&gt; available&quot;. The presence of the &apos;poster&apos; attribute does not change the loading
&gt; behavior, so if an element has both &apos;src&apos; and a &apos;poster&apos; attributes, the poster
&gt; is only shown until the first frame of video data is available.

It seems like if there is a poster attribute present, we don&apos;t even need to tell QuickTime to start the load until the first time the video starts playing (or autobuffer is present), so at least in that case, we could work around our limited control of its loading.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174249</commentid>
    <comment_count>10</comment_count>
    <who name="Tor Arne Vestbø">vestbo</who>
    <bug_when>2009-12-22 05:03:27 -0800</bug_when>
    <thetext>Would it make sense to load the media in WebCore with a SubresourceLoader instead of passing the URL directly to the MediaPlayerPrivate? That way we could abstract the loading for all ports, fix the autobuffering in one place, the loading would show up in the inspector, etc?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174272</commentid>
    <comment_count>11</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2009-12-22 08:14:44 -0800</bug_when>
    <thetext>Firefox doesn&apos;t autobuffer by default: http://hacks.mozilla.org/2009/12/autobuffering-video-in-firefox/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174288</commentid>
    <comment_count>12</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-12-22 10:22:13 -0800</bug_when>
    <thetext>(In reply to comment #10)
&gt; Would it make sense to load the media in WebCore with a SubresourceLoader
&gt; instead of passing the URL directly to the MediaPlayerPrivate? That way we
&gt; could abstract the loading for all ports, fix the autobuffering in one place,
&gt; the loading would show up in the inspector, etc?

Sure, we could do that for some media players. But for the QuickTime back end this may require API that does not currently exist.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174396</commentid>
    <comment_count>13</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2009-12-22 14:25:11 -0800</bug_when>
    <thetext>(In reply to comment #10)
&gt; Would it make sense to load the media in WebCore with a SubresourceLoader
&gt; instead of passing the URL directly to the MediaPlayerPrivate? That way we
&gt; could abstract the loading for all ports, fix the autobuffering in one place,
&gt; the loading would show up in the inspector, etc?

We do eventually want to do that. Media engines tend to have unusual demands, such as loading only parts of resources using range requests. It also may not be desirable to hold onto all data loaded so far. So we&apos;d have to add some features to the WebCore loader layer.

In the case of QuickTime in particular it could be particularly tricky to find a way to have WebKit drive the load instead of QuickTime.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>174526</commentid>
    <comment_count>14</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2009-12-22 21:59:32 -0800</bug_when>
    <thetext>(In reply to comment #13)
&gt; 
&gt; We do eventually want to do that. Media engines tend to have unusual demands,
&gt; such as loading only parts of resources using range requests. It also may not
&gt; be desirable to hold onto all data loaded so far. So we&apos;d have to add some
&gt; features to the WebCore loader layer.
 
  We will *definitely* not want to keep all of the data loaded in memory. We may be able to use the work the Chromium port has done to make the WebCore loader to use a sparse disk cache for media data. I don&apos;t think they have modified the loader to support files larger than 2GB, but this is also a real requirement (think HD movies on a local, eg. home, network).

&gt; In the case of QuickTime in particular it could be particularly tricky to find
&gt; a way to have WebKit drive the load instead of QuickTime.

  One of the tricky parts will be continuing to support HTTP Live Streaming, http://tools.ietf.org/html/draft-pantos-http-live-streaming-02.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>202292</commentid>
    <comment_count>15</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2010-03-21 10:22:36 -0700</bug_when>
    <thetext>https://bugs.webkit.org/show_bug.cgi?id=35385 replaced the &apos;autobuffer&apos; attribute with &apos;preload&apos;. &apos;preload=none&apos; tells the UA that the best user experience will be to not load any media data initially, so the &quot;change needed&quot; in described in this bug should no longer be necessary.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>