Hi,
I am new to this with Plugin Development for Plex.
I have been trying to fix a couple of broken plugins for swedish tv channels.
I have gotten one of them to work, but not the other (TV4).
Now I have managed to list all the shows etc, but I can’t make the episode play.
There seems to be two possible ways of playing the video.
Either I end up with an url like this:
http://embed.tv4play.se/tv4play/v0/tv4video.swf?vid=743749
or
rtmpe://cp70051.edgefcs.net/tv4ondemandmp4:/mp4root/2012-11-09/20121109T193935_SundhageBralottningvadvinmter_2238881_T6MP48_.mp4?token=c3RhcnRfdGltZT0yMDEyMTExNzE4MzkzMCZlbmRfdGltZT0yMDEyMTExNzE4NDEzMCZkaWdlc3Q9OGMzZjM3MTZhZWQ2YzQxNjMyNWYzMDA4NDRjOGQyMzM=
I have been trying various ways of displaying both of them.
I am guessing the second url should be played with RTMPVideoURL, but I can’t get that to work.
I have tried playing the first one using WebVideoURL, VideoClipObject etc, but I am probably doing something awfully wrong.
I am attaching my code, and hoping someone will have a look at it and point me in the right direction…
The Info.plist file is stolen from the old malfunctioning plugin, I might have deleted or edited something in my search for a solution, though …
Please help me :’(
Maeckie
I realised I did something wrong with the RTMPE url.
I guess you are supposed to use it like this:
return MediaObject(
video_resolution = “1280”,
audio_channels = 2,
bitrate = 2400,
parts = [PartObject(key=RTMPVideoURL(url=“rtmpe://cp70051.edgefcs.net/tv4ondemand”,
clip=“mp4:/mp4root/2012-11-21/pid3923685(2242502_T3MP4130).mp4?token=c3RhcnRfdGltZT0yMDEyMTEyNjE4NTAyNiZlbmRfdGltZT0yMDEyMTEyNjE4NTIyNiZkaWdlc3Q9ZWJiM2Q0YTQxNDc0ZmYwMTcyMmZkNDc0NmZmZDhhODg=”))]
)
I am able to download the file using rtmpdump, but it’s not playing in Plex.
The log doesn’t say much either. Can someone please shed some light on this 
<br />
2012-11-26 19:14:07,002 (7f76477fe700) : DEBUG (runtime:143) - Calling function 'TV4Play'<br />
2012-11-26 19:14:07,003 (7f76477fe700) : DEBUG (networking:166) - Requesting 'http://anytime.tv4.se/webtv/metafileFlash.smil?p=2242804&bw=300000&emulate=true&sl=true'<br />
2012-11-26 19:14:07,441 (7f76477fe700) : DEBUG (objectkit:673) - Checking for Real RTMP support... Enabled:False Platform:Windows Product:None Client:0.9.5.4 Server:0.9.6.9.241-da3068c<br />
2012-11-26 19:14:07,443 (7f76477fe700) : DEBUG (objectkit:750) - Using WebKit RTMP (True, False, True)<br />
2012-11-26 19:14:07,444 (7f76477fe700) : WARNING (objectkit:187) - The 'platforms' attribute is deprecated and should not be assigned.<br />
2012-11-26 19:14:07,445 (7f76477fe700) : WARNING (objectkit:187) - The 'protocols' attribute is deprecated and should not be assigned.<br />
2012-11-26 19:14:07,446 (7f76477fe700) : WARNING (objectkit:187) - Media part has no streams - attempting to synthesize<br />
2012-11-26 19:14:07,450 (7f76477fe700) : DEBUG (runtime:851) - Response: [200] MediaObject, 731 bytes<br />
<br />
Looks like you're almost there. You need to set the RealRTMP flag in the plugin's Info.plist file and the URL Service's ServiceInfo.plist if you're using a URL Service.
<br />
<key>PlexFrameworkFlags</key><br />
<array><br />
<string>UseRealRTMP</string><br />
</array><br />
hi,
Thank you very much for the reply.
I have made some changes, I added what you suggested to the Info.plist file, and changed what is returned from TV4Play so it is now returns
return RTMPVideoURL(url="rtmpe://cp70051.edgefcs.net/tv4ondemand",<br />
clip="mp4:/mp4root/2012-11-21/pid3923685(2242502_T3MP4130).mp4?token=c3RhcnRfdGltZT0yMDEyMTEyNjE4NTAyNiZlbmRfdGltZT0yMDEyMTEyNjE4NTIyNiZkaWdlc3Q9ZWJiM2Q0YTQxNDc0ZmYwMTcyMmZkNDc0NmZmZDhhODg=")<br />
I also tried to launch it from a MediaObjec with just a "parts" part. The behavior in the PMC is a bit different but in either case the movie is not playing.
The log looks a bit different now:
2012-11-27 22:28:30,621 (7f0a8bfff700) : DEBUG (runtime:143) - Calling function 'TV4Play'<br />
2012-11-27 22:28:30,623 (7f0a8bfff700) : DEBUG (networking:166) - Requesting 'http://anytime.tv4.se/webtv/metafileFlash.smil?p=2242804&bw=300000&emulate=true&sl=true'<br />
2012-11-27 22:28:30,780 (7f0a8bfff700) : DEBUG (objectkit:673) - Checking for Real RTMP support... Enabled:True Platform:Windows Product:None Client:0.9.5.4 Server:0.9.6.9.241-da3068c<br />
2012-11-27 22:28:30,781 (7f0a8bfff700) : DEBUG (objectkit:692) - Using Real RTMP<br />
2012-11-27 22:28:30,784 (7f0a8bfff700) : DEBUG (runtime:851) - Response: [200] RTMPURL, 232 bytes<br />
Any suggestions? :/
Off the top of my head, I can think of two possibilities:
1. You need to pass the "token=..." as a separate command to libRTMP.
and/or
2. You need to specify a swf url for swf verification.
If you're able to grab the stream using rtmpdump without specifying 'swfVfy' then, we can probably ignore #2 for now. I would try:
return RTMPVideoURL(url="rtmpe://cp70051.edgefcs.net/tv4ondemand",<br />
clip="mp4:/mp4root/2012-11-21/pid3923685(2242502_T3MP4130)",<br />
args=[False, "mp4:/mp4root/2012-11-21/pid3923685(2242502_T3MP4130).mp4?token=c3RhcnRfdGltZT0yMDEyMTEyNjE4NTAyNiZlbmRfdGltZT0yMDEyMTEyNjE4NTIyNiZkaWdlc3Q9ZWJiM2Q0YTQxNDc0ZmYwMTcyMmZkNDc0NmZmZDhhODg="])<br />
You can also check the Plex.log for errors when attempting playback. Your last PMS log snippet shows that the RTMP arguments are being successfully passed to the client so, any further errors will show up in the client log.
Hi again,
I tried the approach with the token as an arg, but it looks the same in the PMC log (once I found it :))
It says:
09:24:00 T:13972 M:33% NOTICE: PlexDirectory::GetDirectory(http://10.0.0.2:32400/video/tv4play)<br />
09:24:01 T:10920 M:33% NOTICE: PlexDirectory::GetDirectory(http://10.0.0.2:32400/video/tv4play/:/function/TV4Shows?function_args=Y2VyZWFsMQoxCmRpY3QKMQp1NQpOw7ZqZXMxMgpjYXRlZ29yeU5hbWVyMAo_)<br />
09:24:01 T:12812 M:33% NOTICE: PlexDirectory::GetDirectory(http://10.0.0.2:32400/video/tv4play/:/function/TV4Episodes?function_args=Y2VyZWFsMQoxCmRpY3QKMQp1MTUKQmVyZyBmbHl0dGFyIGluczgKc2hvd05hbWVyMAo_)<br />
09:24:03 T:10920 M:33% NOTICE: PlexDirectory::GetDirectory(http://10.0.0.2:32400/video/tv4play/:/function/TV4Play?function_args=Y2VyZWFsMQoxCmRpY3QKMQp1NwoyMjQ0Njk0czYKdm1hbmlkcjAK)<br />
09:24:03 T:10920 M:33% ERROR: CPlexDirectory::ReallyGetDirectory - Unable to parse XML<br />
rtmpe://cp70051.edgefcs.net/tv4ondemand playpath=mp4:/mp4root/2012-11-21/pid3923685(2242502_T3MP4130) conn=B:0 conn=S:mp4:/mp4root/2012-11-21/pid3923685(2242502_T3MP4130).mp4?token=c3RhcnRfdGltZT0yMDEyMTEyNjE4NTAyNiZlbmRfdGltZT0yMDEyMTEyNjE4NTIyNiZkaWdlc3Q9ZWJiM2Q0YTQxNDc0ZmYwMTcyMmZkNDc0NmZmZDhhODg=<br />
09:24:03 T:13972 M:33% ERROR: XFILE::CDirectory::GetDirectory - Error getting http://10.0.0.2:32400/video/tv4play/:/function/TV4Play?function_args=Y2VyZWFsMQoxCmRpY3QKMQp1NwoyMjQ0Njk0czYKdm1hbmlkcjAK<br />
09:24:03 T:13972 M:33% ERROR: CGUIMediaWindow::GetDirectory(http://10.0.0.2:32400/video/tv4play/:/function/TV4Play?function_args=Y2VyZWFsMQoxCmRpY3QKMQp1NwoyMjQ0Njk0czYKdm1hbmlkcjAK) failed<br />
09:24:04 T:14660 M:33% NOTICE: PlexDirectory::GetDirectory(http://127.0.0.1:32400)<br />
09:24:09 T:14852 M:33% WARNING: XFILE::CFileCurl::CReadState::FillBuffer: curl failed with code 28<br />
09:24:09 T:14852 M:33% ERROR: CFileCurl::CReadState::Open, didn't get any data from stream.
Can I get it to print the XML it is trying to parse?
Yes. From your log snippet, you can grab the URL that the player requests to see what is returned.
http://10.0.0.2:32400/video/tv4play/:/function/TV4Play?function_args=Y2VyZWFsMQoxCmRpY3QKMQp1NwoyMjQ0Njk0czYKdm1hbmlkcjAK
Hopefully, it's valid XML. You may need to enclose the MediaObject in an ObjectContainer for it to work properly.
I appears that XML is not being returned at all…
This is what is being returned:
rtmpe://cp70051.edgefcs.net/tv4ondemand playpath=mp4:/mp4root/2012-11-21/pid3923685(2242502_T3MP4130) conn=B:0 conn=S:mp4:/mp4root/2012-11-21/pid3923685(2242502_T3MP4130).mp4?token=c3RhcnRfdGltZT0yMDEyMTEyNjE4NTAyNiZlbmRfdGltZT0yMDEyMTEyNjE4NTIyNiZkaWdlc3Q9ZWJiM2Q0YTQxNDc0ZmYwMTcyMmZkNDc0NmZmZDhhODg=
I really don't get this ..
Now I am just doing a return of RTMPVideoURL() to the key in an ObjectContainer using callback. Is that the problem?
I’m sorry, I hadn’t downloaded and reviewed your code up 'til now. Just going from what you were posting in-line. At least part of the problem is that you are trying to get a DirectoryObject to play media:
oc.add(DirectoryObject(key=Callback(TV4Play, whatever=vmanid), title=name, thumb=thumb, summary=summary))
Whereas, to play media you need to use a Media Object of some kind. Based on the context of the code, I would suggest either an EpisodeObject or a VideoClipObject.
oc.add(VideoClipObject(key=Callback(TV4Play, whatever=vmanid), title=name, thumb=thumb, summary=summary))
If I were you, I would probably try to use a URL Service to handle the video separately from the navigation structure but let's see if we can get it working using your chosen path first. When using a VideoObject, you need to provide either a "url" parameter which will be used to call the appropriate URL Service, or you need to provide both the "key" and "rating_key" parameters. The "rating_key" needs to be a unique string. Usually it automatically gets assigned the value of the "url" so, in your case you could use:
rating_key = SWF_PLAYER_URL % vmanid
The key parameter needs to point to a callback which handles the video return. You're partway there with what you have already. Here's a link to the [relevant section of code](https://github.com/plexinc-plugins/AmazonInstantVideo.bundle/blob/master/Contents/Code/__init__.py#L165) for the AmazonInstantVideo plugin. Notice how the EpisodeObject includes a "key" which points to the PlayVideo Callback, as well as a "rating_key" which is just the url, and an "items" parameter which (via a callback in this case) includes a MediaObject which also points to the PlayVideo function. I know that likely seems a little convoluted and IMO it is. When using a URL Service, most of that convoluted stuff is taken care of behind the scenes. When doing it "manually" we need to handle it up front. The other thing to note is that the PlayVideo function uses the @indirect decorator which tells the client to expect an object container back from the PlayVideo function rather than a direct link to a video file. Using that, your TV4Play functino could look something like this:
<br />
@indirect<br />
def TV4play(vmanid):<br />
# get the rtmp params<br />
""" here's where you would include code to take the vmanid to determine the appropriate rtmp_url and playpath parameters """<br />
<br />
# return the rtmp params inside the necessary containers<br />
return IndirectResponse(VideoClipObject, key=RTMPVideoURL(url=rtmp_url, clip=playpath))<br />
Hi again,
I haven’t been able to look at this for a week or so, but now I have finally tried out your pointers above Mike and things looks much better.
Like I am almost there now.
Now the fricking things just won’t play …
I’ve added a swfUrl argument to the RTMPVideoURL call now, but it won’t play. The error message is “Could not determine input format”
The client side log says:
<br />
10:38:29 T:8636 M:35% NOTICE: DVDPlayer: Opening: http://10.0.0.4:32400/video/tv4play/:/function/TV4Play?function_args=Y2VyZWFsMQoxCmRpY3QKMQp1NwoyMjQ3Mjg3czYKdm1hbmlkcjAK&indirect=1<br />
10:38:29 T:8636 M:35% WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED<br />
10:38:29 T:4776 M:35% NOTICE: Creating InputStream<br />
10:38:29 T:4776 M:35% NOTICE: Creating Demuxer<br />
10:38:29 T:4776 M:35% ERROR: CDVDDemuxFFmpeg::Open - error probing input format, http://10.0.0.4:32400/video/tv4play/:/function/TV4Play?function_args=Y2VyZWFsMQoxCmRpY3QKMQp1NwoyMjQ3Mjg3czYKdm1hbmlkcjAK&indirect=1<br />
10:38:29 T:4776 M:35% ERROR: CDVDPlayer::OpenDemuxStream - Error creating demuxer<br />
The XML returned from the address above is
<br />
<MediaContainer title1="TV4 Play" art="/:/plugins/com.plexapp.plugins.tv4play/resources/art-default.jpg?t=1352088774" size="1" identifier="com.plexapp.plugins.tv4play" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1347358810"><br />
<embed type="{0C55C096-0F1D-4F28-AAA2-85EF591126E7}" cotype="cs" id="cosymantecbfw" style="width: 0px; height: 0px; display: block;"/><br />
<Video key="rtmpe://cp70051.edgefcs.net/tv4ondemand playpath=mp4:/mp4root/2012-11-21/pid3923685(2242502_T3MP4130).mp4?token=c3RhcnRfdGltZT0yMDEyMTEyNjE4NTAyNiZlbmRfdGltZT0yMDEyMTEyNjE4NTIyNiZkaWdlc3Q9ZWJiM2Q0YTQxNDc0ZmYwMTcyMmZkNDc0NmZmZDhhODg= swfUrl=http://wwwb.tv4play.se/polopoly_fs/1.939636.1281635185!approot/tv4video.swf?swfvfy=true swfVfy=1" type="clip"><br />
<Media protocol="rtmp"><br />
<Part key="rtmpe://cp70051.edgefcs.net/tv4ondemand playpath=mp4:/mp4root/2012-11-21/pid3923685(2242502_T3MP4130).mp4?token=c3RhcnRfdGltZT0yMDEyMTEyNjE4NTAyNiZlbmRfdGltZT0yMDEyMTEyNjE4NTIyNiZkaWdlc3Q9ZWJiM2Q0YTQxNDc0ZmYwMTcyMmZkNDc0NmZmZDhhODg= swfUrl=http://wwwb.tv4play.se/polopoly_fs/1.939636.1281635185!approot/tv4video.swf?swfvfy=true swfVfy=1" file=""><br />
<Stream index="0" streamType="1" id="1"/><br />
<Stream index="1" streamType="2" id="2"/><br />
</Part><br />
</Media><br />
</Video><br />
</MediaContainer> <br />
Either I have just missed something somewhere, or I have approached the whole thing the wrong way from start ...
Do you see anything obvious?
Marcus
Is that error from attempting to play on the desktop Plex client or the web client (or something else)? Apparently an error with RTMP handling snuck in to the framework and affects iOS (and possibly Roku?) clients. It should be fixed soon though. I don't think the web client is currently able to handle RTMP streams although that may have changed or soon might. The desktop client (version 0.9.5.4) should definitely be able to handle the playback if you've got it set up right. The "embed type" tag in the XML looks odd to me. ie. I don't recall having seen that in Plex channel XML before but things change pretty quick these days and I've been out of town.
The error above is from trying to play it on my PC Desktop Client (windows 7).
I found another (old) post which is discussing the same thing.
They solved by adding an “ext=‘mp4’” to the VideoObject (see line 56 here https://github.com/jonnywray/IMDb-Trailers.bundle/blob/master/Contents/Code/init.py#L56).
Now when I try to do the same I get an error in the server log:
FrameworkException: The 'ext' attribute is inaccessible from model interfaces.
Does that mean I need to be using an URL service in order to set that?
An URL Service is the most common (and IMO better) but not only way to achieve what you're attempting. The discussion and code you're referencing are too old to be relevant here. Do you have the latest version of your code on github (or anywhere)?
I’ve only got the code locally.
Attaching it here
Added a Git repo as well now …
GitHub
So I was reading through the dev documentation (again) and came across this
Since I'm trying to use rtmpe I guess I'm screwed trying to what we tried above (?).
Another question as well. Since I have acess to a swf which can be played straight of in the browser, can I play that in plex?
Or do I need to use a player on the web site?
I'm a bit confused how this works ..
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.