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

Server Side Script

I have asked this question several time but in a different way and have not had any success. Let me try one more time. How can I start a server side script when a channel is selected to stream. I know it has something to do with urlTransfer but I am not completely sure of how to write it and at what location in the brs file to place it so the script is started just before the stream is called. Please don't reply with jus read the sdk or urlTransfer.
0 Kudos
5 REPLIES 5
RokuMarkn
Visitor

Re: Server Side Script

The way to make a GET query to a script would be something like

xfer = CreateObject("roUrlTransfer")
xfer.SetMessagePort(port) ' assuming port has already been created
xfer.SetUrl(your_url)
response = xfer.GetToString()

As for where to put it, that depends on how you wrote your code. It would be before you call Play on the video player or video screen you're using.

--Mark
0 Kudos
btpoole
Channel Surfer

Re: Server Side Script

Excellent, thank you Markn
0 Kudos
btpoole
Channel Surfer

Re: Server Side Script

Is there any type of interface for urlTransfer (like GetToString) that will let the code continue to step without a return value from the script. The server side script does not produce any return information, it will continue to run until it is terminated and it produces no return value to the urlTransfer interface so the next line of code (screen.show ()) does not process. Once I press the play button, the script starts but not until I manually stop the script does the code continue.
Thanks again
0 Kudos
RokuMarkn
Visitor

Re: Server Side Script

AsyncGetToString.

Could you explain why you weren't able to find this in the docs yourself? We want to make the docs as easy to use as possible, and I would have thought that once you were directed to GetToString you would have been able to find AsyncGetToString.

--Mark
0 Kudos
btpoole
Channel Surfer

Re: Server Side Script

Thank you for you direction you have been most helpful.
If it is the intention to make the docs as easy to use as possible, you may add some examples. Looking up AsyncGetToString in the sdk only describes the interface without showing how it maybe used. What may seem obvious to some may not be so to others. This applies when one uses a tool on a daily basis while another may not.
Thanks again for the help.
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.