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: 
Bizztt099
Channel Surfer

Roku Brightscript How to refresh image with Poster object

I have 1 http address to load images that change with timestamp.

For example xxx.com?time=192186577

Can I use a Poster object to do this real-time refresh of the image content? If the poster doesn't support it, can I use another object? Please give me some help.

0 Kudos
2 REPLIES 2
chaklasiyanikun
Roku Guru

Re: Roku Brightscript How to refresh image with Poster object

you need to create one Task Node(control nodes) and Put your Poster(Image) code inside the Task node. and you need to use the timer(control nodes)("fire" events) for handling the Task node For calling timewise.

0 Kudos
Bizztt099
Channel Surfer

Re: Roku Brightscript How to refresh image with Poster object

I still can't implement the Task node in the way you instructed.
With the Poster Component object, I see it has a uri property. I still don't understand why using Task node in this case.

I have tried with Timer but when loading the image displayed on the device, it appears black flashing when changing the uri of the Poster.
Here is the source code I am trying to test.

<?xml version="1.0" encoding="utf-8" ?>
<component name="posterScene" extends="Scene" >

<script type="text/brightscript" >


<!-- m.poster.ObserveField("loadStatus", "changetext") -->


<![CDATA[

sub init()

m.timer = m.top.findNode("exampleTimer")
m.timer.ObserveField("fire", "changetexta")
m.timer.control = "start"

m.mirrorUrl = "http://192.168.11.6:4998/screenmirroring"

m.poster = m.top.findNode("channelbugPoster")

m.top.setFocus(true)
end sub

sub changetexta()
time = CreateObject("roDateTime")
second = time.AsSeconds()
milisecond = time.GetMilliseconds()
timestampString = second.ToStr() + milisecond.ToStr()
mirrorUrl=m.mirrorUrl+"?ts="+timestampString
print(mirrorUrl)
m.poster.uri = mirrorUrl

end sub

]]>
</script>

<children>
<Poster
id="channelbugPoster"
uri="http://192.168.11.6:4998/screenmirroring?ts=1627150215328"
width="1080"
height="720"
translation="[0,0]" />

<Timer
id = "exampleTimer"
repeat = "true"
duration = "0.03" />

</children>

</component>