bbakernc
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2011
05:06 AM
Favorite Catagory
Does anybody have aby sample code to add a favorite catagory?
When you first enter in to my channel, I might have 50 selections. I want to add the first selection as my favorite or even last viewed.
Is this built in to the Roku SDK or does the Player "post" back to our servers and and we store this?
When you first enter in to my channel, I might have 50 selections. I want to add the first selection as my favorite or even last viewed.
Is this built in to the Roku SDK or does the Player "post" back to our servers and and we store this?
4 REPLIES 4
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2011
11:49 AM
Re: Favorite Catagory
It'd be simplistic to add a button to the detail screen for 'add to favorites'. Probably below the resume and play from beginning buttons. You could even store the value in the roku's own registry with a limit of say a top 10 content index list with RegWrite. Or you could add another get request to have your server (generating the category and content xml) create the user's favorites based on the box serial number linked to their account. Those are the two ways that come to mind for me.
bbakernc
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2011
12:06 PM
Re: Favorite Catagory
Sounds good, have you seen any documention on either of these two ways?
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2011
05:22 PM
Re: Favorite Catagory
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.
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.
bbakernc
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2011
05:39 PM
Re: Favorite Catagory
This is GREAT......
I will have to figure out where to put this.......
I am build my channel with "sub-channels" simular to Roku News channel. My viewers can select my channel and there might be 30 sub-channels displied, so that is where I need to use the "favorite" button. So I guess the 'SAVE' button would have to be where I display catagories and videos to watch.
THANKS
I will have to figure out where to put this.......
I am build my channel with "sub-channels" simular to Roku News channel. My viewers can select my channel and there might be 30 sub-channels displied, so that is where I need to use the "favorite" button. So I guess the 'SAVE' button would have to be where I display catagories and videos to watch.
THANKS