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: 
ccaines
Binge Watcher

Sending data to remote database after SceneGraph application is launched

I am using the SceneGraph sample "Simple Grid with Details and Video" with separate main and component scripts. My objective is to send data to a remote database after the video player stops playing.  Is this possible? Can someone reply with a example script?
Brightscript linitations:
1) roUrlTransfer can only be used in a Task node
2) roMessagePort can only be used when the SceneGraph application is launched (main.br)

Here is what I have so far. I connect to the database in main.br 

Sub ConnectToDatabase() As Object
   db = CreateObject("roUrlTransfer") 'This can only be used in a Task node
    DBport = CreateObject("roMessagePort") 'This can only be used when the SceneGraph application is launched
    db.SetPort(DBport)
    db.SetUrl("http://..post.php")
    return db
End Sub

and then transfer db as an object to DetailScreen.br after the viewer stops the video player.

db.PostFromString("session=postPgmStats&pgmId=1G060720170234&deviceId="+devESN+"&playStart=000000&playEnd=58966")

This doesn't work. I get the following error.
'Dot' Operator attempted with invalid BrightScript Component or interface reference. (runtime error &hec) in pkg:/components/screens/DetailsScreen/DetailsScreen.brs

Please help.
0 Kudos