HTML5 Audio pool exhausted

See original GitHub issue

So I have a website where you can hover on div and this starts to play a song. There are maaany of these divs there and I had a lot of bugs along the way, but I finally got to the point where the site is not that buggy. Actually, there is just one bug now. When I play a few songs by hovering over different divs and then I reload the page, it sometimes happens that the sound is not played until I clear cache or hard-refresh the page. The browser says: HTML5 Audio pool exhausted, returning potentially locked audio object.

Here is my code:

$(this).hover(
    function() {
        $("#spinner-loading-voice").css("display", "block");
        if (sound != null) {
            if (sound.playing()) {
                sound.stop();
                sound.unload();
            }
        }
        sound = new Howl({
            src: voice["mp3_local_path"],
            format: "mp3",
            html5: true,
            onload: function() {
                if (sound != null) {
                    if (!sound.playing()) {
                        sound.play();
                    } else {
                        sound.stop();
                        sound.unload();
                        sound.play();
                    }
                }
                $("#spinner-loading-voice").css("display", "none");
            },
            onplayerror: function() {
                sound.once('unlock', function() {
                    sound.play();
                });
            }
        });
    },
    function() {
        sound.unload();
        $("#spinner-loading-voice").css("display", "none");
    }
); 

For now, let’s ignore how messy the code is. My question is - can I somehow clear the Audio pool?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:31
  • Comments:42 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
KonghaYaocommented, Jul 27, 2021
  • Put your cursor on the webpage when the music are calling to play!
  • Because we put the cursor out of the website page, somewhere like Chrome Devtools,
  • so broswer think this is risk, so it won’t play the music!
  • This is not the error with Hower. All Audio base plugin will ban this behavior.
3reactions
JPilsoncommented, Nov 7, 2019

I was facing the same problem after reviewing my code I noticed that I was getting the error due to empty Howler src. I’m using Vue Js so the URL src comes from the store and it gets from external API. When the upload for the first milliseconds the src is empty.

My Solution: Make sure that the howler src is not empty

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix 'HTML 5 Audio pool exhausted, returning potentially ...
I have tried not using objects and directly defining all key press events inside keyDown function using if..else and it works but it...
Read more >
Warn HTML5 Audio pool exhausted
'warn HTML5 Audio pool exhausted, returning potentially locked audio object' It happens when the user (WebRTC) of Genesys App was ...
Read more >
HTML5 Audio pool exhausted - Bountysource
Coming soon: A brand new website interface for an even better experience!
Read more >
Howler.js - JavaScripting
It defaults to Web Audio API and falls back to HTML5 Audio. This makes working with audio ... We keep a pool of...
Read more >
Cross-browser audio basics - Developer guides | MDN
The code below is an example of a basic audio implementation using HTML5: <audio controls> <source src="audiofile.mp3" type="audio/mpeg" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found