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: 
newchannel
Roku Guru

Star Rating...movie and clickable

Anyone willing to share how to move the star rating up near the play button/resume playing area and make it clickable so it works?
http://www.victoryNOWfilmsandtv.com
0 Kudos
11 REPLIES 11
RokuChris
Roku Employee
Roku Employee

Re: Star Rating...movie and clickable

The static rating and the rating button are two different things. Take a look at the AddRatingButton() function for roSpringboardScreen
0 Kudos
newchannel
Roku Guru

Re: Star Rating...movie and clickable

Okay, I will.

Thank you.
http://www.victoryNOWfilmsandtv.com
0 Kudos
newchannel
Roku Guru

Re: Star Rating...movie and clickable

I found the following:

AddRatingButton(Integer id, String userRating,
String aggregateRating)

But not sure where it is to be placed within the code on the detailscreen? Do I change the info inside the () or leave as is? Still learning here...

Thank you
http://www.victoryNOWfilmsandtv.com
0 Kudos
newchannel
Roku Guru

Re: Star Rating...movie and clickable

Anyone available to help me along on this part? Need to have a rating button up near the play button. This is another one of the channel build pieces that I don't get yet.
http://www.victoryNOWfilmsandtv.com
0 Kudos
destruk
Streaming Star

Re: Star Rating...movie and clickable

Your AddRatingButton types are incorrect.

You have three commands to deal with (minus Thumbs buttons, because you're not asking about those 🙂 )-
AddButton(Integer id, String title) ' this one is used for Play, Resume, Loop, and your standard usual buttons - it's also the same on the springboard as for dialog boxes - you should already have some of these
AddRatingButton(Integer id, Integer userRating, Integer aggregateRating) ' This is the 5 star 'rating' button you are asking for - it is used on the Netflix details screen with automatic control of 'liked it'
SetStaticRatingEnabled(Boolean isEnabled) 'This controls display of the static rating information for the content item and shows up near the synopsis of the content item - the user can't change the value directly for these stars
The star rating can show either community StarRating (red) or UserStarRating (yellow). If both values are set, the control will display the UserStarRating.

So, when setting up your screen, usually the setstaticrating is set to False to allow more room for actors - if it's true and no value is set, then you see 5 empty stars for it when the user rating is 0 or unset. If it is set, it duplicates the user rating value (0-100). If you're not using the user rating at all, then the static rating shows the community rating (average). You'll need to play with it to understand more.

On your springboard screen, buttons are placed in the order they appear, - where screen is your handle for the current display screen
screen.AddButton(1, "Play/Resume")
screen.AddButton(2, "Play from Beginning")
screen.AddRatingButton(3, 0, 50) ' sets button 3 to a user rating of 0 for unrated by the current user, and 50 for the baseline - 50 being the 'average of all user ratings so far'

When button 3 is clicked, you will want to send the value to the server database to log the user selected value, and then average all the values for the content item to return future versions of the xml containing the result to users accessing this page so the 'aggregateRating' is current. - so the 50 value could just as easily be changed to something like screen.AddRatingButton(3, show.currentuserrating, show.userstarratingaverage) to be referencing the content's xml information to populate.

You'll need to handle that like you handle the other buttons and server interaction for your channel.
0 Kudos
360tv
Streaming Star

Re: Star Rating...movie and clickable

I have a question about the last post in this thread.

The item.UserRating is giving me trouble when I put in showList[showIndex].starrating, which contains the values I want, it gives me a type miss match.

same if I do

srating = showList[showIndex].starrating
screen.ClearButtons()
if regread(show.contentid) <> invalid and regread(show.contentid).toint() >=30 then
screen.AddButton(1, "Resume playing")
screen.AddButton(2, "Play from beginning")
screen.AddRatingButton(3, 0, srating)


if I "print srating" or "print showList[showIndex].starrating" it gives me a number.
So I'm trying to get something in my AddRatingButton that won't crash with a type miss match.
0 Kudos
destruk
Streaming Star

Re: Star Rating...movie and clickable

In the debugger print the type of the variable value. Most likely you have it reading as xml as a string when it needs to be an integer.
0 Kudos
360tv
Streaming Star

Re: Star Rating...movie and clickable

So for anyone reading this thread who needs to know what I did to get this working, I used;

screen.AddRatingButton(3, 0, strtoi(showList[showIndex].starrating))


where strtio() converts a string to an integer. A function I spent all day tracking down, since I could not find it in any of the SDK documentation anywhere.
0 Kudos
renojim
Community Streaming Expert

Re: Star Rating...movie and clickable

I've never seen that function. You could have used showList[showIndex].starrating.toInt().

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