swf url in plugin

hello.



in my first plugin i learned how to write a picture plugin, in my second plugin (my own personal transmission mod) i vastly improved xpath.

in my third plugin i wanna learn how to write a video plugin. it will be for Euronews: http://www.euronews.net



people who know euronews heard probably of their famous “no comment” reports.

my plugin will have a Live Stream of the tv channel, which is (here)

and one will be able to browse the recent No Comment videos.



first i wanna learn how to play the live stream. as you can see it’s a swf file, and plex gives me a “compressed swf not supported” when i try and play it in the plugin.



the code:



# PMS plugin framework<br />
import re, string, datetime<br />
from PMS import *<br />
<br />
PLUGIN_PREFIX   = "/video/euronews"<br />
<br />
RSS_FEED        = "http://feeds.feedburner.com/Euronews-NoComment"<br />
EUROLIVE                      = "http://www.euronews.net/media/player_live_1_7.swf"<br />
eurothumb                    = "icon-default.png"<br />
NAMESPACES = {'itunes':"http://www.itunes.com/DTDs/Podcast-1.0.dtd", 'media':"http://search.yahoo.com/mrss/", 'feedburner':"http://rssnamespace.org/feedburner/ext/1.0"}<br />
ART           = 'art-default.png'<br />
ICON          = 'icon-default.png'<br />
####################################################################################################<br />
<br />
def Start():<br />
   Plugin.AddPrefixHandler(PLUGIN_PREFIX, MainMenu, "euronews", "icon-default.jpg", "art-default.jpg")<br />
   Plugin.AddViewGroup("InfoList", viewMode="InfoList", mediaType="videos")<br />
  <br />
   MediaContainer.art        =R(ART)<br />
   DirectoryItem.thumb       =R(ICON)<br />
<br />
<br />
####################################################################################################<br />
def MainMenu():<br />
    dir = MediaContainer()<br />
    url= EUROLIVE<br />
    dir.Append(Function(WebVideoItem(VideoPlayer, title="Watch Euronews live", subtitle=None, thumb=None), url=url))<br />
    return dir<br />
#########################################<br />
def VideoPlayer(sender, url):<br />
    dir = MediaContainer()<br />
    Log(url)<br />
    return Redirect(url)<br />




ignore the rssfeed & the namespaces for now, they are for the no comment bits later.
as i said, i get a "compressed SWF not supported" error. what should i do? the stream url is under EUROLIVE ([here](http://www.euronews.net/media/player_live_1_7.swf)).
thanks!!

Hi!

You have to do 2 things to get this to work:

  1. Change the return value in the VideoPlayer function to return a WebVideoItem:

####################################################################################################<br />
def MainMenu():<br />
    dir = MediaContainer()<br />
    dir.Append(Function(WebVideoItem(VideoPlayer, title="Watch Euronews live"), url=EUROLIVE))<br />
    return dir<br />
#########################################<br />
def VideoPlayer(sender, url):<br />
    Log(url)<br />
    return Redirect(WebVideoItem(url))<br />



2. Write a [Site Config file](http://dev.plexapp.com/docs/Configs.html) for the Euronews player.

thanks for the hints!

EDIT: i’m getting how the site config works.

however, there is a lil problem:

when i play the stream i get the same thing like here

which means it doesnt start automatically. once i hit enter, the stream starts.

any way to autostart it?



my site config is:


<?xml version="1.0" encoding="UTF-8"?><br />
<site site="http://www.euronews.net"<br />
	plugin="http://www.euronews.net/media/player_live_1_7.swf"<br />
	initialState="playing"<br />
	version="2.0"><br />
<br />
	<crop x="0" y="0" width="0" height="0" /><br />
<br />
	<!-- PLAYING --><br />
	<state name="playing"><br />
		<event><br />
			<condition><br />
				<command name="pause" /><br />
			</condition><br />
			<action><br />
				<click x="15" y="304" /><br />
				<goto state="paused" /><br />
			</action><br />
		</event><br />
	</state><br />
<br />
	<!-- PAUSED --><br />
	<state name="paused"><br />
		<event><br />
			<condition><br />
				<command name="play" /><br />
			</condition><br />
			<action><br />
				<click x="15" y="304" /><br />
				<goto state="playing" /><br />
			</action><br />
		</event><br />
	</state><br />
</site>

also, why won’t this loop through the rss page?





def nocomment(sender):<br />
    dir = MediaContainer()<br />
    pageUrl= RSS_FEED<br />
    content=XML.ElementFromURL(pageUrl, isHTML="False").xpath('//item')<br />
    for item in content:<br />
      Log(item)<br />
      title = item.xpath('./description')[0].text<br />
      url = item.xpath('./enclosure')[0].get('url')<br />
      Log(url)<br />
      dir.Append(VideoItem(url, title, thumb = R(ICON)))<br />
      return dir<br />




only gives me the first item.
EDIT: i realised the error: return dir indentation typo. please have a look at the post above though :) thanks!

Is this working for anyone? It gives me a black screen nowadays, when it was previously working about a month or so back.

did you download the latest version?

http://forums.plexapp.com/index.php/topic/24011-release-euronews-plugin/



it worked for me last time i tried. :slight_smile:

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