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: 
PositivePeak
Visitor

(INSTANT $75 today for help) roImageCanvas & roSlideShow

Is it possible to over lay a transparent png on roImageCanvas over the roSlideShow component? I am trying to overlay a graphic on the DeviantArt example. The best I can get is that when I put the meta info in the Slideshow subs and call for the (roImage).Show() command, it locks up the slideshow. I am also stumped as how to randomize the slideshow.... may have to rename the filenames each night... any ideas as how to make it work would be so appreciated - been working on it for a week now...

See code below.... any help you can offer would be greatly appreciated.


Function CreateMediaRSSConnection()As Object
rss = {
port: CreateObject("roMessagePort"),
http: CreateObject("roUrlTransfer"),

DisplayAbigail: DisplayAbigail,
DisplayAnimal: DisplayAnimal,
DisplaySurfside: DisplaySurfside,
DisplayiCountry: DisplayiCountry,
DisplayA1R: DisplayA1R,
DisplayA1A: DisplayA1A,
DisplaySlideShow: DisplaySlideShow,
GetPhotoListFromFeed: GetPhotoListFromFeed,
}

return rss
End Function

Function DisplaySetup(port as object)
slideshow = CreateObject("roSlideShow")
slideshow.SetMessagePort(port)
slideshow.SetUnderscan(5.0) ' shrink pictures by 5% to show a little bit of border (no overscan)
slideshow.SetBorderColor("#000000")
slideshow.SetMaxUpscale(8.0)
slideshow.SetDisplayMode("best-fit")
slideshow.SetPeriod(8)
slideshow.Show()
return slideshow
End Function



Sub DisplayAbigail()
blackCanvas = CreateObject( "roImageCanvas" )
audio = CreateObject("roAudioPlayer")
item = CreateObject("roAssociativeArray")
item.Url = "[station stream address]"
item.StreamFormat = "mp3"
audio.AddContent(item)
blackCanvas.SetLayer( 0, { Color: "#000000", TargetRect: { x: 0, y: 0, w: 1280, h: 720 } } )
blackCanvas.Show()
canvasItems = [{ url:"[pic address]"
TargetRect:{x:935,y:05,w:350,h:262}
},
{ url:"[pic address]"
TargetRect:{x:35,y:01,w:350,h:262}
},
{ Text:"[shoutcast XML song parse address]"
TextAttrs:{Color:"#FFCCCCCC", Font:"Large",
HAlign:"HCenter", VAlign:"VCenter",
Direction:"LeftToRight"}
TargetRect:{x:60,y:379,w:450,h:50}
},
]
logocanvas = CreateObject("roImageCanvas")
slideshow = DisplaySetup(m.port)
logoport = CreateObject("roMessagePort")
logocanvas.SetMessagePort(m.logoport)
logocanvas.AllowUpdates(true)
'Set opaque background
logocanvas.SetLayer(5, {CompositionMode:"Source"})
logocanvas.SetRequireAllImagesToDraw(true)
logocanvas.SetLayer(6, canvasItems)
audio.Play()
photolist=m.GetPhotoListFromFeed("[pic XML address]")
m.DisplaySlideShow(logocanvas, slideshow, photolist)
End Sub



Sub DisplayAnimal()
blackCanvas = CreateObject( "roImageCanvas" )
audio = CreateObject("roAudioPlayer")
item = CreateObject("roAssociativeArray")
item.Url = "[station stream address]"
item.StreamFormat = "mp3"
audio.AddContent(item)
blackCanvas.SetLayer( 0, { Color: "#000000", TargetRect: { x: 0, y: 0, w: 1280, h: 720 } } )
blackCanvas.Show()
audio.Play()
slideshow = DisplaySetup(m.port)
photolist=m.GetPhotoListFromFeed("[pic XML address]")
m.DisplaySlideShow(slideshow, photolist)
End Sub

