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: 

Changing images on roImageCanvas

Hi, I am currently using roImageCanvas to display multiple images simultaneously. The images are being pulled from the internet itself(they are not local) , the logic(not the exact code) goes like this :

Main.brs

Sub Main()

'some code before
image_canvas=createObject("roImageCanvas")
images=get_images()

while true

msg=wait(0,msg_port)

if type(msg) = "roImageCanvasEvent" then '1 roImageCanvasEvent

if (msg.isRemoteKeyPressed()) then '2 is remote key pressed

'logic to check if direction keys are pressed
'if appropriate direction key is pressed
img_array=images.get_next_image(direction_key_index) 'here img_array is an roArray of roAssociativeArray
image_canvas.setLayer(1,img_array)

end if
end while
'some code afterwards

End Sub


image_all.brs

Function get_images() as Object

this={}
this.get_next_image=Function(direction_key_index as integer) as Object


url1=www.some-domain-name.com/image-name?+a_random_string_to_prevent_retrieving_image_from_cache
url2=www.some-domain-name.com/image-name?+a_random_string_to_prevent_retrieving_image_from_cache

img_aa_url1=associative_array_metadata_for_url_1
img_aa_url2=associative_array_metadata_for_url_2

images_a=[]
images_a.Append([img_aa_url1])
images_a.Append([img_aa_url2])

return images_a

end function
End Function


Although the things are working pretty okayish, but it takes atleast 40 seconds for the images on the screen to change after the direction keys are pressed. My internet speed currently is limited to 512Kbits/sec, could this be a problem due to my internet speed or is it due to image format or the ImageCanvas is not meant to pull images faster from the internet ? The images are not more than 80 Kbytes.. is there an efficient way to do this? to increase the speed so as to make the user experience seamless?
0 Kudos
2 REPLIES 2
TheEndless
Channel Surfer

Re: Changing images on roImageCanvas

Add...
image_canvas.SetRequireAllImagesToDraw(False)
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos

Re: Changing images on roImageCanvas

Hi Endless, thank you 🙂 the approach worked 🙂 thanx a ton for the reply 😄
0 Kudos