Hello folks,
I am having to resolve RTMP URLs which require an additional request. As this is time-consuming, I created a callback function and pass it to RTMPVideoItem like this:
dir.Append(Function(RTMPVideoItem(PlayForaVideo, title=title, subtitle=subtitle, summary=summary, thumb=FTV_ROOT+thumb), url=FTV_ROOT+key))
Then the callback function:
def PlayForaVideo(sender, url):
page = HTTP.Request(url)
clipid = re.search(‘var full_program_clipid = (.+?);’, page, re.DOTALL).group(1)
doc = XML.ElementFromURL(FTV_ROOT+FORA_PLAYER % clipid, False)
clip = re.search(’^(.*)(.flv)$’, doc.xpath(’/playerdata/encodeinfo/encode_url’)[0].text).group(0)
Redirect(LLNW_ROOT+’/’+clip)
My question:
RTMPVideoItem really requires two parameters and I’m returning only one from the callback. How can I do this and does it even work with Redirect? I only read about a same-protocol restriction so I figured it should work…
TIA
JP
Hello Jean-Paul!
When you’re using a WebVideoItem or RTMPVideoItem in combination with a Redirect, you have use a WebVideoItem or RTMPVideoItem in the return value. I think an example explains it much better:
Use WebVideoItem when building your list with videos, like so:
dir.Append(Function(WebVideoItem(PlayForaVideo, title=title, subtitle=subtitle, summary=summary, thumb=FTV_ROOT+thumb), url=FTV_ROOT+key))
Then you can return an RTMPVideoItem (or WebVideoItem) to it:
def PlayForaVideo(sender, url):<br />
...<br />
...<br />
return Redirect(RTMPVideoItem( LLNW_ROOT, clip ))
Hi Sander and thanks for the prompt reply.
I changed the code and tested my data using the site player
Site player works fine with url and clip as in here
But my code which has been changed accordingly still returns “Request not handled by plug-in.”
Will keep looking…
Hi Jean-Paul,
I’m not sure what’s going wrong, maybe you can try to Log() some stuff and see if any of the variables is incorrect. You can also build the correct url (http:// www.plexapp.com/player/player.php...etc.) yourself and just use a WebVideoItem in your PlayForaVideo function too:
def PlayForaVideo(sender, url):<br />
...<br />
...<br />
url = 'http://www.plexapp.com/player/player.php?url=rtmp://foratv.fcod.llnwd.net/a953/o10&clip=2010-04-10_goodman_FORAcast-16x9-HDV-384kbps-10611'<br />
return Redirect(WebVideoItem(url))<br />
Thank you Sander!
I finally noticed my mistake. Forgot the return in front of Redirect. My function ended with Redirect and not return Redirect.
Getting near completion of this plug-in.
JP
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.