Your Digital Media Has Never Looked So Good

 
matrixebiz
Topic Author
Posts: 242
Joined: Mon Jan 20, 2014 12:47 pm

Change User-Agent of Roku Video Player

Wed Mar 22, 2017 1:07 pm

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.
 
matrixebiz
Topic Author
Posts: 242
Joined: Mon Jan 20, 2014 12:47 pm

Re: Change User-Agent of Roku Video Player

Thu Mar 23, 2017 6:41 am

Please let me know if you need more info or if this is not possible. Thanks
 
User avatar
marcelo.cabral
Posts: 326
Joined: Tue Mar 20, 2012 8:53 am

Re: Change User-Agent of Roku Video Player

Fri Mar 24, 2017 9:21 pm

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
 
User avatar
MasterRed
Posts: 9
Joined: Fri Feb 03, 2017 6:18 am

Re: Change User-Agent of Roku Video Player

Sat Mar 25, 2017 8:48 am

Saludos Marcelo, mi consulta es parecida a la de matrixebiz o sino igual:
Estoy usando la nueva sdk de roku Multilive: https://github.com/rokudev/multi-live-channel, muy diferente a las anteriores versiones del player, entre este paquete se encuentra la carpeta components y el archivo config.brs, el cual relaciono a continuación, es un ejemplo con varios streaming, la pregunta es: en donde debo colocar el encabezado para el User-Agent, ya que algunos de los streaming a emitir solo podrían funcionar con el 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, he dedicado mucho tiempo a esto pero sin éxito alguno, de antemano gracias por el apoyo y la atención prestada.

' ********** Copyright 2016 Roku Corp.  All Rights Reserved. **********

Function loadConfig() as Object
    arr = [
'##### Format for inputting stream info #####
'## For each channel, enclose in brackets ## 
'{
'   Title: Channel Title
'   streamFormat: Channel stream type (ex. "hls", "ism", "mp4", etc..)
'   Logo: Channel Logo (ex. "http://Roku.com/Roku.jpg)
'   Stream: URL to stream (ex. http://hls.Roku.com/talks/xxx.m3u8)
'}

{
    Title: "CANAL 1"
    streamFormat: "hls"
    Logo: "pkg:/images/canal-1-.jpg"
    Stream: "http://canal-streaming.com/playlist.m3u8"
}
{
    Title: "CANAL 2"
    streamFormat: "hls"
    Logo: "pkg:/images/canal-2-.jpg"
    Stream: "http://canal-streaming.com/playlist.m3u8"
}
{
    Title: "CANAL 3"
    streamFormat: "hls"
    Logo: "pkg:/images/canal-3-.jpg"
    Stream: "http://canal-streaming.com/playlist.m3u8"
}
    
'##### Make sure all Channel content is above this line #####    
    ] 
    return arr
End Functio
 
User avatar
marcelo.cabral
Posts: 326
Joined: Tue Mar 20, 2012 8:53 am

Re: Change User-Agent of Roku Video Player

Sat Mar 25, 2017 1:02 pm

MasterRed wrote:
Saludos Marcelo, mi consulta es parecida a la de matrixebiz o sino igual:
Estoy usando la nueva sdk de roku Multilive: https://github.com/rokudev/multi-live-channel, muy diferente a las anteriores versiones del player, entre este paquete se encuentra la carpeta components y el archivo config.brs, el cual relaciono a continuación, es un ejemplo con varios streaming, la pregunta es: en donde debo colocar el encabezado para el User-Agent, ya que algunos de los streaming a emitir solo podrían funcionar con el 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, he dedicado mucho tiempo a esto pero sin éxito alguno, de antemano gracias por el apoyo y la atención prestada.

Sorry but I will answer in english, I'm from Brazil, so I speak portuguese, I do understand spanish but to write I'm more comfortable in english..
According to the documentation of the Video node, you should set the HttpHeaders on the "Content-Metadata", see the following link section "Data Bindings":
https://sdkdocs.roku.com/display/sdkdoc/Video
At the Content-Metadata page you should read the section "Scene Graph Certificate Attributes":
https://sdkdocs.roku.com/display/sdkdoc/Content+Meta-Data

Name: HttpHeaders
Type: array of strings
If set, the Scene Graph Audio or Video node sends these headers to the server. Each string must be of the format "name:value" When used with a Scene Graph Audio or Video node, the node or global HttpAgent is found, as explained elsewhere in this documentation. When this Content Meta-Data is played and this attribute is set, all HTTP headers in the agent are cleared and replaced with the headers defined by this attribute.
 
matrixebiz
Topic Author
Posts: 242
Joined: Mon Jan 20, 2014 12:47 pm

Re: Change User-Agent of Roku Video Player

Mon Mar 27, 2017 7:23 am

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")
 
User avatar
MasterRed
Posts: 9
Joined: Fri Feb 03, 2017 6:18 am

Re: Change User-Agent of Roku Video Player

Mon Mar 27, 2017 2:52 pm

Hi Marcelo, Thanks for the answer, I will test and comment on the next few days, thanks in advance for your support !.
 
User avatar
MasterRed
Posts: 9
Joined: Fri Feb 03, 2017 6:18 am

Re: Change User-Agent of Roku Video Player

Mon Mar 27, 2017 3:10 pm

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")
 
belltown
Posts: 1443
Joined: Thu Dec 09, 2010 1:43 pm
Contact:

Re: Change User-Agent of Roku Video Player

Mon Mar 27, 2017 3:52 pm

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"
https://github.com/belltown/
 
matrixebiz
Topic Author
Posts: 242
Joined: Mon Jan 20, 2014 12:47 pm

Re: Change User-Agent of Roku Video Player

Tue Mar 28, 2017 6:42 am

@ 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.
 
matrixebiz
Topic Author
Posts: 242
Joined: Mon Jan 20, 2014 12:47 pm

Re: Change User-Agent of Roku Video Player

Fri Mar 31, 2017 6:15 am

I assume by the lack of continued response that this is not possible?
 
User avatar
destruk
Posts: 2482
Joined: Sat Dec 18, 2010 4:58 pm

Re: Change User-Agent of Roku Video Player

Fri Mar 31, 2017 10:10 am

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.
 
User avatar
MasterRed
Posts: 9
Joined: Fri Feb 03, 2017 6:18 am

Re: Change User-Agent of Roku Video Player

Sun Apr 02, 2017 2:40 pm

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>
Last edited by MasterRed on Sun Apr 02, 2017 3:33 pm, edited 1 time in total.
 
User avatar
MasterRed
Posts: 9
Joined: Fri Feb 03, 2017 6:18 am

Re: Change User-Agent of Roku Video Player

Sun Apr 02, 2017 2:56 pm

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>
 
User avatar
MasterRed
Posts: 9
Joined: Fri Feb 03, 2017 6:18 am

Re: Change User-Agent of Roku Video Player

Sun Apr 02, 2017 3:20 pm

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

Who is online

Users browsing this forum: No registered users and 4 guests