Hello, is it possible to change the User-Agent that the Roku video player uses to emulate iPad instead of what it currently uses?
I have a HLS stream feed that only works on an iPad and not in Windows VLC or the Roku Video Player so I would like to change the User-Agent of the Roku Video Player to be an iPad.
Is this possible? What User-Agent does the Roku Video player currently use? Thank you
I found this thread : https://forums.roku.com/viewtopic.php?t=57084 but I’m not sure what I have to do if possible. I would like to be able to specify/change the User-Agent in the Scengraph Categories/Feed file for the stream/feed
roVideoPlayer will not be supported Jan 2019 so need to know how to do the change with Scenegraph SDK when it reads the Feeds file.
Please let me know if you need more info or if this is not possible. Thanks
All you need to do is add the header
urlXfer = createObject("roUrlTransfer")
urlXfer.SetCertificatesFile("common:/certs/ca-bundle.crt")
urlXfer.InitClientCertificates()
urlXfer.setUrl(uri)
urlXfer.setPort(m.port)
urlXfer.AddHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36")
The documentation is here:
https://sdkdocs.roku.com/display/sdkdoc/ifHttpAgent#ifHttpAgent-AddHeader(nameasString,valueasString)asBoolean
“marcelo.cabral” wrote:
All you need to do is add the header
urlXfer = createObject("roUrlTransfer")
urlXfer.SetCertificatesFile("common:/certs/ca-bundle.crt")
urlXfer.InitClientCertificates()
urlXfer.setUrl(uri)
urlXfer.setPort(m.port)
urlXfer.AddHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36")
The documentation is here:
https://sdkdocs.roku.com/display/sdkdoc/ifHttpAgent#ifHttpAgent-AddHeader(nameasString,valueasString)asBoolean
Hello, thank you for responding, so where would I input this code in the example Video Feed file?;
https://devtools.web.roku.com/videoplay … issues.xml
or do I have to create a separate file.brs in my channel components folder with the above code in it (see bottom of page);
https://sdkdocs.roku.com/display/sdkdoc/Video
Then I add a line somewhere in the “Item” spot to reference the code?
<item sdImg="https://images/RobHopkins.jpg" hdImg="https://mages/RobHopkins.jpg">
<title>Rob Hopkins: Transition to a world without oil</title>
<contentId>10012</contentId>
<contentType>Talk</contentType>
<contentQuality>SD</contentQuality>
<streamFormat>hls</streamFormat>
<media>
<streamQuality>SD</streamQuality>
<streamBitrate>0</streamBitrate>
<streamUrl>http://video.ted.com/talks/podcast/RobHopkins_2009G_480.m3u8</streamUrl>
</media>
<synopsis></synopsis>
<genres></genres>
<runtime></runtime>
</item>
is there a list of the various agents? So the below is iPad?;
("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36")
Hi Marcelo, Thanks for the answer, I will test and comment on the next few days, thanks in advance for your support !.
Hi, matrixebiz do you have the original roku sdk with which you are working ?, I have put to work different urls that require User-Agent and also Referer, But I need to see the brs files and do the test on the roku device, I have live streaming that request the User-Agent to do tests
<item sdImg="https://images/RobHopkins.jpg" hdImg="https://mages/RobHopkins.jpg">
<title>Rob Hopkins: Transition to a world without oil</title>
<contentId>10012</contentId>
<contentType>Talk</contentType>
<contentQuality>SD</contentQuality>
<streamFormat>hls</streamFormat>
<media>
<streamQuality>SD</streamQuality>
<streamBitrate>0</streamBitrate>
<streamUrl>http://video.ted.com/talks/podcast/RobHopkins_2009G_480.m3u8</streamUrl>
</media>
<synopsis></synopsis>
<genres></genres>
<runtime></runtime>
</item>
is there a list of the various agents? So the below is iPad?;
("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36")
It depends on what OS version, browser and browser version you’re using, etc. But for an iPad running Safari under iOS 10.2.1, the User-Agent string will be something like:
“Mozilla/5.0 (iPad; CPU OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) Version/10.0 Mobile/14D27 Safari/602.1”
@ MasterRed - I am just using the “SceneGraph version of the SDK1 VideoPlayer Channel” located here : https://github.com/rokudev/videoplayer-channel
So I’m ready when they get rid of the old code Jan 2019, I need to create my channel in SG instead of the old VideoPlayer SDK
@ Belltown - When you say “It depends on what OS version, browser and browser version you’re using”, I don’t have an iPad but what I am doing is accessing the stream URL on a Windows 7 Chrome browser and the server is returning an error “This content is not available to this user agent” so I use the Chrome Agent switcher plug-in and change the agent to iPad which looks to be emulating “Safari 6 on iOS 6 Apple iPad” and the stream downloads, so I am trying to get the Roku to emulate the iPad the same way using the Roku User-Agent command, so I guess the User-Agent string can be the latest iPad OS if need be, doesn’t matter. Not sure if this will work with the Roku video player switching the User-Agent the way I think it should but would like to try it. Hope that clears up what I’m trying to accomplish but I just don’t know where to put the code then call it just before the stream is read in my stream code above.
I assume by the lack of continued response that this is not possible?
Google indexed a list of user-agent strings for Apple products here:
http://www.enterpriseios.com/wiki/Compl … nt_Strings
However, keep in mind bypassing content provider’s distribution preferences isn’t something Roku actively supports, so you shouldn’t think everyone would be doing this or have a whole lot of experience bypassing content restrictions on the Roku platform. If they only want actual iOS products to be consuming their content you might want to respect that.
Hi, matrixebiz, I tried with different streaming sources that require user-agent of ipad, Works without problem, Here the code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed>
<!-- resultLength indicates the total number of results for this feed -->
<resultLength>4</resultLength>
<!-- endIndix indicates the number of results for this *paged* section of the feed -->
<endIndex>4</endIndex>
<item sdImg="https://devtools.web.roku.com/videoplayer/images/JimFallon.jpg" hdImg="https://devtools.web.roku.com/videoplayer/images/JimFallon.jpg">
<title>test</title>
<contentId>10001</contentId>
<contentType>Talk</contentType>
<contentQuality>SD</contentQuality>
<streamFormat>m3u8</streamFormat>
<media>
<streamQuality>SD</streamQuality>
<streamBitrate>0</streamBitrate>
<userAgent>http-user-agent=iPad</userAgent>
<streamUrl>hxxp://test.com/live/index.m3u8</streamUrl>
</media>
<synopsis>test,test, test,test</synopsis>
<genres>Clip</genres>
<runtime>1260</runtime>
</item>
</feed>
There also streaming that require not only the user-agent, also the referer from where you took the streaming, In this second example I included the label And below the complete code with user-agent and referer together between the xml:
<refererUrl>hxxp://live-test.com</refererUrl>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed>
<!-- resultLength indicates the total number of results for this feed -->
<resultLength>4</resultLength>
<!-- endIndix indicates the number of results for this *paged* section of the feed -->
<endIndex>4</endIndex>
<item sdImg="https://devtools.web.roku.com/videoplayer/images/JimFallon.jpg" hdImg="https://devtools.web.roku.com/videoplayer/images/JimFallon.jpg">
<title>test</title>
<contentId>10001</contentId>
<contentType>Talk</contentType>
<contentQuality>SD</contentQuality>
<streamFormat>m3u8</streamFormat>
<media>
<streamQuality>SD</streamQuality>
<streamBitrate>0</streamBitrate>
<userAgent>http-user-agent=iPad</userAgent>
<refererUrl>hxxp://live-test.com</refererUrl>
<streamUrl>hxxp://test.com/live/index.m3u8</streamUrl>
</media>
<synopsis>test,test, test,test</synopsis>
<genres>Clip</genres>
<runtime>1260</runtime>
</item>
</feed>
And to test first the links with user-agent in VLC:
For test streaming with user-agent of iPad in VLC, save it as m3u (UTF-8),
#EXTM3U
#EXTINF:-1,TEST
#EXTVLCOPT:http-user-agent=iPad
hxxp://live-stream/index.com
Thank you for the information 
if I wanted to emulate an IPhone I can just put : http-user-agent=iPhone ?
If I wanted to emulate an Android I can put : http-user-agent=Android ?
Hi, matrixebiz, it worked the user-agent iPad in your sdk Roku?,
I will do tests with android and other devices.
“MasterRed” wrote:
Hi, matrixebiz, it worked the user-agent iPad in your sdk Roku?,
I will do tests with android and other devices.
Hi MasterRed, were you able to test other agents?
The http-user-agent=iPad didn’t seem to work for me. Is there a list of all user agents? What user agent would I use for just emulating VLC? Thank you
Am I able to use the full user agent string like?;
http-user-agent=Mozilla/5.0 (iPad; CPU OS 8_1_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B466 Safari/600.1.4
Hello, does anyone know what "http-user-agent= " VLC for windows would use? I have a video stream that plays in Windows VLC but the Roku has issues with it because the stream goes through a re-direct. Thanks