<?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>26847</bug_id>
          
          <creation_ts>2014-09-18 15:02:55 +0000</creation_ts>
          <short_desc>Allow restarting playback for media resources which are not random access but can be streamed anew</short_desc>
          <delta_ts>2014-10-08 14:27:46 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Philip Jägenstedt">philipj</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>acolwell</cc>
    
    <cc>dalecurtis</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>silviapfeiffer1</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>111744</commentid>
    <comment_count>0</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-09-18 15:02:55 +0000</bug_when>
    <thetext>Media resources served without byte ranges support can normally be restarted, but there&apos;s no way to effectively seek to any point. Currently Chromium reports no seekable ranges in this case, but that makes it impossible to seek to 0, which is how the loop attribute is specified.

There&apos;s a Chromium bug and code review discussing this:
https://crbug.com/412562
https://codereview.chromium.org/562493003/

Here are the 3 candidate solutions we have, from comment #22:

&gt; 1. Report seekable ranges [0, epsilon]
&gt; 
&gt; Allowed by spec, although the epsilon obviously doesn&apos;t correspond to anything
&gt; in the media resource. What happens when currentTime is set to epsilon or
&gt; &gt;epsilon while paused? Per current spec, one should end up at epsilon, but that
&gt; seems like it would need special casing to support. If the earliest possible
&gt; position is not 0, should it instead be [n,n+epsilon]?
&gt; 
&gt; 2. Report no seekable ranges but allow seeking to zero by restarting the request
&gt; 
&gt; Needs a spec change to allow the seek to 0.
&gt; 
&gt; 3. Report seekable range [0,0].
&gt; 
&gt; Needs a spec change to allow an empty range. What do you all think about this
&gt; one?

Option 3 seems to be the least strange at the moment. Obviously, if the earliest possible position n is not 0, it would be [n,n].

The spec requires the range end to be greater than the range start, so that would be the core of the change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111751</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-09-18 16:55:01 +0000</bug_when>
    <thetext>Why not just buffer the whole file and thus make it entirely seekable?

If it&apos;s a live stream, you can&apos;t seek to 0.

If it&apos;s a non-live stream, you can seek to anywhere, it&apos;s just not buffered. You just have to download the file again. So the seekable range should be [0,end].</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111773</commentid>
    <comment_count>2</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-09-18 21:30:53 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #1)
&gt; Why not just buffer the whole file and thus make it entirely seekable?
&gt; 
&gt; If it&apos;s a live stream, you can&apos;t seek to 0.
&gt; 
&gt; If it&apos;s a non-live stream, you can seek to anywhere, it&apos;s just not buffered.
&gt; You just have to download the file again. So the seekable range should be
&gt; [0,end].

It&apos;s resource served without &quot;Accept-Ranges: bytes&quot; but with a Content-Length, i.e. non-live and non-seekable.

If that resource doesn&apos;t fit in cache or it&apos;s not cached due to some policy, then seeking amounts to loading it all over again. That seems worse than not allowing seeking at all, TBH.

It&apos;s technically really easy to make looping work though, so if one wants to implement that before &quot;buffer everything&quot; or whatever, how should it be exposed on HTMLMediaElement?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111810</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-09-19 17:22:07 +0000</bug_when>
    <thetext>Being able to seek is better than not being able to seek, even if it&apos;s slow. In practice, you don&apos;t have to cache the whole thing. Just cache what you can. That way if the user is suddenly &quot;wtf was that&quot;, they can seek back a few seconds easily, but if they want to go back an hour, the file has to be reloaded from the start.

If the user finds he can&apos;t seek, but knows he can just reload the page and fast-forward to what he wants to see, then the browser being stubborn and not letting him seek is just frustrating and annoying, IMHO.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111835</commentid>
    <comment_count>4</comment_count>
    <who name="Dale Curtis">dalecurtis</who>
    <bug_when>2014-09-19 19:40:40 +0000</bug_when>
    <thetext>Seeking practices aside. The main question is whether TimeRanges are allowed to represent a single moment in time or if they must always represent a range.

acolwell@ offered the following hypothetical: Consider a playing video which has been paused, due to memory constraints the cache is evicted such that only a single frame at time T is available.  Is it reasonably to expose seekable as [T,T] in this case?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111844</commentid>
    <comment_count>5</comment_count>
    <who name="Aaron Colwell">acolwell</who>
    <bug_when>2014-09-19 20:25:41 +0000</bug_when>
    <thetext>Actually I was more thinking in terms of whether .buffered could be [n,n] in the case mentioned in the last sentence. The .seekable attribute could also be that as well, but I was mainly interested in having the &quot;should we allow an instant to be represented w/ TimeRanges&quot; question answered since the current spec text doesn&apos;t allow it. That feels like the core question here. What the UA exposes via .buffered and .seekable seems more like a quality of implementation issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111919</commentid>
    <comment_count>6</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-09-22 16:28:23 +0000</bug_when>
    <thetext>Yeah, the spec should probably allow &quot;empty&quot; ranges (not really &quot;empty&quot; since the start and end are both inclusive).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112152</commentid>
    <comment_count>7</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-09-24 22:48:20 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8819.
Check-in comment: Allow TimeRanges to contain &apos;empty&apos; ranges (not really empty, they contain one moment in time). Add some text admonishing implementations that don&apos;t allow one to seek arbitrarily when it&apos;s actually possible just inconvenient or slow.
https://html5.org/tools/web-apps-tracker?from=8818&amp;to=8819</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112826</commentid>
    <comment_count>8</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-10-08 14:27:46 +0000</bug_when>
    <thetext>Thanks, the spec change looks good. On the Chromium side, we ended up reporting [0,0] for seekable ranges for in some cases, i.e. what the spec calls &quot;a poor implementation.&quot; It would be nice to improve this, but from what I understand it&apos;s quite a bit of work.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>