Depending on what you need and how you setup your MediaObjectsForURL function you can include the http_headers field within a VideoClipObject and/or the PartObject.
Examples iTunes Movie Trailers, ForaTV (Note: ForaTV is doing basically the same thing as you already tried),
def MediaObjectsForURL(url):
return [
MediaObject(
parts=[PartObject(
key=HTTPLiveStreamURL(Callback(PlayVideo, url=url))
)]
)
]
@indirect
def PlayVideo(url, **kwargs):
"""
do the things
Parse for m3u8_url and set video headers
"""
headers={'X-Forwarded-For': '127.0.0.1'}
return IndirectResponse(VideoClipObject, key=m3u8_url, http_headers=headers)
If you do not want to use the Callback method within the PartObject, you should be able to set the PartObjectkey to the stream URL and set the http_headers to your {'X-Forwarded-For': '127.0.0.1'},
If you leave out the HTTPLiveStreamURL function, then you will need to include the information outlined in Comment_1168292, so Plex can handle the HLS stream correctly.
All of the above can be found within the objectkit.py file within the following directory: