I'm currently developing a channel for AnimeFTW which I have now working all the way to the point the videos are requested. The videos are currently restricted by User-Agent or Referrer.
The videos play when using the channel in iOS or Android as the User-Agent has a string of "Lavf" and the web server has already been updated to accept that string for user agent, meaning that the videos do not return a 403 when requested.
However the user agent is generic when I request from PHT or Web Browser.
The following is the output from the web server log files
Web Interface
###.###.###.### - - [29/Dec/2014:15:59:36 -0600] "GET /11eyes/eyes_11_ns.mkv HTTP/1.1" 403 214 "http://192.168.178.38:32400/manage/index.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36"
PHT
###.###.###.### - - [29/Dec/2014:16:12:28 -0600] “GET /11eyes/eyes_11_ns.mkv HTTP/1.1” 403 214 “-” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17”
Is there a way to control the user-agent that is sent to the remote AnimeFTW server. I don't think there is anything we can do for the web interface as the request is being initiated from the web browser itself. However, is there a way to set the user-agent for PHT from within my channel?
I've tried to use Http.Headers in Start method to set default values but that didn't seem to make a difference. I would also expect this to affect all clients (other than web)
The iOS client uses an user agent something like "AppleCoreMedia.." so "Lafv" is actually PMS(when doing transcoding).
The playback might also fail for those clients(iOS + Android) if the direct play settings are set high enough and depending on which streams that are used(i.e. if the streams are direct play compatible) ...
Thanks for the suggestion. I had missed that setting on the ObjectContainer when looking at the APIs.
I finally had a chance to give this a try and it looks like if I use either method, the user agent is being sent when I browse the channel using an android client. But when I use PHT, it is ignoring and still sending the following user agent
xxx.xxx.xxx.xxx - - [11/Jan/2015:15:09:56 -0600] "GET /11eyes/eyes_1_ns.mp4 HTTP/1.1" 403 213 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17"
I don't think this is a bug in PHT, I think it's by design. When you override the headers you only do it for the actual python code running on PMS. Once you hand off a URL to a client (any client) the Plex channel framework is completely out of the loop and won't have a way to tell clients to spoof headers.
Thank you for the response Gerk but that doesn’t seem to make sense. the Android client was sending the custom user agent header while pht was not sending it
Thank you for the response Gerk but that doesn't seem to make sense. the Android client was sending the custom user agent header while pht was not sending it
I've found that different clients handle things differently. The only "workaround" that has worked for me is to let the Plex Media Server transcode everything by setting optimized_for_streaming to False (example).