jf-roku/source/Main.brs

40 lines
984 B
Plaintext
Raw Normal View History

2019-01-30 04:19:27 +00:00
sub Main()
'Indicate this is a Roku SceneGraph application'
2019-01-31 04:56:15 +00:00
globals()
2019-01-30 04:19:27 +00:00
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
2019-01-31 04:56:15 +00:00
'todo - pick the scene based on if we need a server already
first_scene = "ServerSelect"
2019-01-30 14:59:27 +00:00
'Create a scene and load a component'
2019-01-31 04:56:15 +00:00
m.scene = screen.CreateScene("VideoScene")
2019-01-30 04:19:27 +00:00
screen.show()
get_token(get_var("username"), get_var("password"))
' For now, just play whatever is the first item in the list
' of the first folder
libs = LibraryList().items
items = ItemList(libs[0].Id).items
n = Rnd(10)
movie_id = items[n-1].Id
player = VideoPlayer(movie_id)
2019-01-31 04:56:15 +00:00
2019-01-30 04:19:27 +00:00
while(true)
msg = wait(0, m.port)
msgType = type(msg)
if msgType = "roSGScreenEvent"
if msg.isScreenClosed() then return
end if
end while
end sub
2019-01-31 04:56:15 +00:00
function get_var(key as String)
return GetGlobalAA().Lookup(key)
end function