Re: media element seek algorithm: don't throw

On Feb 2, 2010, at 5:14 AM, Simon Pieters wrote:

> http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#seeking
> 
> "4. If the (possibly now changed) new playback position is not in one of the ranges given in the seekable attribute, then the user agent must raise an INDEX_SIZE_ERR exception (if the seek was in response to a DOM method call or setting of an IDL attribute), and abort these steps."
> 
> It's annoying to use try/catch every time you set currentTime. It's nicer to check seekable and then set currentTime. However, even if you check seekable there's no guarentee that currentTime won't throw because the cache might be cleared between the check and the setting. Therefore we think it's better to silently abort the algorithm instead of throwing.
> 

  I agree, throwing for an out-of-range seek is unexpected if the questions we have gotten from developers is any indication. I think it makes more sense to clamp the time value to the maximum seekable time.

eric

Received on Tuesday, 2 February 2010 15:27:49 UTC