Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 7

roImageCanvas code not working

This is what I'm trying to do once the user clicks on a content video.

1. Play Video
2. End Video
3. Video repeats (buffers)
4. Instead of showing "retrieving" screen, show a full screen image until buffering finishes
4. Once video starts again, remove screen image and play video normally.
5. Start from step 2

Sub OnVideoPlaybackFinished()
    if"finished" then = "start"
        'This program will display an image on instead of the buffering
    if type(msg) = "roVideoPlayerEvent" then
        if msg.GetMessage() = "start of play"
            m.isLoadingVideo = false
        else if msg.GetMessage() = "startup progress" then
            if m.isLoadingVideo <> true then
                m.isLoadingVideo = true
            end if
         end if
    end if
    'ending of different images
    end if    
end sub

    Sub drawCanvas()
    if m.isLoadingVideo = true
    canvasItems = [
    canvas = CreateObject("roImageCanvas")
   port = CreateObject("roMessagePort")
   'Set opaque background
   canvas.SetLayer(0, {Color:"#FF000000", CompositionMode:"Source"})
   canvas.SetLayer(1, canvasItems)
   else if m.isLoadingVideo = false
   end if   
End Sub
0 Kudos
1 REPLY 1\
Level 11

Re: roImageCanvas code not working

What is it doing instead of what you expect?
From reading the code it looks like it would draw the fullscreen image and never remove it after.
0 Kudos