I have implemented HD to my channel and I am having trouble getting the channel to detect if the user is in SD. When a user in SD tries to watch a HD video it kicks back and won’t play. What I need it to do is to detect if the user is in SD and play the SD version of a file. I have my channel set up similar to TWIT with categories for SD video and HD video. When I am in SD and go to TWIT and try and watch a HD video it plays the SD version. This is what I would like to implement. My channel is based off of the videoplayer example in the SDK.
I added 2 codes to try and allow this to happen but now the categories wont load. Can anybody help me solve this problem? What is the best way to detect SD or HD when playing a video?
Here is what I attempted to do
I placed this code in my deviceInfo.brs :
Function hd() as Boolean
di=createobject(roDeviceInfo)
if di.getdisplaytype()=“HDTV” then
return true
else
return false
end if
end function
I tried placing the code:
If not hd() then
if item.StreamFormat=“mp4” then
item.ishd=false
Else if item.streamFormat=“hls” then
item.streamQuality=[“SD”]
End if
End if
several places in my showFeed.brs with the same results none of my buttons will load.
Below are my changes.
My xml code looks like this for a video:
The Dead Truth Helena Texas Act 1 Episode 1 tdt000 HauntedSD
HD
hls
full-adaptation
SD
0
http://Link to SD video
HD
0
http://Link to HD video
The Klinge Brothers and Everyday Paranormal bring you The Dead Truth Helena Texas Act 1 Episode 1
Clip
1627
here is my deviceInfo.brs
'**********************************************************
'** Video Player Example Application - DeviceInfo
'** November 2009
'** Copyright (c) 2009 Roku Inc. All Rights Reserved.
'**********************************************************
'******************************************************
'Get our device version
'******************************************************
Function GetDeviceVersion()
return CreateObject(“roDeviceInfo”).GetVersion()
End Function
'******************************************************
'Get our serial number
'******************************************************
Function GetDeviceESN()
return CreateObject(“roDeviceInfo”).GetDeviceUniqueId()
End Function
Function hd() as Boolean
di=createobject(roDeviceInfo)
if di.getdisplaytype()=“HDTV” then
return true
else
return false
end if
end function
Here is my showFeed.brs:
if e <> invalid then
item.StreamBitrates.Push(strtoi(validstr(e.streamBitrate.GetText())))
item.StreamQualities.Push(validstr(e.streamQuality.GetText()))
item.StreamUrls.Push(validstr(e.streamUrl.GetText()))
endif
next idx
showCount = showCount + 1
feed.Push(item)
skipitem:
next
End Function
