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: 
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?
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
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.