Roku Developer Program

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

How do you display a JPG on the Roku using the XML file?

How do you display a JPG on the Roku using the XML file?

My XML file is setup for HLS and MP4 but how do you display a JPG instead? Thanks
0 Kudos
9 Replies
destruk
Level 10

Re: How do you display a JPG on the Roku using the XML file?

This is rather vague.  Are you using Scenegraph or roImageCanvas or roScreen?  Are you asking about a fullscreen jpg, background type uri, or thumbnail or bitmap/sprite graphic?
Anyway - you would add a line to the xml, and then parse the xml and download the value you read and display it or load it from the pkg:/ specifier.
For scenegraph to display it you would set a rectangle with the width and height and offset translation, and then tell it to display the image within that rectangle.
The video sample app with details sets the backgrounduri to the graphic so you can see how that works.
0 Kudos
matrixebiz
Level 7

Re: How do you display a JPG on the Roku using the XML file?

Oh, sorry, I would like to display a full screen image instead of a HLS or MP4 when the user clicks on the item icon. 
The XML code below is what I use for both RSG and Brightscript; I tried changing <streamFormat>JPG</streamFormat> but that didn't work.


<item sdImg="pkg:/images/imagesd.png" hdImg="pkg:/images/imagehd.png">
            <title>Video</title>
            <description></description>
            <streamFormat>hls</streamFormat>
            <media>
                <streamQuality>HD</streamQuality>
                <streamBitrate>0</streamBitrate>
                <streamUrl>http://server.com/master.m3u8</streamUrl>
            </media>
            <synopsis></synopsis>
            <genres></genres>
            <live>True</live>
        </item>
0 Kudos
destruk
Level 10

Re: How do you display a JPG on the Roku using the XML file?

Why would you not just specify the jpg file url in the xml feed, and then if there isn't a valid media tag then you'd know it's an image to display?
You can massively reduce the size of your xml if you remove tags you aren't using and remove the parsing lines to handle those empty fields - like a JPG file doesn't need media, streamquality,bitrate,description,streamformat,synopsis,genres,live, etc.  You just need the image url and maybe a title if you want it, and add the size dimensions if you want to utilize those.
A big part of how roku works requires understanding how to read a file and manipulate text data within that file.
0 Kudos
matrixebiz
Level 7

Re: How do you display a JPG on the Roku using the XML file?

"destruk" wrote:
Why would you not just specify the jpg file url in the xml feed

Hello, I've been Googling for Roku XML files on the Internet that include jpg's but haven't found one so I don't know what the syntax would be Smiley Sad 
Do I just call it in <url></url> Like below?
   <item sdImg="pkg:/images/imagesd.png" hdImg="pkg:/images/imagehd.png">
            <title>JPG Image</title>
            <description></description>
           <url>http://server.com/Image.jpg</url>
    </item>
0 Kudos
destruk
Level 10

Re: How do you display a JPG on the Roku using the XML file?

The syntax would be anything you like, as long as your parsing routine is made to match what you pick.  You wouldn't even need to use xml or json you could use text files for your channel if you want to.  You could use your code there if you like - and program your channel to make use of it.
0 Kudos
matrixebiz
Level 7

Re: How do you display a JPG on the Roku using the XML file?

Hello, is the "jpg parsing routine" in the RSG channel already? I wouldn't know what to change if not :( but if it is, do you know what the syntax would be for me to use in the XML file to call it?

EDIT : I searched all the brs files in the components directory of the RSG channel and didn't find any reference to jpg, so looks like it is not configured to display jpg's :( 
EDIT2 : Actually I didn't find hls in those files either so I don't know where the parsing code is.
0 Kudos

Re: How do you display a JPG on the Roku using the XML file?

To display a jpeg file, use a Scene Graph Poster node, which can easily be defined in XML. See: https://sdkdocs.roku.com/display/sdkdoc/Poster
0 Kudos
destruk
Level 10

Re: How do you display a JPG on the Roku using the XML file?

To locate the parsing code, look for the word "parse" in the brs or xml files, as parse, parsexml and parsejson are commonly used to do this.
0 Kudos
matrixebiz
Level 7

Re: How do you display a JPG on the Roku using the XML file?

Okay, thanks for the info, I'll run some tests.
0 Kudos