if msg.isPlaybackPosition()
if not isSleeping
' do stuff
if ' ordered to sleep for 20s
isSleeping = true
sleepPeriod = 20
timer.Mark()
end if
else if timer.TotalSeconds() > sleepPeriod
isSleeping = false
end if
end if
while true
msg = wait(0, port)
if msg <> invalid
'*******************************
'Playback progress (in seconds):
else if msg.isPlaybackPosition() then
if not isSleeping
nowpos = msg.GetIndex()
print "Event type: "; msg.GetType()
print "Playback position: " + nowpos.toStr()
list.clear()
device.clear()
xml.clear()
if (device.overlay <> "") and (device.nextoverlay <> device.overlay) and ((device.timeleft < url.PositionNotificationPeriod) or (device.timeleft - 5 < url.PositionNotificationPeriod)) then
if device.overlayfontcolor <> ""
fadelevel = CreateObject("roByteArray")
fadelevel.fromhexstring(device.overlayfontcolor)
end if
'printaa(device)
overlaytimer = CreateObject("roTimespan")
overlaytimer.Mark()
while true
if overlaytimer.totalseconds() <= device.timeleft then
'********************
'***** Fade Out *****
'********************
if overlaytimer.totalseconds() > 4 then
tempRect = {x: device.overlayX, y: device.overlayY, w: device.overlayW, h:device.overlayH}
tempitems = {
CompositionMode: "Source"
Color: device.overlaycolor
Text: device.overlaytext
TextAttrs: { font: device.overlayfontsize, color: "#" + device.overlayfontcolor, HAlign : device.overlayfontHAlign, VAlign : device.overlayfontVAlign}
TargetRect: tempRect
}
tempcanvas.SetLayer(0, { url: device.overlayurl, Color: "#" + device.overlaycolor, CompositionMode: "Source" })
tempcanvas.SetLayer(1, tempitems)
tempcanvas.show()
'Print "Time left is " + device.timeleft.tostr()
sleep(1000)
elseif overlaytimer.totalseconds()<= 4 then
while fadelevel[0] > 10
'print "Fade level**********"
'print fadelevel[0]
'print "#" + fadelevel.tohexstring()
tempRect = {x: device.overlayX, y: device.overlayY, w: device.overlayW, h:device.overlayH}
tempitems = {
CompositionMode: "Source"
Color: "#" + fadelevel.tohexstring()
Text: device.overlaytext
TextAttrs: { font: device.overlayfontsize, color: "#" + fadelevel.tohexstring(), HAlign : device.overlayfontHAlign, VAlign : device.overlayfontVAlign}
TargetRect: tempRect
}
tempcanvas.SetLayer(0, { url: device.overlayurl, Color: "#" + device.overlaycolor, CompositionMode: "Source" })
tempcanvas.SetLayer(1, tempitems)
tempcanvas.show()
fadelevel[0] = fadelevel[0] - 4
'Print "Time left is " + device.timeleft.tostr()
sleep(39)
end while
sleep(1000)
'exit while
canvas.show()
sleep(device.timeleft + 8 * 1000)
end if
else
'********************
'***** Fade In *****
'********************
print overlaytimer.totalseconds().tostr()
if device.nextoverlay = ""
exit while
else 'if overlaytimer.totalseconds() >= device.timeleft + 3 then
fadelevel = CreateObject("roByteArray")
fadelevel.fromhexstring(device.nextoverlayfontcolor)
i = fadelevel[0]
fadelevel[0] = 0
while fadelevel[0] < (i - 2)
tempRect = {x: device.nextoverlayX, y: device.nextoverlayY, w: device.nextoverlayW, h:device.nextoverlayH}
tempitems = {
CompositionMode: "Source"
Color: device.nextoverlaycolor
Text: device.nextoverlaytext
TextAttrs: { font: device.nextoverlayfontsize, color: "#" + fadelevel.tohexstring(), HAlign : device.nextoverlayfontHAlign, VAlign : device.nextoverlayfontVAlign}
TargetRect: tempRect
}
tempcanvas.SetLayer(0, { url: device.nextoverlayurl, Color: device.nextoverlaycolor, CompositionMode: "Source" })
tempcanvas.SetLayer(1, tempitems)
tempcanvas.show()
fadelevel[0] = fadelevel[0] + 2
'i = i + 2
sleep(39)
end while
exit while
end if
end if
end while
elseif device.overlay <> "" then
tempRect = {x: device.overlayX, y: device.overlayY, w: device.overlayW, h:device.overlayH}
tempitems = {
CompositionMode: "Source"
Color: device.overlaycolor
Text: device.overlaytext
TextAttrs: { font: device.overlayfontsize, color: "#" + device.overlayfontcolor, HAlign : device.overlayfontHAlign, VAlign : device.overlayfontVAlign}
TargetRect: tempRect
}
tempcanvas.SetLayer(0, { url: device.overlayurl, Color: device.overlaycolor, CompositionMode: "Source" })
tempcanvas.SetLayer(1, tempitems)
tempcanvas.show()
else
tempcanvas.Clear()
canvas.Show()
end if
if device.status <> "OK"
Print "Status not OK. Stoping."
viewpost = "...."
http = NewHttp(viewpost)
http.PostFromStringWithTimeout(viewpost, 10)
'sleep(1000)
result = false
exit while
end if
end if
end if
end if
endif
end while
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. Read more here.
Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality.
In the meantime, for additional assistance, visit our Support Site.
We're sorry for this disruption — we’re excited to share what’s next!