destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2011
02:03 PM
roImageCanvas Image Cancellation
When I download an image to set as the background, is there any way to abort the download of the image file before the download completes without closing the screen? To programatically interrupt the download of the image file?
Maybe I'd need to set the canvas component to "nothing", then run the garbage collector, and then create a new roImageCanvas object? Would that cancel the transfer of the file in progress?
Maybe I'd need to set the canvas component to "nothing", then run the garbage collector, and then create a new roImageCanvas object? Would that cancel the transfer of the file in progress?
5 REPLIES 5

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2011
02:10 PM
Re: roImageCanvas Image Cancellation
Assuming a call to ClearLayer doesn't cancel the transfer, you could potentially use the AsyncGetToFile method of the roUrlTransfer component to download it to a tmp: location prior to setting the layer on the image canvas. Since it won't display until it's fully downloaded anyway, it shouldn't incur any additional performance penalties, and gives you the ability to cancel the transfer without having to recreate the canvas.
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)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2011
02:18 PM
Re: roImageCanvas Image Cancellation
Thanks! I hadn't thought about clearlayer. How would you cancel a file transfer in progress? I see your answer to copy the file to tmp, and then display it if it 'hasn't been cancelled' by the user, but the file that way would still be transferred taking up the bandwidth to get the whole file. I'd like to cancel it partway, before it's done transferring - if it's possible. If not, that's ok - just not preferred.

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2011
03:04 PM
Re: roImageCanvas Image Cancellation
"destruk" wrote:
Thanks! I hadn't thought about clearlayer. How would you cancel a file transfer in progress? I see your answer to copy the file to tmp, and then display it if it 'hasn't been cancelled' by the user, but the file that way would still be transferred taking up the bandwidth to get the whole file. I'd like to cancel it partway, before it's done transferring - if it's possible. If not, that's ok - just not preferred.
If you use AsyncGetToFile, you can call AsyncCancel to cancel the transfer. Oddly enough, I don't see AsyncCancel documented in the component reference, but you can see it in use in the urlUtils.brs file in the videoplayer example.
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)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2011
03:18 PM
Re: roImageCanvas Image Cancellation
Thanks a bunch! This is great!

RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2011
10:50 AM
Re: roImageCanvas Image Cancellation
and thanks for pointing out the doc bug. I'll remedy that in the next SDK release.
--Kevin
--Kevin