goldfire / howler.js

Javascript audio library for the modern web.

Home Page:https://howlerjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Audio Context cannot be created before user gesture

jrhager84 opened this issue · comments

The Problem

First off, I know that you can't create an Audio Context before a user gesture according to the spec, but this is the part that I'm unsure is a bug, or a lack of a feature:

Is there no way to preload the Howler instance, deferring the audio context creation until the user hits the play button? I've looked through the documentation, as well as checking SO etc, but I can't seem to find an exact use-case similar to what I'm trying to do.

Reproducible Example

https://thundermp3.com/song/5b166768-d7dc-4162-bf25-6813d83367f3?title=Test%20Audio

Reproduction Steps

User Howler as shown in this StackOverflow post by me:

https://stackoverflow.com/questions/76734817/how-to-preload-howler-audio-without-creating-context-audio-context-cannot-be

Possible Solution

allow the deferring (if not already available) of the context to user gesture

Context

UX is terrible. In order to defer the context, I have to not load the audio file until 'play' is clicked, but it can take up to 2 seconds for the song to play, and error load states no longer apply (before the rendering of the audio file)

Howler.js Version

v2.2.3

Affected Browser(s)/Versiuon(s)

All