Gabixel / Soundboard

A soundboard for everyone! [PAUSED PROJECT]
MIT License
1 stars 0 forks source link

Implement audio timings #44

Open Gabixel opened 10 months ago

Gabixel commented 10 months ago

Editor goals:

Gabixel commented 10 months ago

There's this thread where I just discovered the existence of a "native" time range using the Media Fragments URI specification:

<audio id="my-audio"
       src="file.mp3#t=00:03:26" 
       oncanplaythrough="this.play();">
</audio>

It looks like it supports different styles:

This also breaks the current logic for the play/pause button icon (and everything related to audio disposal), even though it looks like the pause event gets called. Maybe it's something related to the playing state, but not sure yet. I'm not even sure if this is a good alternative to making it from scratch. I will try it since it can probably help with reducing the data needed for long audio files.

Not sure where to find more documentation. I'll link what I can find in the meantime:

Gabixel commented 8 months ago

I'm still leaning toward using media fragments, but they don't seem to end time at the given millisecond value: I noticed that it can get up to 300ms further than expected (average: ~100), and I think there's no limit to that value. And I'm guessing using other methods like setTimeout() is even worse.

I'm testing on this codepen for the time being.

Image