Sub DisplaySurfside()
blackCanvas = CreateObject( "roImageCanvas" )
audio = CreateObject("roAudioPlayer")
item = CreateObject("roAssociativeArray")
item.Url = "[station stream address]"
item.StreamFormat = "mp3"
audio.AddContent(item)
blackCanvas.SetLayer( 0, { Color: "#000000", TargetRect: { x: 0, y: 0, w: 1280, h: 720 } } )
blackCanvas.Show()
audio.Play()
slideshow = DisplaySetup(m.port)
photolist=m.GetPhotoListFromFeed("[pic XML address]")
m.DisplaySlideShow(slideshow, photolist)
End Sub

Sub DisplayiCountry()
blackCanvas = CreateObject( "roImageCanvas" )
audio = CreateObject("roAudioPlayer")
item = CreateObject("roAssociativeArray")
item.Url = "[station stream address]"
item.StreamFormat = "mp3"
audio.AddContent(item)
blackCanvas.SetLayer( 0, { Color: "#000000", TargetRect: { x: 0, y: 0, w: 1280, h: 720 } } )
blackCanvas.Show()
audio.Play()
slideshow = DisplaySetup(m.port)
photolist=m.GetPhotoListFromFeed("[pic XML address]")
m.DisplaySlideShow(slideshow, photolist)
End Sub

Sub DisplayA1R()
blackCanvas = CreateObject( "roImageCanvas" )
audio = CreateObject("roAudioPlayer")
item = CreateObject("roAssociativeArray")
item.Url = "[station stream address]"
item.StreamFormat = "mp3"
audio.AddContent(item)
blackCanvas.SetLayer( 0, { Color: "#000000", TargetRect: { x: 0, y: 0, w: 1280, h: 720 } } )
blackCanvas.Show()
audio.Play()
slideshow = DisplaySetup(m.port)
photolist=m.GetPhotoListFromFeed("[pic XML address]")
m.DisplaySlideShow(slideshow, photolist)
End Sub

Sub DisplayA1A()
blackCanvas = CreateObject( "roImageCanvas" )
audio = CreateObject("roAudioPlayer")
item = CreateObject("roAssociativeArray")
item.Url = "[station stream address]"
item.StreamFormat = "mp3"
audio.AddContent(item)
blackCanvas.SetLayer( 0, { Color: "#000000", TargetRect: { x: 0, y: 0, w: 1280, h: 720 } } )
blackCanvas.Show()
audio.Play()
slideshow = DisplaySetup(m.port)
photolist=m.GetPhotoListFromFeed("[pic XML address]")
m.DisplaySlideShow(slideshow, photolist)
End Sub


Function GetPhotoListFromFeed(feed_url) As Object
print "GetPhotoListFromFeed: ";feed_url
m.http.SetUrl(feed_url)
xml=m.http.GetToString()
rss=CreateObject("roXMLElement")
if not rss.Parse(xml) then stop
print "rss@version=";rss@version

pl=CreateObject("roList")
for each item in rss.channel.item
pl.Push(newPhotoFromXML(m.http, item))
print "photo title=";pl.Peek().GetTitle()
next
return pl

End Function


Function newPhotoFromXML(http As Object, xml As Object) As Object
photo = {http:http, xml:xml, GetURL:pGetURL}
photo.GetTitle=function():return m.xml.title.GetText():end function
return photo
End Function


Function pGetURL()
for each c in m.xml.GetNamedElements("mediacontent")
if c@medium="image" then return c@url
next

return invalid
End Function


Sub DisplaySlideShow(logocanvas, slideshow, photolist)
print "in DisplaySlideShow"
'using SetContentList()
contentArray = CreateObject("roArray", photolist.Count(), true)
for each photo in photolist
print "---- new DisplaySlideShow photolist loop ----"
url = photo.GetURL()
if url<>invalid then
aa = CreateObject("roAssociativeArray")
aa.Url = url
contentArray.Push(aa)
print "PRELOAD TITLE: ";photo.GetTitle()
end if
next


slideshow.SetContentList(contentArray)

'this is an alternate technique for adding content using AddContent():
'aa = CreateObject("roAssociativeArray")
'for each photo in photolist
' print "---- new DisplaySlideShow photolist loop ----"
' url = photo.GetURL()
' if url<>invalid then
' aa.Url = url
' slideshow.AddContent(aa)
' print "PRELOAD TITLE: ";photo.GetTitle()
' end if
'next


