[whatwg] Audio(): loop() with 0 or negative value as argument
shadow2531 at gmail.com
Sat May 27 04:06:16 PDT 2006
On 5/26/06, Anne van Kesteren <fora at annevankesteren.nl> wrote:
> In Opera we now throw INDEX_SIZE_ERR when someone calls loop(x) on the
> Audio object with x being either 0 or negative. This seems to be
> consistent with how similar "errors" are treated in the <canvas>
> interface and makes sense to us. Our suggestion would be to put this
> into the specification, unless someone has a better suggestion.
> (Note that loop() without arguments can be used for infinite repetition.)
I might seem picky, but I don't really like how loop() takes a
loop() = infinite
loop(1) = play once
loop(2) = play twice
It's the loop(n) that bugs me. I see loop(1) and think that the file
is going to play once and then loop once. (The first time it plays is
not a looped play.)
Luckily, I saw the spec and read that the parameter is NOT how many
times to loop, but how many times to play, hence *playcount*.
Not seeing the spec, if I wanted to *specifically* set the file to
only play once, I'd do loop(0), which to me would mean, play once and
not loop at all. Loop is usualy a boolean value anyway.
The following makes more sense to me:
playcount() = infinite
playcount(1) play once
playcount(2) play twice
playcount(-x) throw error
playcount(0) throw error ( Or don't throw an error and just don't
play. Can't think of a use case for that, but maybe someone can.)
On a side note, the Windows Media Plugin param PlayCount works like this:
playcount = 0 - infinite
playcount = n - number of times to play
I can see people doing loop(0) to try to turn off looping if they
previously set loop(99) for example. Getting rid of loop() and using
playcount() would clear things up IMO.
Of course, I could just be crazy. :)
I agree though, an error should be thrown for loop() for anything less than 1.
More information about the whatwg