[whatwg] Audio(): loop() with 0 or negative value as argument

Michael A. Puls II shadow2531 at gmail.com
Sat Aug 4 04:24:31 PDT 2007

On 8/3/07, Ian Hickson <ian at hixie.ch> wrote:
> On Sat, 27 May 2006, Shadow2531 wrote:
> >
> > I might seem picky, but I don't really like how loop() takes a
> > *playcount* param.
> >
> > 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*.
> The spec has changed (we no longer have loop() itself); is the new API ok
> in your opinion?


I see "The loopcount content attribute gives the number of times to
play the clip. The default value is 1."


The name "loopcount" and the description for loopcount contradict each
other. It seems that the description is what is intended though.

However, if loopcount has a default of 1, that to me means the first
time playing through is considered a loop. If so, do loopstart and
loopend override start and end during the first time of playback (the
steps seem confusing to me) or do loopstart and loopend only kick in
when the file truly loops and starts playing the second time etc.?

Also, if the first time playing is considered a loop and the loopcount
starts at 1, should currentLoop start at 1 also? Or, if the index is
just meant to be zero-based, which one of these represents what
currentLoop returns?

currentLoopArray[0] = first time playing
currentLoopArray[1] = second time playing

if (currentLoop == 0) {
    this is the first time playing;


currentLoopArray[0] = first looped play (second time playing)
currentLoopArray[1] = Second looped play (third time playing)

if (currentLoop == 0) {
    it has already played once and now we're on the first loop

With that said, allow me to guess.

loopcount has a default of 1 because the first time playing is
considered a loop.

loopstart and loopend only kick in after the first time playing
because they don't consider the first time playing a loop.

currentLoop considers the firt time playing a loop. So, if it's the
first time the file is playing, it will return 0 because the index is

So, if you could, add a definition of what a "loop" is in this case
and say that the first time playing is considered a loop. And, if
loopstart and loopend only kick in after the first time playing (the
first true loop), we need a name (like "looped play" with a
defintition) to differentiate it from "loop".


More information about the whatwg mailing list