Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

roImageCanvas layer is not updaing

I am working on a custom windowed video player. The functionality that I want is to show a now loading image on top of (or instead of) video player when player is buffering the video and remove the now loading image when player starts to play the video.

But the problem is once now loading image is drawn on the screen it is not going away when player starts to play the video.

Here is the code that I am using to draw the canvas:


function draw_canvas()
m.canvas.AllowUpdates(false)
m.canvas.Clear()
m.canvas.SetLayer(0, m.canvasLayers.background)
if m.isLoadingVideo = true
m.canvas.SetLayer(1, [m.canvasLayers.frameImage, m.canvasLayers.nowLoadingImage])
else if m.isLoadingVideo = false
m.canvas.SetLayer(1, [m.canvasLayers.frameImage])
end if
m.canvas.AllowUpdates(true)
end function


Here is the code that calls this draw_canvas function in the event loop:


if type(msg) = "roVideoPlayerEvent"
if msg.GetMessage() = "start of play"
m.isLoadingVideo = false
m.drawCanvas()
else if msg.GetMessage() = "startup progress"
if m.isLoadingVideo <> true
m.isLoadingVideo = true
m.drawCanvas()
end if
end if
end if


roVideoPlayer starts to work with the start of application and is located at the same coordinates as now loading image.

And here is code from my controller function:

m.drawCanvas()
m.videoPlayer.Play()
return m.eventLoop()

I am not able to locate where the problem is so if anyone can help me with it please???
0 Kudos
1 REPLY 1

Re: roImageCanvas layer is not updaing

Found the problem! problem was in my background layer, I hadn't set the CompositionMode to "Source" in the background layer. and the problem vanished after doing so....

m.canvasLayers.background = {
Color: "#00000000",
targetRect: {
x: 0,
y: 0,
w: m.screenRect.w,
h: m.screenRect.h
},
compositionMode: "Source"
}
0 Kudos