[whatwg] Handling unknown 'duration's

Philip Jägenstedt philipj at opera.com
Sat Dec 18 02:27:08 PST 2010

On Sat, 18 Dec 2010 03:34:19 +0100, Robert O'Callahan  
<robert at ocallahan.org> wrote:

> http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-media-durationsays:
> The duration attribute must return the time of the end of the media
> resource<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#media-resource>,
>> in seconds, on the media  
>> timeline<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#media-timeline>.
>> If no media  
>> data<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#media-data>is  
>> available, then the attributes must return the Not-a-Number (NaN) value.
>> If the media  
>> resource<http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#media-resource>is  
>> known to be unbounded (e.g. a streaming radio), then the attribute must
>> return the positive Infinity value.
> What if the duration is not currently known?
> I think in general it will be very difficult for a user-agent to know  
> that a
> stream is unbounded. In Ogg or WebM a stream might not contain an  
> explicit
> duration but still eventually end. Maybe it would make more sense for the
> last sentence to read "If the media resource is not known to be bounded,
> ..."

Agreed, this is how I've interpreted the spec already. If a server replies  
with 200 OK instead of 206 Partial Content and the duration isn't in the  
header of the resource, then the duration is reported to be Infinity. If  
the resource eventually ends another durationchange event is fired and the  
duration is reported to be the (now known) length of the resource.

Philip Jägenstedt
Core Developer
Opera Software

More information about the whatwg mailing list