sdornan
14 years agoVisitor
Delay Category Feed Load
I'm trying to modify the showPosterScreen() function from the video player sample in the SDK for my app.
One thing I've noticed is that Roku will fetch the feed for a focused category even when the user is only focusing on that category on his/her way to another category. For example, if the user moves from category 1 to category 6, Roku fetches the feeds for categories 2 through 5 before the content for category 6 is displayed. This has a big negative effect on my app's performance.
Is there an easy way to delay the fetching of a category feed without it affecting the responsiveness of the UI? Perhaps only fetch the category if the user remains focused on the category for a second or something?
Thanks!
One thing I've noticed is that Roku will fetch the feed for a focused category even when the user is only focusing on that category on his/her way to another category. For example, if the user moves from category 1 to category 6, Roku fetches the feeds for categories 2 through 5 before the content for category 6 is displayed. This has a big negative effect on my app's performance.
Is there an easy way to delay the fetching of a category feed without it affecting the responsiveness of the UI? Perhaps only fetch the category if the user remains focused on the category for a second or something?
Thanks!
Function showPosterScreen(screen As Object) As Integer
if validateParam(screen, "roPosterScreen", "showPosterScreen") = false return -1
m.curCategory = 0
m.curShow = 0
initCategoryList()
categoryList = getCategoryList(m.Categories)
screen.SetListNames(m.CategoryNames)
screen.SetContentList(getShowsForCategoryItem(categoryList[m.curCategory]))
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent" then
print "showPosterScreen | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
if msg.isListFocused() then
m.curCategory = msg.GetIndex()
m.curShow = 0
'get the list of shows for the currently selected item
empty_list = CreateObject("roArray", 10, true)
screen.SetContentList(empty_list)
screen.ShowMessage("retrieving...")
screen.SetContentList(getShowsForCategoryItem(categoryList[msg.GetIndex()]))
screen.SetFocusedListItem(m.curShow)
print "list focused | current category = "; m.curCategory
else if msg.isListItemFocused() then
print "list item focused | current show = "; msg.GetIndex()
else if msg.isListItemSelected() then
m.curShow = msg.GetIndex()
print "list item selected | current show = "; m.curShow
m.curShow = displayShowDetailScreen(categoryList[m.curCategory], msg.GetIndex())
screen.setFocusedListItem(m.curShow)
else if msg.isScreenClosed() then
return -1
end if
end If
end while
End Function