I'm working on a channel which parses mp4 files from a website and plays them back. I have the core of the channel working (you can browse the categories and play the videos), however, I'm looking for a way to create a playlist of sort, where the user can play all videos in a given category.
I haven't had much luck searching for a way to create an M3U file programmatically and return it, and the docs haven't turned up any way that I've found to return multiple videos.
If you can create a m3u playlist file, that could work, since PMS does handle HTTP Live Streaming m3u8 playlists. All I meant was that there is not currently a simple way to build playlists. Any hack that one can come up with that works is likely to treat the entire playlist as a single media item for the purposes of metadata display etc.
I got this working today, but not the way I originally thought I would. I'll posted it here in case anyone has a similar issue.
What I did was add a URLService that can handle the rss feed which I was using to populate the channel categories and add that as a video item (when there are videos in the category):
if len(videoList) > 0:
# add playlist item
categoryUrl = feedUrl + "&quality=" + quality
dir.add(VideoClipObject(
url = categoryUrl,
title = "Play All",
summary = "Play all videos in '" + title + "'."
))
Then in the URL Service, I check if the URL is actually a feed instead of a video, and if so, I create a media object with multiple parts, where each part is a video from the feed:
mo = MediaObject(audio_channels = 2)
for video in videoList:
url = GetVideoUrl(video.ID, quality)
mo.add(PartObject(key=Callback(DirectPlay, url=url)))
return [mo]
I see you have this working but I tried following it and just couldn't get it to work in my application. If I have a list of YouTube url's, do you believe I can use the media object for each url to make a playlist?