General Channel Development Questions

I have started developing a video channel for the MSDN Channel9 site, which hosts

technical videos in a mix of MP4 and WMV formats, at various resolutions.



I have it working at a very basic level, but along the way I had several questions that

I would like to ask all you experienced channel devs. I am trying to pick up some best-practices

before I dive in a write all the remaining code.

Hopefully the answers will also be useful for anyone else about to start channel development.



1)

I have a basic directory of videos working, with a “More” item at the bottom which loads the

next page of videos (Channel9 shows 10 videos per page). At the moment this “More” item returns

another ObjectContainer and gives another level in the hierarchy, so pressing back/exit returns

you to the previous page of videos.



I was just wondering if there was a standard way to implement paging through a list of items in

a Plex channel. Should I be returning another container object like I am doing, or should I be

appending to the current container? Any examples?



2)

At the moment the channel seems very slow. Currently it loads the video list HTML and creates list entries

for each entry in the list and fills in as much metadata as it can. Then it has to fetch each individual

video page HTML and extract a bit more metadata, then I have a URL Service that returns the media items

for each video page.



In the docs it says that MediaItemsForURL() should return quickly and not cause any HTTP requests, but we are

only given the URL, so I have to get the HTML from the URL in order to extract the video locations from it.



Does the Plex framework cache HTML requests, so that if my caller already fetched an HTML page and then the URL

Service fetches the same HTML page, does it really make another request or just get the cached version?



If it is not caching then I might have to scrap the URL service and do it all from the main module instead.

Is there a way for me to pass in the pre-fetched HTML to the URL service so that it doesn’t have to fetch again?



3)

If there are several versions of a video available (MP4, WMV, various resolutions) should

I return MediaItems for all of them or just a chosen MP4? Does Plex provide a UI for choosing

between several versions of the same video, or do I have to provide the UI?



4)

I have the MP4 playing OK but some of them are low-res, with a higher res WMV available.

Can Plex channels play WMV easily? I would ideally like to let the user choose which format/resolution

they want to play.



Thanks in advance for any help,



Charlie



I'll take a shot at these questions ...

1) You're doing it right, but I would suggest using NextPageObject() (it takes basically the same params as what you're doing right now IIRC). It makes things nicer on the clients that are updated to use this like the iOS client ... then instead of having to load another page the client will load another x amount of items in place. You can't append an existing object that you've already returned so you wouldn't be able to do it like that. For an example check out the DailyMotion plugin, I used NextPageObject in there.

2) PMS caches html content so if it's the same page then you're not going to see a big slowdown (i.e. the main url that is passed will almost certainly be cached by that point). Depending on what you have to do and how you have to do it there are a couple of ways to approach this. The most common way is to use a Callback for when you actually need to pull the video, often times called PlayVideo. Take a look at other URL services, you will find lots and lots of examples of this. Grep the Services.bundle for PlayVideo to see examples.

3 + 4) MP4s are definitely preferred types as more clients can handle them natively without the need to transcode. Plex does provide a UI for users to select the desired resolution of their videos. If users have enabled a preference for what they want (i.e. 720p) they may not be prompted though, the client will just choose the closest match for them. If they don't have that preference set they will be prompted with the choices available. This is only for resolution, not for file type (I don't think). I've seen Plex prompt for file type choices before, but never within a plugin (only from Library options). If there are higher resolution WMVs then I would say give the users the choice of the available resolutions and let PMS figure it out. As far as I know it should be able to play/transcode most types of WMV ok. But also know that having multiple types of video happen within a single call in the URL service can get tricky if you are passing things back like the codec and container (meaning you can't use the PlayVideo callback approach I mentioned above to keep the number of calls down). There is another way to do it if needed, but you shouldn't go there unless you really really need to because it can cause lots of grief and potentially not work correctly on all clients, etc. It's the @deferred decorator (and is a bit evil!)

Hope this helps.

Thanks Gerk, that gives me a lot to try out next.



Charlie

Hey charlie, how you getting on with this? I would love to be able to use it.

Hey charlie, how you getting on with this? I would love to be able to use it.

Hi dunkymole, sorry for late reply, I haven't had chance to work on it since I originally started.

I'm currently building a new machine to run Plex Home Theatre, so once that's up and running I'll try to have another look at it.

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