Re: media element seek algorithm: don't throw

On Wed, Feb 3, 2010 at 2:14 AM, Simon Pieters <simonp@opera.com> wrote:

> 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.
>

In Gecko, we avoid that kind of problem by being very careful to ensure that
asynchronous cache and codec state changes aren't visible to scripts. (We
haven't implemented 'seekable' yet, but my plan is, when a script reads
'seekable' we compute the result, store it, and pin the element's cache
entries until the script runs to completion, so subsequent reads of
'seekable' return the same result and seeking to times in 'seekable' can't
fail.) I think this is critical to make the media API usable in a robust
manner. Maybe the spec should say something about that.

Rob
-- 
"He was pierced for our transgressions, he was crushed for our iniquities;
the punishment that brought us peace was upon him, and by his wounds we are
healed. We all, like sheep, have gone astray, each of us has turned to his
own way; and the LORD has laid on him the iniquity of us all." [Isaiah
53:5-6]

Received on Tuesday, 2 February 2010 19:02:07 UTC