When adding a “VideoItem” using a direct link to the stream, is there any possible way to set the HTTP referrer header for the request?
Hey,
I'm not entirely sure what you mean by a "VideoItem" but if you're using the v2.1 framework, i'm assuming you are referring to the "VideoClipObject", "MovieObject" or "EpisodeObject". When a URL is specified for these types, and the URL Service is found, the available media is populated. The Media items can specify a callback to a function contained within the URL Service which is marked as @indirect. This means that the response from that Callback is not to redirect to the actual video URL, but to another ObjectContainer which contains the link to the URL. The advantage of using the @indirect Callback is that this ObjectContainer can include HTTP headers and User-Agent which the client should use to access the resource.
Here's an example of a Service that does this: https://github.com/plexinc-plugins/Services.bundle/blob/master/Contents/Service%20Sets/com.plexapp.plugins.blip/URL/Blip/ServiceCode.pys#L155
If you're using an older framework, you can probably do something similar, i.e. instead of giving the 'direct link', specify a Callback (or Function for older frameworks) to an @indirect function which returns the ObjectContainer with populated http_headers.
If you want to attach some code, I can give better examples...
Ian
Thanks for the example. I think the examples I've been looking at so far must have been an older framework -- still very green to Plex.
No worries, there are number of resources to find the latest information:
[list]
[*]http://dev.plexapp.com/
[*]http://devblog.plexapp.com/
[*]Here :)
[/list]
Some of the most valuable information can be found by looking at some of the current (v2.1) channels available here: https://github.com/plexinc-plugins . If the plugin uses types like ObjectContainer, VideoClipObject, MovieObject, EpisodeObject, TrackObject, PhotoObject, etc then it's a v2.1 channel. If you find that some information is missing, just post in here and one of the plugin developers should be able to help...
Ian
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.