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: 

Pragmatically find out if the device is RokuTV?

How to pragmatically find out if the device running the app is a RokuTV (with built in Roku) not a Roku stand alone device or stick.

My Usecase:
I am using the below function to see if HDMI(display basically) is connected or not.

Function IsHDMIPlugged()
Return CreateObject("roHdmiStatus").IsConnected()
End Function

If HDMI is not connected, I activate a sleep mode of my app (where it does not play videos and wait for HDMI to be plugged in again) to save my and my users' bandwidth.

This method works great with Roku stand alone devices and sticks. But with RokuTV this method always returns false, hence my app is always in sleep mode.
0 Kudos
9 REPLIES 9
NewManLiving
Visitor

Re: Pragmatically find out if the device is RokuTV?

roDeviceInfo should give you everything you need about the device as well as other useful information
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos

Re: Pragmatically find out if the device is RokuTV?

"NewManLiving" wrote:
roDeviceInfo should give you everything you need about the device as well as other useful information

Yes, I have looked into roDeviceInfo. ifDeviceInfo.GetModel seems to be the only method usable in this case (any other method that can be used???) But it only returns Roku's Model, and it states in the docs here, that ifDeviceInfo.GetModel returns 5000X for Roku TV. But my RokuTV's "Settings -> System -> About" displays 5303X. So I assume (I don't have the TV with me at the moment so cannot test) ifDeviceInfo.GetModel will return 5303X instead of 5000X. If so how can I differentiate with Model Number??? Probably all the models in the range of 5000 to 5999 are TVs????
0 Kudos
belltown
Roku Guru

Re: Pragmatically find out if the device is RokuTV?

"scorpiontahir02" wrote:
"NewManLiving" wrote:
roDeviceInfo should give you everything you need about the device as well as other useful information

Yes, I have looked into roDeviceInfo. ifDeviceInfo.GetModel seems to be the only method usable in this case (any other method that can be used???) But it only returns Roku's Model, and it states in the docs here, that ifDeviceInfo.GetModel returns 5000X for Roku TV. But my RokuTV's "Settings -> System -> About" displays 5303X. So I assume (I don't have the TV with me at the moment so cannot test) ifDeviceInfo.GetModel will return 5303X instead of 5000X. If so how can I differentiate with Model Number??? Probably all the models in the range of 5000 to 5999 are TVs????

According to the picture here: https://blog.roku.com/developer/2016/06/03/channel-certification-checklist-v2/#more-1201, under Roku Device List (New), 5XXX is the Roku TV, and 6XXX is the Roku 4K TV. That would be the pragmatic way to find out if the device is a Roku TV.
0 Kudos
NewManLiving
Visitor

Re: Pragmatically find out if the device is RokuTV?

What does GetModelDisplayName return
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
TheEndless
Channel Surfer

Re: Pragmatically find out if the device is RokuTV?

"scorpiontahir02" wrote:
So I assume (I don't have the TV with me at the moment so cannot test) ifDeviceInfo.GetModel will return 5303X instead of 5000X.

All HD Roku TVs should return 5000X for ifDeviceInfo.GetModel, regardless of the real model number. I think the new UHD Roku TVs return 6000X.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
EnTerr
Roku Guru

Re: Pragmatically find out if the device is RokuTV?

@scorpiontahir02 - ha, this is an interesting problem you are trying to solve!

When there is a better way, i am inclined to advise against checking by model#, the reason being we don't know if say model 7xxx will be a TV or set-top box. If determined to do so though, see viewtopic.php?f=34&t=94798&p=531121#p531106 on how not to do it :). Basically all there is to it is `if createObject("roDeviceInfo").getModel() > "5" then ...`

Now, i skimmed the doco and i think there is "a better way" to do the check you want:

function isScreenActive():
'NB: IsConnected() no good, always returns False on RokuTV - yet HDCP toggles, so use that
return createObject("roHdmiStatus").isHdcpActive("0.1")
end function

Minor clarification: in my experiments, .getHdcpVersion() flips between "0.0" and "1.4", so you may ask why not check directly .getHdcpVersion()? Well, the thing is the upper value might not be "1.4" but say "2.2" - and the lower value is undocumented if it should be "0.0", or an empty string (or invalid or who-knows-what). Thus checking if HDCP is 0.1 or better seems more future-proof.

I am curious what does Roku* consider the righteous way to check if screen is connected/active?
0 Kudos

Re: Pragmatically find out if the device is RokuTV?

"EnTerr" wrote:

When there is a better way, i am inclined to advise against checking by model#, the reason being we don't know if say model 7xxx will be a TV or set-top box.


I understand that, that is exactly why I wanted something better and more consistent between device models and firmware versions.

"EnTerr" wrote:

Now, i skimmed the doco and i think there is "a better way" to do the check you want:

function isScreenActive():
'NB: IsConnected() no good, always returns False on RokuTV - yet HDCP toggles, so use that
return createObject("roHdmiStatus").isHdcpActive("0.1")
end function



I haven't yet tested it on RokuTV (couldn't still get my hands on it), but unfortunately this method does not work for my Roku 2 XD (so probably for all the standalone devices). I tested by pulling out HDMI cable, here are the results (IsHdcpActive("0.1") still returns true when the cable is unplugged)

'with HDMI cable connected
BrightScript Debugger> print CreateObject("roHdmiStatus").IsConnected()
true
BrightScript Debugger> print CreateObject("roHdmiStatus").IsHdcpActive("0.1")
true

'with HDMI cable disconnected
BrightScript Debugger> print CreateObject("roHdmiStatus").IsConnected()
false
BrightScript Debugger> print CreateObject("roHdmiStatus").IsHdcpActive("0.1")
true


"EnTerr" wrote:
I am curious what does Roku* consider the righteous way to check if screen is connected/active?

I am curious too 🙂

@NewManLiving @TheEndless @belltown
Thanks for your suggestions, I will test today (or perhaps tomorrow) with RokuTV all the possibilities and will update what I find out.
0 Kudos

Re: Pragmatically find out if the device is RokuTV?

Ok I am back with my findings (Sorry for being so late though). Here is the info I got from RokuTV.

<--------------------------------------------------------------->
hdmi.IsConnected() -> false
hdmi.GetHdcpVersion() -> 1.4
hdmi.IsHdcpActive() -> true
<--------------------------------------------------------------->
di.GetModel() -> 5000X
di.GetModelDisplayName() -> Sharp LC-43LB371U
di.GetPublisherId() -> 44b091a1-c9e6-5a35-ade2-09121fb14262
di.GetModelDetails() ->
<Component: roAssociativeArray> =
{
ModelNumber: 5303X
ScreenSize: 43
VendorName: Sharp
VendorUSBName: Sharp
}
<--------------------------------------------------------------->

So, according to this info, ifDeviceInfo.GetModel() returns 5000X for all the RokuTVs, no matter what the actual model is. Actual model is returned by ifDeviceInfo.GetModelDetails().ModelNumber. So, I think we can rely on ifDeviceInfo.GetModel() to be 5000X and 6000X for all the RokuTVs.

Thank you all very much for your help :).
0 Kudos
EnTerr
Roku Guru

Re: Pragmatically find out if the device is RokuTV?

"scorpiontahir02" wrote:
... So, according to this info, ifDeviceInfo.GetModel() returns 5000X for all the RokuTVs, no matter what the actual model is. Actual model is returned by ifDeviceInfo.GetModelDetails().ModelNumber. So, I think we can rely on ifDeviceInfo.GetModel() to be 5000X and 6000X for all the RokuTVs.

Yes, that is well known - that RokuTV model# are starting with 5xxx, the news is that 4K RokuTVs are 6xxx. See the recent "Roku Device List (New)" table in a dev.blog post^ - it's the most detailed i have seen yet!

Like i said, currently you can check for RokuTV as simple as:
if createObject("roDeviceInfo").getModel() > "5" then
For code robustness, obviously shouldn't check for "5000X" or "6000X" literals (
hint 1: your code must continue^^, regardless of surprising/future value and make the best informed decision
hint 2: what if you get "5000EU" returned, what say you - is that RokuTV or not?
hint 3: what if a year from now you get "6100X" - what says your gut, which is more likely this to be - a Roku device with or without HDMI cable? ).

I am fairly confident 5 and 6 series will all be RokuTVs, however i won't place bets on whether 7xxx (if there ever be one) would be a set-top box with HDMI output or a combo with TV. Which brings us to asking for somebody from Roku to chime-in on how to reliably check if TV screen is actually connected/active?


PS. the part that IsHdcpActive() cannot be relied on to detect if HDMI cable is unplugged in standalone boxes is unfortunate. Not a fan of checking version strings! Relatedly, remember why there was never a "Windows 9" version...

(^) Somewhat unfortunate, the table is [mis]placed under the otherwise unexciting (and in parts wrong!) post "Channel Certification Checklist Version 2.0" https://blog.roku.com/developer/2016/06 ... cklist-v2/
(^^) "The spice must flow..."
0 Kudos