Can I directly play an url without having a service file?

I'm parsing an rss feed for my new channel. The feed contains everything I want to know about an episode: duration, codec, et cetera. The feed also contains a direct link to a .mp4.

Can I play the .mp4 without creating a new service file? That seems like a bit too much because I have all the information. I'm trying it now like this:

@route('/video/jupiterbroadcasting/show/{show_name}')
def ShowMenu(show_name):
    show = getShow(show_name)
    rss = getShowEpisodes(show)
    oc = ObjectContainer(title2=show_name, view_group='InfoList')
for entry in rss.entries:
    show_name = show['name']
    title = entry.title
    summary = entry.subtitle if entry.has_key('subtitle') else 'Test'
    date = datetime.fromtimestamp(mktime(entry.updated_parsed))
    url = 'http://201308.jb-dl.cdn.scaleengine.net/coderradio/2013/cr-0063-432p.mp4'
    oc.add(EpisodeObject(
        url = url,
        title = title,
        summary = summary,
        thumb = 'http://www.jupiterbroadcasting.com/wp-content/uploads/2013/08/cr-0063-v.jpg',
        originally_available_at = date,
        items = [
            MediaObject(
                parts = [
                    PartObject(key=url)
                ],
                container = Container.MP4,
                video_codec = VideoCodec.H264,
            )
        ]
    ))
    break

return oc

But I still keep getting:

2013-08-25 00:36:19,499 (7f4b2f7fe700) :  DEBUG (networking:172) - Requesting 'http://www.jupiterbroadcasting.com/feeds/indepthlookihd.xml'
2013-08-25 00:36:19,963 (7f4b2f7fe700) :  WARNING (objectkit:199) - Media part has no streams - attempting to synthesize
2013-08-25 00:36:19,965 (7f4b2f7fe700) :  DEBUG (services:602) - No service found for URL 'http://201308.jb-dl.cdn.scaleengine.net/coderradio/2013/cr-0063-432p.mp4'
2013-08-25 00:36:19,965 (7f4b2f7fe700) :  DEBUG (services:617) - No matching services found for 'http://201308.jb-dl.cdn.scaleengine.net/coderradio/2013/cr-0063-432p.mp4'
2013-08-25 00:36:19,965 (7f4b2f7fe700) :  DEBUG (services:41) - Loading service code for Fallback (URLServiceRecord)

And then a "This channel is currently unavailable" on /web.

 

I'm a little stuck here. Does anyone know of an existing plugin that plays direct video files?

 

 

 

I think that you need to be passing a video object to key= (inside the PartObject).  Like maybe Redirect(url) instead of just url.   When you pass a string there I think the framework then looks for URL services to handle it.  Either way you probably have to build it like you would do inside a URL service that plays back mp4's (which it looks like you're mostly doing already) ... like here:

https://github.com/plexinc-plugins/Services.bundle/blob/master/Contents/Service%20Sets/com.plexapp.plugins.twitlive/URL/TWiT.TV/ServiceCode.pys#L78

Just a guess though, I'm pretty rust at the moment and I haven't tried to direct play from a channel in a long time.

I had created an RSS feed channel, but it checked for a Plex URL service first. But after seeing your question and talking to some of the dev guys, they showed me this example of  the creation of a TrackObject in the channel - https://github.com/plexinc-plugins/PlexPodcast.bundle/blob/master/Contents/Code/__init__.py#L41

I used that example and was just able to add support for RSS feeds that have a direct link to an .mp4 to my channel. The channel is on my Github account at https://github.com/shopgirl284/RSSFeed.bundle if you want to see an example my code.

Also, unless you want to just have a channel for the particular RSS feed you are interested in, you can just use my channel since it should handle that RSS feed for you now. The forum page with all the instructions for it is available at http://forums.plexapp.com/index.php/topic/78012-new-channel-rss-feed/. If you are using Roku, you have to use the latest Plex Test channel and the Remoku at http://remoku.tv/ makes URL input very easy.

