Audio duration
Property
Example
Get the length of the current audio:
x Output result:
Definition and Usage
The duration
property returns the length of the current audio in seconds.
Note: Different browsers return different values. In the above example, Opera 18+ and Chrome return "1.515102". Firefox returns "1.509298". Internet Explorer returns "1.5491875". Safari returns "1.5149999856948853". Opera 12 returns "1.5092970520000002".
Note: This property is read-only.
Browser Support
All major browsers support the duration
property.
Note: Internet Explorer 8 and earlier versions do not support this property.
Syntax
Technical Details
| Return Value: | Numeric value, representing the length of the audio in seconds. If no audio is set, it returns NaN (Not a Number). If the audio stream has no predefined length, it returns "Inf" (Infinity: Infinite). | | --- | --- |