Open Gabixel opened 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:
00:00:01
/ 00:00:01.000
1.123
#t=<start>
#t=<start>,<end>
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:
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.
Editor goals:
start
andstop
timestop
time has two possible conditions:at
andafter
at
meaning it's a specific timestampafter
is for durations (e.g. if we want to stop after 10 seconds from the un-/specifiedstart
)500ms
is0.500
)