I also have a channel called Webisodes https://github.com/shopgirl284/Webisodes.bundleon my Github (forum page for it is http://forums.plexapp.com/index.php/topic/71407-new-channel-webisodes/) that allows you to add shows from several types of sites including RSS feeds. My RSS Feed channel is just a cut down version of it. After I get a chance to test the code a little more and make sure there are no exceptions I need to fix, I will add the support for these non URL service types of feeds to that channel as well.

And if you give me a couple hours, I will add support for audio RSS feeds that do not have a URL service but have the mp3 in the feed as well.

And thank you so much for asking this question. I would have not even thought about this option if you had not asked and it is great to be able to add this capability to my channel.

Just in case you have looked at my RSS feed channel already, I just updated the code so it will support audio or video feeds and edited the function to decide whether to return a VideoClipObject or TrackObject based on the type of media file.

Awesome. Thanks again!! :)

I've added the `CreateObject()` method and now it works like a charm: https://github.com/LeonB/com.plexapp.plugins.jupiterbroadcasting

I only don't really understand how it works with the `include_container` and stuff. The Plex channel API is really nice but this feels a bit like an afterthought.

hallo l_b_ and hallo shopgirl284,

Thank you very much for your posts. its been helpful to me.

I have a request. 

Could one of you explain me please, the

A.  creation of a TrackObject in the channel referred by shopgirl284

OR

B. CreateObject() and callback of CreateObject() referred by l_b_

Actually works...?

1. why are we callingback the same create function from within, as in e.g callback(CreateObject) in CreateObject function

2. What is  boolean "include_container" variable is about

3. How is I am able to add videocllipobject directly to objectcontainer e.g youtube videos, but not for other servers that host mp4 or flv files

It would be a great help to understand the concept.

The VideoClipObject() includes a value for the URL of a web page that plays a video, but you still have to tell Plex how to play it. Plex does not automatically convert a video in a Flash Player on a web page into a video that plays on the users Plex client. You have to write the code that tells Plex how to find the actual video file that plays on that web page as well as the details about that video like the format and resolution options, and then create a MediaObject() to actually play the video. Writing the part that actually finds the video file and all of its info and builds the video player, im my opinion, is the toughest part of developing channels in Plex.

You either have to create a URL service or include a CreateObject function in your channel to build that MediaObject. The reason you do not need to create one for YouTube is because there is already a URL service for YouTube that someone else has written. To see a full list of all of the existing URL services, see the Services.bundle in Plex. An easy way to view it is from Plex's github account here - https://github.com/plexinc-plugins/Services.bundle

Most of the time a separate URL service is written verses using a CreateObject function in your channels, because it can then also allows users to play the video from options other than your channel, like using the PlexIt button in their web browser, to save the video so they can play it from their queue. The only time I use a CreateObject function in my channel code is when I am pulling videos from a variety of different sites, since a URL service requires you to determine a URL pattern for the types of URLs that will be processed by that service.

Also when you first create a URL service, you put it in a folder of your channel bundle called Services. Once you know it is working and all the kinks are out, you can open a Pull Request to have it added to the Plex Services.bundle. URL services included in the Plex Services.bundle allows the URL service to be used by other channels or by users to play videos from that website, with things like PlexIt, even if they have not installed your channel bundle.

As to your other question, my basic understanding of why you must loop through a CreateObject() function twice is that you have to go through the first time to build the proper MediaObject with all its parameters. Then it goes through the second time to actually send the video file to that MediaObject you built the first time through.

I am also working on a document to better explain the basic concept of a URL service. It is still a rough draft, but here is a link to that document, since it can help with grasping the basic ideas of a URL service - https://docs.google.com/document/d/1ePST3Dk0KywSmmDu3OPqpiNilpVgZDSzPgB0ns1yiFU

Thank you very much for crystal clear answer and for all the details esp. the para before the last

I have requested for access to doc google file and I would be more than delighted to view the document. My email request starts with username as r.r.s.guru

Cheers n Have a nice week ahead !!

Sorry, I had made the document private. You can see it now with the link of https://docs.google.com/document/d/1ePST3Dk0KywSmmDu3OPqpiNilpVgZDSzPgB0ns1yiFU

Thank you very much :  )

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