jisa
Visitor

setlayer and 404 image url

How to ask roku to avoid or skip the image urls which have an error for the canvas setlayer api?
Tags (1)
0 Kudos
3 REPLIES 3
jisa
Visitor

Re: setlayer and 404 image url

Can setlayer display a default image on image url failure?
0 Kudos
renojim
Community Streaming Expert

Re: setlayer and 404 image url

Check the URL before you use it (e.g., with roUrlTransfer.Head()) and then you can set the URL you use with SetLayer to a default image included in your package if its not available.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
RokuKC
Roku Employee
Roku Employee

Re: setlayer and 404 image url

"jisa" wrote:
Can setlayer display a default image on image url failure?


There isn't any built-in support for that in roImageCanvas, that I know of.

If your target image is opaque, you could put a placeholder image at the same target rectangle, so that if the image load is successful it will overlay it, but if it fails it would just show the placeholder.
0 Kudos
Community is Temporarily in Read-Only Mode!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. You will not be able to log in or post new comments or kudos during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 12 and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

Thanks for your patience — we’re excited to share what’s next!