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: 
RokuKC
Roku Employee
Roku Employee

Re: ECP (port 8060) not working

"EnTerr" wrote:
"RokuKC" wrote:

https://sdkdocs.roku.com/display/sdkdoc ... PressTime()asVoid

That function was just added to docs 29 April but does not mention firmware version. What fw is it applicable to?


roAppManager UpdateLastKeyPressTime is present on all active (non-legacy) firmware versions.
0 Kudos
ljunkie
Visitor

Re: ECP (port 8060) not working

"RokuKC" wrote:
"ljunkie" wrote:

1. The roVideoPlayer/roVideoScreen used to reset the idle time every 10 seconds. This no longer happens in 7.1. Can this be corrected?


I can file a report, but it might help to have more information, as I haven't heard of this issue being reported by anyone else.


We use `roDeviceInfo.TimeSinceLastKeypress()` to fire off various events, and it caused a nasty bug when this wasn't reset during video playback. The probably for us is fixable on our side, now that you have mentioned we can reset this on all current gen devices with `roAppManager.UpdateLastKeyPressTime()`.

"RokuKC" wrote:
"ljunkie" wrote:

2. Is there a valid way to tell the Roku it's not idle from within a channel. The ECP method was the only way, and as I take it will never work again going forward unless the Roku uses an RFC 1918 IP address. One example to clarify why this is important: A custom slide show written in an roScreen, or even roImageCanvas. Without a way to reset the idle time during playback, the Roku will initialize the the (black) screensaver rendering it useless.


We've documented a function in roAppManager which is UpdateLastKeyPressTime() that can be used to defer the screensaver activation.
Calling this should be preferred over the ECP fake keypress technique.

https://sdkdocs.roku.com/display/sdkdoc ... PressTime()asVoid


Thank you! That fixes our issue. Appreciate the info. I really am curious how many other undocumented features there? e.g. `roAppManager.GetScreensaverTimeout()`
0 Kudos
rjdjohnston
Binge Watcher

Re: ECP (port 8060) not working

Anyone have an example implementation of UpdateLastKeyPressTime()?

Thanks
My channels: Amiri King, Donnie Baker, Worldview Weekend - Twitter @rjdjohnston
0 Kudos
ljunkie
Visitor

Re: ECP (port 8060) not working

"rjdjohnston" wrote:
Anyone have an example implementation of UpdateLastKeyPressTime()?

Thanks


Here is a really basic example of it working, showing you that the Roku was idle for 71 seconds and was reset back to 0 by calling UpdateLastKeyPressTime().


BrightScript Debugger> am = CreateObject("roAppManager")
BrightScript Debugger> di = CreateObject("roDeviceInfo")
BrightScript Debugger> ?di.TimeSinceLastkeyPress()
71
BrightScript Debugger> am.UpdateLastKeyPressTime()
BrightScript Debugger> ?di.TimeSinceLastkeyPress()
0
0 Kudos
EnTerr
Roku Guru

Re: ECP (port 8060) not working

@RokuKC -
there are 2 issues though, one with UpdateLastKeyPressTime() and one with disabling ECP when not on private IP:

  1. How is a non-BrightScript (say Marmalade) app to delay screensaver, given that - well, it has no access to UpdateLastKeyPressTime()? I thought i "invented" a way by defining a private SS in B/S - but that is a no-go because "black screen" is invoked instead of SS for such apps. Using ECP to tickle the player seems like the only workaround.

  2. Shutting down ECP server when non-private IP - it does "jack squat" for DMZ Rokus. If a Roku is behind a NAT and the owner has placed it in router's DMZ (in attempt to improve streaming - which i bet is the prevailing majority of this case) - then said Roku will have IP=192.168.x.x and yet ECP will still be exposed to the Internet at large.

