goldfire / howler.js

Javascript audio library for the modern web.
https://howlerjs.com
MIT License
23.27k stars 2.21k forks source link

Support for accessing the HTMLAudioElement when using html5 player #1680

Open thomasmery opened 9 months ago

thomasmery commented 9 months ago

Feature Proposal

AFAIK there is no way to access and modify the html5 Audio element

this is a must have feature as without it it is not possible to set attributes that sometime are mandatory for the player to be used like the 'crossorigin' attribute

ATM one has to hack the player API and do something like

if (howl._sounds && howl._sounds[0]._node) {
      const audioNode = howl._sounds[0]._node;
      audioNode.crossOrigin = "use-credentials";
  }

Are there PRs open? or even forked projects?

I could not find anything

thank you

Possible Implementation

No response

francoispottier commented 9 months ago

I subscribe to this, because it's a real issue : our audio hosting provider invalidates urls and do redirects every 15 minutes to better identify sessions and have more precise analytics, and this is now restricted by Chrome. So if the audio file is longer than 15 minutes, it stops playing a few minutes after the 15min mark. The Chromium team told my hosting provider that we just have to add the attribute crossOrigin="anonymous" to make this work, but since we can't access the audio element...