I’m currently having a issue where I receive this error:
Uncaught DOMException: Failed to construct ‘AudioContext’: The number of hardware contexts provided (6) is greater than or equal to the maximum bound (6).
The problem comes from the HYPE.js file.
So is there a way to close the AudioContext when the animation timeline is complete?
That’s an interesting error; as @DBear said, could you send a zip of your .hype document so we can take a look? (If confidential, please send to support@tumult.com and we can keep it private). It would also be useful to know what browser, version, device, and OSes you are using. Thanks!
@Corrine it’s like fumbling around in the dark for something when we can’t see how it’s used in context.
There are methods such as AudioContext.close() and AudioContext.suspend() but we have to take into account browser issues, etc. Bearing in mind this doesn’t release the AudioContext completely but does allow additional contexts to be created. The error you have stated is quite self-explanatory i.e you can only have a maximum of 6 AudioContexts in any one document. That being said and as I mentioned, you only ever really need one context and you would store sounds in buffers. This way it helps with syncing.
Clicking on the page numbers at the bottom does not refresh the page (it loads data from a database into the same page again). So basically if i were to click page 11 (the page the animation is on) 6 times, I get the error.
@DBear can you elaborate on “store sounds in buffers”?
secondly, I must apologise as I assumed that you were using code, with AudioContext.
I may suggest a workaround for the moment, and that is to prevent a second press of the button for the page. You could do this by placing an element over it with an action for the press and then hiding or moving that element immediately after (probably with your animation).
The reason being (and @jonathan would have more insight into this) is that Hype (sometimes) uses the Web Audio API to load its sounds and because you’re not reloading the page it’s creating new contexts for the audio files (until it reaches 6). This is a hunch and may be wrong. I’m speculating here and this isn’t a definitive answer. I’m sure Jonathan could give more information.
This is indeed a Hype bug (rather it did not take Chrome’s limit into account). Thanks for reporting this. I just made a specific fix to better reuse contexts and overall improved the safety to fallback to the HTML5 <audio> tag if there’s ever a problem, which will be in the next version of Hype. You’ll need to re-export with that.
Unfortunately I can’t think of any workarounds to the problem short of not reloading the document more than 6 times . If you’re interested in getting the fix sooner, you’re welcome to join the beta program; let me know if that interests you.
@DBear sort of! however I get the error again when I sequentially go through the pages anyway as there are other animations with sounds being loaded beforehand