Duration audio Infinity
See original GitHub issueIn the following function I send the URL, my problem is that the audio.duration gives me Infinity.
function recordingEndedCallback (urlBlob) {
var audio = new Audio()
audio.src = urlBlob
audio.addEventListener('loadedmetadata', () => {
console.log(audio.duration)
}, false)
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
html audio tag, duration always infinity - Stack Overflow
The audio plays alright, but the duration property of the audio tag is always returning infinity. I tried the accepted answer to this...
Read more >HTML : html audio tag, duration always infinity - YouTube
HTML : html audio tag, duration always infinity [ Gift : Animated Search Engine : https://bit.ly/AnimSearch ] HTML : html audio tag, ...
Read more >Audio element duration returns "Infinity" when website is ...
For an unknown reason the “duration” of the audio element now returns “Infinity”, and this prevents the audio player from working properly.
Read more >Infinity Audio/Video Duration Issue Fixed Using JavaScript
Unfortunately, with some Audio/Video we will see the duration as Infinity. A chrome bug that causes the duration not to be available under ......
Read more >HTMLMediaElement.duration - Web APIs | MDN
If the element's media doesn't have a known duration—such as for live media streams—the value of duration is +Infinity .
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I did some test in android and IOS latest version by today date (14/04/2022).
It’s working fine.
I have integrated below solution. (It’s working fine in desktop Chrome Version 100.0.4896.75 (Official Build) (64-bit)) Still need confirmation from different OS and browser.
In order to get the duration inside recorded file we have to add ts-ebml dependency. I have used webm-duration-fix npm.
By integrating above solution it’s fixed my recording duration issue but still need to test in other OS and browsers.