Thanks, that was a start.
I've got my controls showing up and the state machine for trick mode finished, but I'm having two problems. One's just a documentation searching failure: I've painted stuff onto an roImageCanvas, and I can't clear the canvas. At all. I've tried clear(); clearLayer(); show(); all with sleep() in between. But nothing serves -- the canvas is preserved even across quitting the channel and restarting it. I've even added a button with addButton()
in the debugger, and the button persists, even across channel installs! What's going on here?
The second problem is much scarier and more fundamental; I'm implementing new controls, and the functionality I need is, for instance, when the user pressed fast forward, the video player should pause (ok, simple enough), and a progress bar indicating where in the program the viewer is should be shown (again, easy enough), and then be updated, until the player state changes. My issue is that I do not have the ability to reuse my existing event loop, as once the player is paused, there are no more messages being received.
My main loop looks like:
while true
msg = wait(0, m.messagePort)
...
I've updated it to:
while true
msg = m.messagePort.getMessage()
if msg = invalid then
m.updateUI()
sleep(some_small_quantum)
...
The problem here is that no matter how small a quantum I use in the sleep, I'm still going to miss events, right? They don't stack? There's no way for me to inject timing messages into my event loop, right? Even if I had write access to that port, I wouldn't be able to have something firing off on a separate thread/proc of execution dumping new events into the port every e.g. 100ms.
Is this the sort of problem that
can be solved in BrightScript?