It is because of DMZ that i made a very specific suggestion (#1) in viewtopic.php?f=34&t=88160 - and that is to use IP firewall rules to protect 8060 from connections from outside the local network mask - not selectively shutting down ECP server. And if so, ECP could always be relied to be accessible via loopback interface (localhost or 127.0.0.1).

I guess weighing the options here depends on the statistics of "indecently exposed" Rokus: what's the % with external IP (with no firewall!) vs % with internal IP (due to DMZ or port forwarding in firewall). I advocate that my approach will cover both cases, where Roku's covers only one of them (see recent Variety article based on leaks)
0 Kudos
RokuKC
Roku Employee
Roku Employee

Re: ECP (port 8060) not working

"EnTerr" wrote:

  1. How is a non-BrightScript (say Marmalade) app to delay screensaver, given that - well, it has no access to UpdateLastKeyPressTime()?

I haven't tried it myself, but it appears to me that roAppManager UpdateLastKeyPressTime() should be callable by NDK apps. Does Marmalade not allow full access?

"EnTerr" wrote:

[list=B:1v4ol5wd]
  • Shutting down ECP server when non-private IP - it does "jack squat" for DMZ Rokus.

  • ECP rejects requests from non-private request IPs... does that not apply in this situation, even if the Roku itself has a private IP?
    0 Kudos
    EnTerr
    Roku Guru

    Re: ECP (port 8060) not working

    "RokuKC" wrote:
    I haven't tried it myself, but it appears to me that roAppManager UpdateLastKeyPressTime() should be callable by NDK apps. Does Marmalade not allow full access?

    Not that i know of - http://docs.madewithmarmalade.com/displ ... ctionality says "No" for Roku platform on "Extension Development Kit (EDK)" and "Native toolchain access". And the NDK i have laid my eyes on was something truly vintage - circa 2012-2013. That won't cover these new-fangled features, would it?

    "RokuKC" wrote:
    "EnTerr" wrote:

    [list=B:33oryyvz]
  • Shutting down ECP server when non-private IP - it does "jack squat" for DMZ Rokus.
  • ECP rejects requests from non-private request IPs... does that not apply in this situation, even if the Roku itself has a private IP?

    Hmmm, if by source IP - it "shoulda" blocked :?:. But if that were indeed the case for years, how come certain someone is able through scanning to identify and interrogate thousands of Roku's on the Net? Current data apparently.
    0 Kudos
    RokuKC
    Roku Employee
    Roku Employee

    Re: ECP (port 8060) not working

    "EnTerr" wrote:

    Not that i know of - http://docs.madewithmarmalade.com/displ ... ctionality says "No" for Roku platform on "Extension Development Kit (EDK)" and "Native toolchain access". And the NDK i have laid my eyes on was something truly vintage - circa 2012-2013. That won't cover these new-fangled features, would it?

    That sounds like something to ask the Marmalade support about. I don't have any visibility into that.

    "EnTerr" wrote:

    Hmmm, if by source IP - it "shoulda" blocked :?:. But if that were indeed the case for years, how come certain someone is able through scanning to identify and interrogate thousands of Roku's on the Net? Current data apparently.

    I don't see much there. Without researching it specifically, I would guess those are legacy devices.
    0 Kudos
    Luchin
    Channel Surfer

    Re: ECP (port 8060) not working

    Hi everyone,

    Since update to OS 12.0, the ECP commands are not working within the dev app (in-app testing). Response code is now 403 whereas in OS 11.5 and before it was always 200.

    'cmd = [ECP command]
    'RokuIP = [local IP of Roku device, RFC1918 address]

    request = CreateObject("roUrlTransfer")
    m.port = createObject("roMessagePort")
    request.setMessagePort(m.port)
    urlString = "http://" + RokuIP + ":8060/" + cmd
    request.SetUrl(urlString)

    if request.AsyncGetToString() then
    'if request.AsyncPostFromString("") then
    msg = m.port.waitMessage(0)
    print msg.GetResponseCode()
    end if

    If instead an ECP command is sent from a local pc, the same Roku device on OS 12.0 executes it and the response code is 200. So definitely this new blocking is affecting the dev app.

    >~ curl -w "%{http_code}" -d '' "http://"$RokuIP":8060/"$cmd
    200
    ramoneariel
    Channel Surfer

    Re: ECP (port 8060) not working

    I have the same problem trying to restart my app so that it takes some configuration changes.

    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.