General Video Question

I’d like to know the best way to play a video from a website that requires cookies and outputs flash videos. (Crunchyroll.com for anyone who cares) Currently the plugin i’m workign on uses the WebVideoUrl() method. The problem with this method is that it uses WebKit and getting cookies via site configurations is giant pain in the ass. (if only Python could share its cookies with webkit…) To that end I’ve been researching some other plugins to see how they are doing it and am extremely confused.



Take Hulu for example. This site plays flash videos. As far as i know, the only way to show flash video through Plex is to use the WebVideoUrl() function. This also requires a matching Site Configuration file. The Hulu plugin has neither. Is the Hulu plugin NOT playing flash files? Or are they using some kind of voodoo that makes flash video magically work in plex? From what i can tell they are using mostly EpisodeObject() and VideoClipObject() functions. But i have no idea how those functions work.



To make things worse, after reading some of the documentation about the above functions/objects, i’m even more confused. The EpisodeObject() documentation, for example, basically just goes over the different variables and inputs the object accepts. It doesn’t actually explain WHAT it is, how to use it, why to use it, or when to use it. The same for the rest of the documentation regarding “ojbects.” The documentation assumes you already know what the objects are and when to use them. This leaves me completely puzzled. Am i missing something? Other documentation perhaps?



Any help would be greatly appreciated.



Thanks!

I’ll try to answer some of this stuff for you.



One general comment on all of this before we start that may help you understand things more clearly … there are two places that channels can hold all of these bits and pieces (site configs, URL services, etc). They can be within the channel bundle itself or they can be in the global bundles that are specific to each thing (i.e. Services.bundle and SiteConfigurations.bundle). In this case Hulu’s are in the global bundles for them. The reasoning for this is that it makes them usable for things outside the actual the actual channel code (things like myPlex’s Plexit option or for when you recommend something to a friend). In other cases these additional pieces of code may be contained within the actual channel bundle code within proper folder structure – this is usually done when they are very specific to things that happen within the actual channel bundle code and won’t work globally for things like myPlex – so they are kept “isolated” within the channel’s bundle. The same thing applies with Search Services (although they are a much rarer beast at this point!)



Let’s look at some actual code links to help explain:



https://github.com/plexinc-plugins/hulu.bundle/blob/master/Contents/Code/init.py#L169



That link is where the Hulu channel parses the feed and loads up all the video objects. The difference between EpisodeObject and VideoClipObject is that the EpisodeObject has additional information – being the season and episode numbers. Other than that they are identical (in fact I’m pretty sure that the EpisodeObject is just an extension of the VideoClipObject). In this case the channel code does a “try” to load up the full EpisodeObject, but if it can’t (i.e. if not all the info was included in the feed) it falls back to setting it up as a VideoClipObject. The advantage with using EpisodeObject is that clients can potentially handle it differently in terms of how they show the information to the end user.



Now also in that example you’ll see url=url in both objects. In those instances it’s handing off the found URL in the feed and it’s being taken care of by the URL Service for Hulu (which can be found within the Services bundle) – which then makes the actual WebVideoURL() part. Here’s a link to show you the part of that code that creates the actual WebVideoURL: https://github.com/plexinc-plugins/Services.bundle/blob/master/Contents/Service%20Sets/com.plexapp.plugins.hulu/URL/Hulu/ServiceCode.pys#L77



Lastly it does have a Site Configuration, but it lives within the main Site Configurations bundle. In the case of Hulu for some reason it looks like it’s encoded into some format when looking at it in the github repo, I honestly have no idea why, but I’m sure there is a reason. If you’re just looking for examples of Site Configs you can look at other ones in there aside from Hulu. https://github.com/plexinc-plugins/Services.bundle/blob/master/Contents/Service%20Sets/com.plexapp.plugins.hulu/URL/Hulu/ServiceCode.pys#L77



Lastly there is no other documentation that I know of. The docs are a bit dry and just for reference mostly. Have you looked at any of the articles posted on the dev blog? They can help you a little bit in terms of understanding some of the components and when/why to use them … http://dev.plexapp.com/



Hope this helps a little bit. I know at first it can all seem a bit confusing, but once you start to understand the framework a little better it starts to make sense. If I can help you clarify other stuff please let me know and I’ll try!




Thanks for the information. That makes sense. I was fairly confident that Hulu did use Flash video and that they had to be using the WebVideoURL() somehow. It all makes sense now that i know the service code and the site configuration are bundled with the plex global bundle.

It's odd that Hulu's site configuration is encoded. I wonder why? I was hoping to take a peek at it to understand how they are doing the login and handling cookies. All of the other plugins I've looked at use a very similar method and i'm not having much luck with it.

Thanks again for the info.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.