I want to see how it would be possible to select without having to wait to load all the movies
help pliss
If loading the movies is taking a long time, then your best bet is probably to make the web request asynchronously, so you’re not blocking the UI during the request.
and how it would have this function
jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL(URL()+"/movie.php?cat="+HttpEncode(category))
json = ParseJson(jsonAsString.GetToString())
return json.Videos
please help with this so we can select without having to wait to load the Seciones
please help want to select a movie without having to wait to load all content
my code GridScreen
Sub showMoviesScreen()
dlg = CreateObject("roOneLineDialog")
dlg.setTitle("Loading Collection")
dlg.showBusyAnimation()
dlg.show()
screen = CreateObject("roGridScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)
screen.SetGridStyle("flat-portrait")
screen.SetDescriptionVisible(true)
screen.SetBreadcrumbText("Movies", "Session")
categoryList = getCategoryListMovies()
categoryCount = categoryList.count()
seriesList = CreateObject("roList")
screen.SetupLists(categoryCount)
screen.ClearMessage()
screen.show()
screen.setListNames(categoryList)
for i = 0 to categoryCount-1
print "id = "; i; " categoria = "; categoryList[i]
contentList = getMoviesByCategory(categoryList[i])
seriesList[i] = contentList
screen.SetContentList(i,contentList)
screen.ClearMessage()
end for
screen.ClearMessage()
screen.show()
dlg.close()
clock = CreateObject("roTimespan")
next_call = clock.TotalMilliseconds() + 36000
while (true)
msg = wait(250, port)
if msg <> invalid and type(msg) = "roGridScreenEvent" then
if msg.isScreenClosed() then
exit while
else if msg.isStatusMessage()
mensaje = msg.getMessage()
status = msg.GetIndex()
else if msg.isPlaybackPosition()
nowpos = msg.GetIndex()
print "Tiempo conectado: "; nowpos
else if msg.isListItemFocused()
print "Focused msg: ";msg.GetMessage();"row: ";msg.GetIndex();
print " col: ";msg.GetData()
else if msg.isListItemSelected()
print "Selected msg: ";msg.GetMessage();"row: ";msg.GetIndex();
'selection = seriesList.GetEntry(msg.GetIndex())[msg.GetData()]
row = msg.GetIndex()
col = msg.GetData()
list = seriesList.GetEntry(msg.GetIndex())
if list <> invalid then
selection = list[msg.GetData()]
end if
if (row=0 and col=0) then
searchMovies()
else if (row=0 and col=1) then
FavoritesMovies()
else
'showSpringboardScreenMovies(list,selection)
showSpringboardScreenMovies(list,msg.GetData())
end if
else
print "Unexpected msg type: "; msg.GetType()
print "mensaje: "; msg.getMessage()
end if
end if
if clock.TotalMilliseconds() > next_call then
next_call = clock.TotalMilliseconds() + 36000
end if
end while
End Sub
Function getCategoryListMovies() as object
http = NewHTTP(ServidorRoku()+"/categorias.json")
http.AddParam("t", "peliculas")
response= http.GetToStringWithTimeout(90)
json = ParseJSON(response)
return json
End Function
Function getMoviesByCategory(category)
http = NewHTTP(ServidorRoku()+"/movie.json")
http.AddParam("cat", category)
response= http.GetToStringWithTimeout(90)
json = ParseJSON(response)
return json.Videos
End Function
any suggestions to achieve the goal I’m looking to selecionar without having to wait for all content carge
who can help me
To make the API requests asynchronously, you’ll basically need to use ifUrlTransfer.AsyncGetToString(), then listen for roUrlEvents in your event loop. Once you get the result back, you can then set the contents for the grid screen row(s).
Alternatively, you could opt to work with SceneGraph instead, and utilize the Task node for retrieving your content.
“TheEndless” wrote:
To make the API requests asynchronously, you’ll basically need to use ifUrlTransfer.AsyncGetToString(), then listen for roUrlEvents in your event loop. Once you get the result back, you can then set the contents for the grid screen row(s).Alternatively, you could opt to work with SceneGraph instead, and utilize the Task node for retrieving your content.
I’m using what I indicas file with urlUtils.brs but since continuous loading
I have not been able to solve in order to make open a movie without having to wait for it to load all
“TheEndless” wrote:
To make the API requests asynchronously, you’ll basically need to use ifUrlTransfer.AsyncGetToString(), then listen for roUrlEvents in your event loop. Once you get the result back, you can then set the contents for the grid screen row(s).Alternatively, you could opt to work with SceneGraph instead, and utilize the Task node for retrieving your content.
My friend could help with this please do not understand how to do it
someone could help me with this
