Any suggestions on how to get started with Bright Script? I’ve been hacking around for a week or so and trying to figure out how to do a one-shot program:
parse the xml that is returned from that request for a particular key containing a URL
issue an http request for that URL
call an audio or video player to play that URL (this might be one and the same as #3)
exit.
I’ve been trying to hack the flickr example to figure this out, but I just don’t know enough. If anyone would be so kind as to point me to , or post a good example of how to do this in a short program?
I’m sort of a hybrid newbie and experienced person at programming - my background in LotusScript (said to be kinda like Visual Basic) programming gives me some help in reading the example Brightscripts, but I would like to see some examples, even one-liners of each of the above types of internet communication.
If you’re dealing with audio or video, the flickr example is probably not the best one to be working from. The audioapp and simplevideoplayer examples may be more helpful. The steps you outline are very common tasks for almost any channel. This code would work for video content. Audio would be handled differently using roAudioPlayer.
' 1. send a request to an api service with a user code
xfer = CreateObject("roURLTransfer")
xfer.SetURL("http://api.something.com/category?=consumercode=myappsconsumercode")
xferResult = xfer.GetToString()
' 2. parse the xml that is returned from that request for a particular key containing a URL
xml = CreateObject("roXMLElement")
if xml.Parse(xferResult)
contentURL = xml.contentURL.GetText() ' this line will change based on the structure of your XML
end if
' 4. call an audio or video player to play that URL (this might be one and the same as #3)
screen = CreateObject("roVideoScreen")
screen.SetMessagePort(CreateObject("roMessagePort"))
screen.SetContent({
stream: {
url: contentURL
}
streamFormat: "mp4"
})
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if msg <> invalid
if msg.isScreenClosed()
exit while
end if
end if
end while