In my Media API attempt, I’m currently using a Task to set the currentTime property of an audio or video node. Since I can set properties with VirtualDom, this drives me nuts as an unnecessary use of native code.
However, I have a problem with setting the property using VirtualDom.property, so I’m reaching out here to see if anyone has a decent solution.
Here’s what I can do:
audio [src="music.mp3", currentTime=15][]
And that will work fine…as long as the currentTime property is set to a different number each time. So if I have a “jump 15 seconds ahead button” that just adds 15 seconds, I’m probably fine. There might be a 1 in a billion occasion where it doesn’t work, because the numbers line up just right, but I can live with that.
But what if instead of setting the currentTime relative to my current playhead position, I want to set it to a specific time? The most obvious is a player that simply has a restart button, that sets currentTime to 0. The first time someone clicks this button, it will work. But the second time, it won’t, because the virtualDom riffing algorithm doesn’t detect a change in the property.
A lot of this is because an audio or video player has side effects…currentTime does change. And maybe that makes it a side effect that should be properly done through a task, but there’s a lot of smart people on here and maybe someone has a solution.