Hello,
I'm working on a channel that needs custom player controls, so I'm using an imageCanvas and a videoPlayer. I can paint the controls (png files) and they show up correctly; but I simply cannot get them to go away. They persist even after I sideload the channel! Here's the instantiation:
player = createObject("roVideoPlayer")
canvas = createObject("roImageCanvas")
port = createObject("roMessagePort")
canvas.setMessagePort(port)
player.setMessagePort(port)
player.setDestinationRect(canvas.getCanvasRect())
Then later, I go to put the controls on the screen (simplified here):
addButton: function (button_name)
url = invalid
if button_name = "pause"
url = "pkg:/assets/images/btn-pause.png"
else if button_name = "play"
url = "pkg:/assets/images/btn-play.png"
end if
if url = invalid
logger("warning", "unknown UI button " + button_name)
return invalid
end if
x1 = m.displaySize.w / 2 - 40
y1 = m.displaySize.h * 3 / 4 - 38
button = { TargetRect: { x: int(x1), y: int(y1), w: 80, h: 76 }, url: url }
m.canvas.setLayer(0, [button])
m.canvas.show()
end function
But there's no combination of clear(), sleep(), clearLayer() &c. that does
anything. And as I said, even if I go into a different channel, and then reload my custom code again, the same canvas persists. What's going on? Do I need to use a different imageCanvas? Is there any way to control the z ordering of my canvases, other than lexically? I guess I could create and close new canvases every time I needed to paint the chrome?
EDIT: It's not simply the setLayer() that persists; I stop() the channel, and then in the debugger do an addButton(1, "foobar") -- and that button persists!
TIA.