is it possible to define explicit request headers to fetch streaming content?
I know that adding custom header informations within the channel plugin works. So I can auth against any webservice.
The webservice I'm talking to awaits an extra header information 'Authorization: Bearer ' to get the content. Problem is that the streaming request doesn't come from the plex server. The client starts the streaming, just like a download as a plain web request...
# Process stuff and find final video url.
final_url = 'http://www.example.com/video.mp4'
oc = ObjectContainer(http_headers={'Authorization': 'Bearer <token>'})
oc.add(VideoClipObject(
items = [
MediaObject(
parts = [PartObject(key=final_url)]
)
]
))
return oc
If this does not work, you can try it with leaving out the codec information, which makes the app ask for a transcode from PMS (which in its turn sends the http headers):
Adding the headers to the PlayVideo() function was the best solution for me... But does not seem to work. The channel displays an error (not available). But cannot see any errors within the channel log...
1 year later this point is still open and I couldn’t find a working solution. The only thing I need to do is to give the “client” which requests the streaming-url an additional header. Without the header the client cannot fetch the stream.
So, could you please investigate how I can solve this problem for my channel users? So that it works on ALL supported plex client platforms.
After playing around with objects and header settings I noticed that I can change the User-Agent this way… But another header (like X-User-Agent) cannot be set…
@realriot
So you need to send a specific header to the server in order to get the Master Playlist of an HLS stream?
It might be possible that in your url service you could HTTP.Request (with the header) to get the playlist file, then parse out the url’s from that file which point to the specific video stream.
Yes. Please add this custom headers feature to the Apple TV Plex client. One plugin that I’m using, requires the ‘Referer’ field to be a custom value, in order for the video url to be accessed.
Interestingly, the Plex Home Theater client, on both Linux and macOS, are able to handle the custom Referer field, and are therefore able to play the requested video.
On my Apple TV Plex client, it fails to play, even though it is talking to the same server.
It would see that this is a fairly simple fix to make – you could probably look at the Plex Home Theater code to see how it’s handling custom http headers as a starting point…