Is there an Audio API? 🤔

There are some pretty significant issues with manually adding audio to a Hype project. One of the most common is a gap in the audio – if it is set to loop. Another common problem is Safari. There’s this annoying error…

Unhandled Promise Rejection: NotAllowedError (DOM Exception 35): The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.

We’d love to hear from developers on these new auto-play policies. Please reach out to our Web Technologies Evangelist, Jon Davis on Twitter to share your thoughts with our team.

This change is great as Safari user, but it’s has been a lot of trouble as web developer. Fortunately, it’s not too hard to get sounds to play properly. It just has to be done with an on-click type of event. That’s pretty easy with Hype.


There’s not much else I can do. I can only start or stop the sound. I can’t raise or lower the volume and I can’t fade out the sound.

…but I should be able to access the sound somehow, right? This is like the Physics API problem again. Hype is doing something, but it doesn’t want to share.

The biggest problem I’m having with audio right now is a gap with looping audio. This happens in WKWebView. I tried using Howler.js but that didn’t seem to fix the WKWebView looping problem either.

Here’s what I think what would make audio better with Hype…

  • Volume Control – By being able to raise and lower the volume dynamically, sound can fade in and out.
  • Panning Audio – By being able to control the sound from the left and right speakers, a project can have a more realistic feeling.
  • Pause Audio – Instead of fully stopping a song, it could be paused.
  • Play Rate – Audio could be sped up or slowed down.
  • JavaScript API – All of these features should be accessible in the Hype JavaScript API library.
  • Better Loop support – This doesn’t work in WKWebView. This is more of an Apple problem, but it is the only major issue I’m having converting a Hype project to an iOS or Mac app.

Do you think Hype should include the audio features mentioned above?

  • Yes
  • No

0 voters


On the side note you mentioned wkwebview,
Just wondering if it would make more sense to switch your sound to the native iOS app sound frameworks side and send control messages from the Hype side.
Thus not relying on web sound api or Hype

Oh, I totally considered that.

You seem to be pretty good with using the JavaScript – Swift bridge. This does unlock a lot of possibilities. It also creates a separate codebase though. I’m trying to avoid scenarios where I have to make a lot of little adjustments for each platform. For one app, it’s not a problem. I’m planning to make a hundred though. HA HA, so it’s easier for me to just avoid using loops… which is OK, since the background music I have so far is not super amazing anyway. Maybe that will change in the future though.

Well, that settles that. @jonathan likes the idea. The voting might as well be closed now. HA HA. Actually, I was testing the poll feature. I didn’t know it was here. It would have made this thread a lot easier.



Also I did find a post on macromors ‘avoid audio glitches’ that suggest the issue with loops is due to the block size of compressed sound files being limited to 1024 samples.
If a file is full length is not fully able to divide by 1024 the remainder is padded. this padding gives you the silent gap.

So the suggestion is to avoid compressed sound files… ( not sure how you do that)

1 Like