How to do a time-sensitive, custom decoder, via ports?

In Elm Media, I’m able to decode a json object representing the currentState of a media player 95% using Json Pipeline Decode.

However, three fields which are too important to skip, “buffered,” “seekable,” “played,” return an object with two functions: { length: index, start(index), end(index)};

What I really need is an array or list of a record: {start: Float, end: Float}.

My current solution is to use a decoder that has a native module with a function that iterates and creates and array.

If I send this out a port and send it back, will the runtime wait until the next requestAnimationFrame before presenting me with the result. Unfortunately but that time, the information will be out of date.

This is a bit tough to wrap my head around and appreciate any help. Thanks.

1 Like

And forgive me if this is totally illegible and nonsensical. Written very quickly before I had to put my computer away for landing.