This is my second plugin for plex so I just used my first (which still works) as a base, however I’m having trouble getting the site configuration to be recognised:
Try opening the site config with a web browser. if you’re able to view the list then you likely have a problem with your site or plugin URLs. If you can’t view it in your browser you have a syntax/coding issue.
Hi!
It doesn't matter how the Flash object is added to the webpage. I think your site config is ignored because it's missing the initial "playing" state (a site config needs at least 1 state).
I took a quick look at the PartyPoker website and found that the video files (.flv files) can be found in the source of the website. So it's best to change your plugin and use those files instead of creating a site config file for the videoplayer.
The reason I went the site config route is I tried to play the FLV stream directly but kept getting "could not determine input format" error, I'm not sure if the FLV is DRM protected (tried opening the stream via flowplayer and that couldn't load it either) however it could be my code, does this look like it should work if the stream is loadable by plex? As I couldn't find any documentation for loading FLV streams directly.
<br />
dir.Append(<br />
Function(<br />
WebVideoItem(<br />
VideoFLVUrl,<br />
name<br />
),<br />
url=url,<br />
title=name<br />
)<br />
)<br />
<br />
# also tried this:<br />
<br />
dir.Append(<br />
Function(<br />
VideoItem(<br />
VideoFLVUrl,<br />
name,<br />
'',<br />
'',<br />
''<br />
),<br />
url=url,<br />
title=name<br />
)<br />
)<br />
<br />
...<br />
<br />
def VideoFLVUrl(sender,url,title):<br />
# the video FLV is loaded via JS so pick it up that way<br />
scripts = HTML.ElementFromURL(url).xpath('//*/script')<br />
for script in scripts:<br />
if re.search( r'>\s*jwplayer', HTML.StringFromElement(script)):<br />
video_url = re.sub( r'.*"file": "([^"]+).*', r'\1', HTML.StringFromElement(script) )<br />
Log( 'FLV URL: ' + video_url )<br />
return video_url<br />
<br />
return url<br />
Adding the playing state got it to work, thanks. But would be nice to know if I was trying to play the stream right and it was just a DRM issue or whether I was doing that wrong (as surely it’s cleaner to just play the stream directly).
When you grab an HTML page from the web, you have to look at the ‘raw source’, the source (the DOM) of the page without any modifications made by javascript(s) in the page.
In your case, with the PartyPoker website, the code could look something like this:
Thanks for that, my rather cludgy method of looping through the script tags and matching on them was returning the right URL for the FLV but I didn’t realise I needed to do a Redirect call with that URL.