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

Re: setadurl question

Maybe it is this part that is missing:
.
.
.
screen.SetAdURL(url, url)
screen.SetListNames(getCategoryList(category))
screen.SetContentList(getShowsForCategoryItem(category, m.curCategory))
screen.SetAdDisplayMode("scale-to-fit")
screen.SetAdSelectable(true)
screen.Show()
0 Kudos
newchannel
Roku Guru

Re: setadurl question

Hi bandal,

I just added it again to the posterscreen.brs. zipped, loaded to device, no images.

I took the url of pasted into browser and it shows. hit F5 and it changes. I copied and pasted it from the browser and then put in posterscreen.brs (the link to the php file).

Oh well, it's a learning experience...lol

I'll see what else I can come up with. Only thing I can think of is the posterscreen.brs may need to be changed like I sent you info on in the email.

Thanks to all that are helping.
http://www.victoryNOWfilmsandtv.com
0 Kudos
belltown
Roku Guru

Re: setadurl question

It could be that the request for the php script is failing. Once way to track that down would be to issue an asynchronous request, which would allow you to examine the http response code.

Put the following function before the showPosterScreenFunction:


Function getAdUrl (scriptUrl As String, timeout As Integer) As Object

ut = CreateObject ("roUrlTransfer")
port = CreateObject ("roMessagePort")
ut.SetPort (port)
ut.SetUrl (scriptUrl)

result = ut.AsyncGetToString ()
If result
While True
msg = Wait (timeout, port)
If Type (msg) = "roUrlEvent"
Print "AsyncGetToString: msg.GetResponseCode () = " + msg.GetResponseCode ().ToStr () + ". msg.GetFailureReason () = " + msg.GetFailureReason ()
If msg.GetResponseCode () = 200
Return msg.GetString ()
Else
Return Invalid
Endif
Else If Type (msg) = "Invalid"
Print "AsyncGetToString: timeout"
ut.AsyncCancel ()
Return Invalid
Else
Print "AsyncGetToString: Unknown event: " + Type (msg)
Endif
End While
Endif

Return Invalid

End Function


Then replace this code:


ut = CreateObject ("roUrlTransfer")
ut.SetUrl ("http://xxxxx.net/xxx/adverts/rotateads.php")
url = ut.GetToString ()
screen.SetAdURL(url, url)


with this code:


url = getAdUrl ("http://xxxxx.net/xxx/adverts/rotateads.php", 0)
if url <> Invalid
screen.SetAdURL(url, url)
else
print "Unable to retrieve ad url"
endif

The check the debugger output for a message that starts with "AsyncGetToString: msg.GetResponseCode () =" That will tell you the response from the server. It should be 200 (success). Anything else will indicate some kind of error condition.
0 Kudos
newchannel
Roku Guru

Re: setadurl question

Hi belltown,

I added the code you suggested and zipped and received the 200. Thanks for much for providing that code. I would not have know how to do that if you had not supplied it. That is a wonderful tool you shared.

After changing out my posterscreen.brs for another one, I was able to show ads and make them clickable to play video. Thanks bandal for helping with this portion. It works to show your ads and play my video link. If I change the url of the ad image to my own, the images again disappear. I once again went to the browser to test the url and it works only in the browser.

I've been checking the image urls in browser and the same link shows the actual image in the browser.

Anyway, that's the update. I'm just wondering if it has something to do with my server. I'm looking for a place to move my files to since the present location was just for temporary place until I could get more familiar with the build. i have a copy of my files from the server using ftp in case they shut me down. I had thought about that before and been keeping backups of my files from the server just in case.

Might be a good idea for me to test using a different server and see if my images will show. If they do then that will take care of the problem.

belltown and bandal...you both have gone beyond the norm to assist. Thanks so much again and thanks to all in the forum that have been also helping me along the way.

Best Regards.
http://www.victoryNOWfilmsandtv.com
0 Kudos
belltown
Roku Guru

Re: setadurl question

You could also try having your rotateads.php script return some different image urls for testing purposes.

I know that the following image urls work:

http://blog.roku.com/wp-content/uploads ... u-rear.jpg

and

http://blog.roku.com/wp-content/uploads ... /roku6.jpg

If it works then that means that your Roku channel code and your rotateads.php script are functioning correctly, and the problem lies with your server trying to serve up the images to your Roku, or a problem with the image files themselves that would prevent the Roku from displaying them.

It could be that your server has hotlink protection enabled, which is designed to prevent other web sites to link to your images. There should be a way you can turn this off for your server. If you're using cPanel there should be a 'Hotlink Protection' icon under 'Security'. When you click on it you should see a 'Disable' button that you can click to turn off hotlink protection.
0 Kudos
newchannel
Roku Guru

Re: setadurl question

Hi belltown,

I tried different images and they did not display.

I used posterscreen.brs of another persons that has their reference to their php file on their server and I am able to display their ads. Plus, I changed a link in another brs file they provided to one of my own videos files and the display ads rotated and were clickable and my own video link played.

So it must be my server location.

I was thinking perhaps the php script on my server has a problem but it is exactly the same as bandals, I just changed the image links to my own. And, when I do no images. But using no php script whatsoever, only using the setAdUrl reference on posterscreen.brs with image links, the image will display.

I did check the security and it says it's already disabled.

I checked the url to php again in browser and it still rotates upon F5 / enter

I typed the images url's into browser to see if the actual display image would show and worked.

I double checked the posterscreen.brs which I do have zipped and rechecked several times to make sure my url to the php file was added.

Leaving me to think server since all code in the php, and posterscreen.brs is the same as bandals and it all works until I reference my own the php location on my server with my images.



Best Regards.
http://www.victoryNOWfilmsandtv.com
0 Kudos
belltown
Roku Guru

Re: setadurl question

"newchannel" wrote:
I'm looking for a place to move my files to since the present location was just for temporary place until I could get more familiar with the build. i have a copy of my files from the server using ftp in case they shut me down. I had thought about that before and been keeping backups of my files from the server just in case.

A couple of options for free web hosts you could use are X10Hosting and FreeFTPSpace.

I think FreeFTPSpace is a more reliable, full-featured host, although X10Hosting is much faster. They're both good places to host your web sites, php scripts and databases if you need them. I wouldn't use them for hosting video files though, or for any kind of serious commercial applications. I actually have scripts hosted with both, plus another free host I'm considering dropping. My Roku code sends requests to the first host then automatically tries the others if it encounters any errors.
0 Kudos
belltown
Roku Guru

Re: setadurl question

Use the debugger to print the url returned from your call to getAdUrl, or immediately after the call to getAdUrl put a print statement:

print "****** Url: " + url
0 Kudos
bandal
Visitor

Re: setadurl question

belltown,

You mentioned above this post that you have code that can span more than 1 url if not available. Do you have that piece to share? I have video content on 2 servers, but pointing only to one in videoplayer. I do need to be able to have a backup if my main site is down to play video.

Thanks,

DA
0 Kudos
destruk
Streaming Star

Re: setadurl question

If your site is in the cloud (Amazon, Azure, etc etc) then you have built-in redundancy among at least 3 servers in case of failure. If not, then you'll need to check the header response for a 200, and if it fails, retry manually with your second or third server address.
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.