So I'm in the process of recreating my channel that used to be Direct Publisher, and so far it's going great. I have my feed being read correctly and managed by a grid, with video play back. Great. Then I find out I have to implement Deep Linking.
I'm directly using the example code out of scenegraph-master-sample/DeepLinking, but I need some help debugging. I try to curl into my site as described in the docs, and it always just drops me on my main screen.
If I try dropping breadcrumbs in the main.brs, it looks like nothing ever comes back from my "wait" function:
? "Starting Event Loop"
while(true)
' waiting for events from screen
? "Waiting"
? m
msg = wait(0, m.port)
? "msg="
? msg
msgType = type(msg)
...
So in code like this snippet I'd see "Starting Event Loop", then "Waiting" and a dump of the m variable...but then, nothing. I run the curl, the app basically just starts over and spits out the same things. I never see "msg=".
Am I misunderstanding how that wait function works? I would think that maybe my app is terminated prematurely, but there's no output to that effect and it doesn't ever show any of my fallthrough breadcrumbs, either.
In the manifest I have supports_input_launch=1. Is there anything else at the app level I needed to updateto get input events flowing? I'll note that my app continues to work -- I can browse the grid and continue to play videos just fine.
Is m.port assigned to the roInput object you created? In that example, the pertinent lines are:
m.port = CreateObject("roMessagePort")
inputObject=createobject("roInput")
inputObject.setmessageport(m.port)
I haven't tried to run the example as is, but I can execute the lines in the debugger:
Brightscript Debugger> inputObject=createobject("roInput")
Brightscript Debugger> port = CreateObject("roMessagePort")
Brightscript Debugger> inputObject.setmessageport(port)
Brightscript Debugger> msg=wait(0,port)
Then I execute the curl command:
curl -d "" "http://192.168.0.191:8060/input/dev?contentId=1234&mediaType=movie"
Result:
Brightscript Debugger> ?msg.getinfo()
<Component: roAssociativeArray> =
{
contentId: "1234"
mediaType: "movie"
source_ip_addr: "192.168.0.118"
}
If you have all of the pieces and you're not getting the wait to return I would suspect something about the curl command.
"I try to curl into my site"? What do you mean by that? You should be using the Roku device's IP address in the curl. Is this the example you're following?
Yes, I'm curling into the IP of my device, sorry for the confusion. And that is the correct example that I've been using. I guess my question put another way is, if I were to trace or breadcrumb that entire example, and then execute that curl command, what's the flow? What happens after we hit that wait() statement? Because it seems like I'm just getting a dead end and I'm not sure how to proceed.
Is m.port assigned to the roInput object you created? In that example, the pertinent lines are:
m.port = CreateObject("roMessagePort")
inputObject=createobject("roInput")
inputObject.setmessageport(m.port)
I haven't tried to run the example as is, but I can execute the lines in the debugger:
Brightscript Debugger> inputObject=createobject("roInput")
Brightscript Debugger> port = CreateObject("roMessagePort")
Brightscript Debugger> inputObject.setmessageport(port)
Brightscript Debugger> msg=wait(0,port)
Then I execute the curl command:
curl -d "" "http://192.168.0.191:8060/input/dev?contentId=1234&mediaType=movie"
Result:
Brightscript Debugger> ?msg.getinfo()
<Component: roAssociativeArray> =
{
contentId: "1234"
mediaType: "movie"
source_ip_addr: "192.168.0.118"
}
If you have all of the pieces and you're not getting the wait to return I would suspect something about the curl command.
Thank you for the patient steps. Turns out my problem was that case sensitivity was getting in my way in places I did not see -- I was passing in curl params like MediaType and contentID, while the code is all pretty specific to mediaType and contentId. This (among other things) was causing a lot of my comparison logic to fail. But once I unwound it I started making some real progress.