Documentation? sure! 😉
In the video player SDK example - AppDetailScreen.brs - probably in RefreshShoeDetail since that is called first when the screen is initialized, you already have
screen.AddButton(1, "resume playing")
screen.AddButton(2, "play from beginning")
You might want to add a third button with a number 3 there for "Add to Top Ten"
In the same file for showDetailScreen - which has the input loop for that section, you have a part which says -
else if msg.isButtonPressed()
print "ButtonPressed"
print "ButtonPressed"
if msg.GetIndex() = 1
You can delete the prints, since those are debug. The index of the button you added would be #3 - and have it call a dialog window to add to the top ten category.
The code for dialogs is in generaldlgs.brs
Generalutils.brs has these routines in it
Function RegRead(key, section=invalid)
if section = invalid then section = "Default"
sec = CreateObject("roRegistrySection", section)
if sec.Exists(key) then return sec.Read(key)
return invalid
End Function
Function RegWrite(key, val, section=invalid)
if section = invalid then section = "Default"
sec = CreateObject("roRegistrySection", section)
sec.Write(key, val)
sec.Flush() 'commit it
End Function
Function RegDelete(key, section=invalid)
if section = invalid then section = "Default"
sec = CreateObject("roRegistrySection", section)
sec.Delete(key)
sec.Flush()
End Function
To use those you could say something like RegRead ("NumberofFavorites","Favorites")
One name/value pair per key.
You can have it read keys as soon as your channel initializes, in app main for your channel, so they would populate from those keys to create the content list of the favorites category, and you could add code within the favorites category display to remove items that are selected from the favorites list too, or in the detail screen, whichever is easier. If you are concerned about limitations of keys in the roku flash ram, then you might also consider the server route. If yoiu already have a streaming server with a database backend that you use for linking and registration, then you could simply have the server send the user's favorites to them every time the channel is opened when you check to see if they are authorized users via serial number and verifying their account info on your server. Look at the registration and linking sample SDK code for that.