-
Notifications
You must be signed in to change notification settings - Fork 173
Description
Per the spec:
The duration parameter describes the duration of the sound (in seconds) to be played. If this parameter is passed, this method has exactly the same effect as the invocation of
start(when, offset)followed bystop(when + duration).
None of the major browsers implement it this way. If the playbackRate is set to anything other than 1, actual duration of the sound emitted is the value of the argument divided by playbackRate. The duration applies to the length of the source sample before it is adjusted by the playbackRate. This is not the same as using start without a duration followed by stop, as described. The latter will play the sped up or slowed down clip for the correct duration.
Here is a link to a simplified test case:
https://codepen.io/brianchirls/pen/zaKgva?editors=1111
The above applies to recent versions of Firefox, Chrome, Safari and Edge. I don't really mind whether the spec gets changed or the browsers change behavior as long as it's consistent. I figured I'd file here first for discussion rather than try to chase down four browser vendors.