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: 
hugetv
Visitor

problem in selecting a movie

I have 2 category and each realm has its movies but to the select category select 1 category 2 film film 1

This is the code that I have

Function CreateMovieMenu() as integer
screen = CreateObject("roGridScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)

screen.SetBreadcrumbText("Movie", "Full Menu")
screen.SetupLists(2)
screen.SetListNames(["Movie 1", "Movie 2"])

screen.SetContentList(0, GetMovieMenuOptions_Category_1())
screen.SetContentList(1, GetMovieMenuOptions_Category_2())
screen.show()

while (true)
msg = wait(0, port)
if type(msg) = "roGridScreenEvent"
if (msg.isScreenClosed())
return -1
else if (msg.isListItemSelected())
ShowMoviePlay(msg.GetData())
endif
endif

end while
End Function

Function GetMovieMenuOptions_Category_1() as object
m.options = [
{ Title: "Movie Test 1"
Description: "A Variety of Fresh Fruit"
HDPosterUrl:"pkg://images/fruit.jpg"
SDPosterUrl:"pkg://images/fruit.jpg"
Rating:"NR"
ReleaseDate:"2014"
Length: "5400"
Url: "http://dominio.com//movie.mp4"
}
{ Title: "Movie Test 2"
Description: "A Variety of Fresh Fruit"
HDPosterUrl:"pkg://images/fruit.jpg"
SDPosterUrl:"pkg://images/fruit.jpg"
Rating:"NR"
ReleaseDate:"2014"
Length: "5400"
Url: "http://dominio.com//movie.mp4"
}
{ Title: "Movie Test 3"
Description: "A Variety of Fresh Fruit"
HDPosterUrl:"pkg://images/fruit.jpg"
SDPosterUrl:"pkg://images/fruit.jpg"
Rating:"NR"
ReleaseDate:"2014"
Length: "5400"
Url: "http://dominio.com//movie.mp4"
}
]
return m.options
End Function

Function GetMovieMenuOptions_Category_2() as object
m.options = [
{ Title: "Movie Test 1"
Description: "A Variety of Fresh Fruit"
HDPosterUrl:"pkg://images/fruit.jpg"
SDPosterUrl:"pkg://images/fruit.jpg"
Rating:"NR"
ReleaseDate:"2014"
Length: "5400"
Url: "http://dominio.com//movie.mp4"
}
{ Title: "Movie Test 2"
Description: "A Variety of Fresh Fruit"
HDPosterUrl:"pkg://images/fruit.jpg"
SDPosterUrl:"pkg://images/fruit.jpg"
Rating:"NR"
ReleaseDate:"2014"
Length: "5400"
Url: "http://dominio.com//movie.mp4"
}
{ Title: "Movie Test 3"
Description: "A Variety of Fresh Fruit"
HDPosterUrl:"pkg://images/fruit.jpg"
SDPosterUrl:"pkg://images/fruit.jpg"
Rating:"NR"
ReleaseDate:"2014"
Length: "5400"
Url: "http://dominio.com//movie.mp4"
}
]
return m.options
End Function

Function ShowMoviePlay(index as integer) as integer
' prueba de play video
videoScreen = CreateObject("roVideoScreen")
port = CreateObject("roMessagePort")
videoScreen.SetMessagePort( port )
metaData = {
ContentType: "episode",
title: m.options[index].Title,
streamFormat: "mp4",
stream: {
Url: m.options[index].Url
}
}
videoScreen.SetContent( metaData )
videoScreen.show()

while (true)
msg = wait(0, port)
if type(msg) = "roVideoScreenEvent"
if (msg.isScreenClosed()) '<BACK>
return -1
end if
endif
end while
End Function
Our system http://www.rokumanager.com
0 Kudos
3 REPLIES 3
RokuJoel
Binge Watcher

Re: problem in selecting a movie

Hi, I am unable to understand most of the questions you are posting. Rather than using Google Translate to post questions, please post in your native language, which I believe is Spanish, and I will find someone to translate your questions. I'm sure a few developers here speak Spanish as well.

- Joel
0 Kudos
hugetv
Visitor

Re: problem in selecting a movie

ok tengo problema al tratar de darle play a la pelicula solo funciona la ultima categoria
Our system http://www.rokumanager.com
0 Kudos
destruk
Streaming Star

Re: problem in selecting a movie

"hugetv" wrote:
I have 2 category and each realm has its movies but to the select category select 1 category 2 film film 1


I think the problem is the gridscreen you are using requires a multidimensional array.
First, for testing, you should use unique data so you can check your results -
rather than having both categories as Movie Test 1, Movie Test 2, and Movie Test 3 for both categories, change the names to
Movie Test 1,1 Movie Test 1,2 Movie Test 1,3
Movie Test 2,1 Movie Test 2,2 Movie Test 2,3

It will help with troubleshooting, if needed.
In the gridscreen/selection routine - the wait loop where the user can scroll around and choose an item to play, use isListItemFocused to store the value of what is currently highlighted.
Initialize the row as 0 and the column as 0
If msg.isListItemFocused()
row=msg.GetIndex()
col=msg.GetData()
Print"Focused msg: ";msg.GetMessage();"row: ";row;
Print" col: ";col

GetIndex() is the row, and GetData() is the column. Using this data you can tell what video to play if the user selects the currently highlighted item.

In the same loop for the gridscreen, use If msg.isListItemSelected() to handle passing control to another screen (either a springboard screen or video playback screen of your choice) and send the information for the item along with the call to the new screen.
If msg.isListItemSelected()
PlayVideoScreen(row,col)

It's easier if you have a master list of content for the entire screen, before setting the content itself - because then you can refer back to that when calling the next screen.
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.