btn_more_from_author = 0
btn_similar = 1
btn_bookmark = 2
btn_hide = 3
waitformsg:
msg = wait(0, m.port)
print "DisplaySlideShow: class of msg: ";type(msg); " type:";msg.gettype()
'for each x in msg:print x;"=";msg[x]:next
if msg <> invalid then 'invalid is timed-out
if type(msg) = "roSlideShowEvent" then
if msg.isScreenClosed() then
return
else if msg.isButtonPressed() then
print "Menu button pressed: " + Stri(msg.GetIndex())
'example button usage during pause:
'if msg.GetIndex() = btn_hide slideshow.ClearButtons()
else if msg.isPlaybackPosition() then
onscreenphoto = msg.GetIndex()
print "slideshow display: " + Stri(msg.GetIndex())
else if msg.isRemoteKeyPressed() then
print "Button pressed: " + Stri(msg.GetIndex())
else if msg.isRequestSucceeded() then
print "preload succeeded: " + Stri(msg.GetIndex())
elseif msg.isRequestFailed() then
print "preload failed: " + Stri(msg.GetIndex())
elseif msg.isRequestInterrupted() then
print "preload interrupted" + Stri(msg.GetIndex())
elseif msg.isPaused() then
print "paused"
'example button usage during pause:
'buttons will only be shown in when the slideshow is paused
'slideshow.AddButton(btn_more_from_author, "more photos from this author")
'slideshow.AddButton(btn_similar, "similar images")
'slideshow.AddButton(btn_bookmark, "mark as favorite")
'slideshow.AddButton(btn_hide, "hide buttons")
elseif msg.isResumed() then
print "resumed"
'example button usage during pause:
'slideshow.ClearButtons()
end if
end if
end if
goto waitformsg
End Sub
0 Kudos
21 REPLIES 21
kbenson
Visitor

Re: roImageCanvas & roSlideShow

You mind going back and throwing a [ code ] block around that? Makes it SO much easier to read with indentation, especially in a language without braces...

I could just quote it and code block it myself, but then this thread would start with two giant posts of the same data.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
PositivePeak
Visitor

Re: roImageCanvas & roSlideShow

Sure- sorry about that.

PS- sorry about the lack of indents in some of the code as well.. thank you so much for taking a look at this. Any help that you could provide would finally let us have a weekend off...
0 Kudos
PositivePeak
Visitor

Re: roImageCanvas & roSlideShow

parse
0 Kudos
PositivePeak
Visitor

Re: roImageCanvas & roSlideShow

If anyone has PayPal, I would send you a quick $50 bucks for a solution to this today. Please PM me the fixed code and your paypal email address & I will immediately send you the money.
0 Kudos
PositivePeak
Visitor

Re: (Quick $50 today for help) roImageCanvas & roSlideShow

No takers, huh. lol - well, don't make me break the bank and offer $60...
0 Kudos
PositivePeak
Visitor

Re: (Quick $50 today for help) roImageCanvas & roSlideShow

A quick solution is worth much more - we know. $75 hopefully will do it... if it is just a simple code rearrange. We hope so, we are avid students of the Roku but are hitting a brick wall on this one.

Notify us you can help and we'll notify this thread immediately as to not have anyone overlap or work for free.

Thank you for understanding and a solution toward making our channel better.
0 Kudos
PositivePeak
Visitor

Re: (INSTANT $75 today for help) roImageCanvas & roSlideShow

still open
0 Kudos
renojim
Community Streaming Expert

Re: (INSTANT $75 today for help) roImageCanvas & roSlideShow

I haven't really looked at your code, but why don't you just use an image canvas for the whole thing and forget the slide show component? Yes, it takes more work, but I think it will give you better results.

-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
PositivePeak
Visitor

Re: (INSTANT $75 today for help) roImageCanvas & roSlideShow

jim-

I would love to know how to do that. Do I just change the roSlideShow components to roImageCanvas?

dave
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.