# swf url in plugin

**URL:** <https://forums.plex.tv/t/swf-url-in-plugin/8086>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [March 2, 2011, 11:44am UTC](https://forums.plex.tv/t/swf-url-in-plugin/8086 "2011-03-02T11:44:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pooploser](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pooploser/32/133851_2.png) [@pooploser](https://forums.plex.tv/u/pooploser)\
**Post date:** [March 2, 2011, 11:44am UTC](https://forums.plex.tv/t/swf-url-in-plugin/8086/1 "2011-03-02T11:44:14Z")

</div>

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](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](http://www.euronews.net/media/player_live_1_7.swf))  
  
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:

```auto

# 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"&nbsp;error. what should i do? the stream url is under EUROLIVE ([here](http://www.euronews.net/media/player\_live\_1\_7.swf)).  
thanks!!

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [March 2, 2011, 1:44pm UTC](https://forums.plex.tv/t/swf-url-in-plugin/8086/2 "2011-03-02T13:44:53Z")

</div>

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:  

```auto

####################################################################################################<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.

---

<div class="post-metadata">

**Author:** ![pooploser](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pooploser/32/133851_2.png) [@pooploser](https://forums.plex.tv/u/pooploser)\
**Post date:** [March 2, 2011, 1:57pm UTC](https://forums.plex.tv/t/swf-url-in-plugin/8086/3 "2011-03-02T13:57:31Z")

</div>

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](http://www.euronews.net/media/player_live_1_7.swf)  
  
which means it doesnt start automatically. once i hit enter, the stream starts.  
  
any way to autostart it?  
  
  
  
my site config is:

```auto

<?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>

```

---

<div class="post-metadata">

**Author:** ![pooploser](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pooploser/32/133851_2.png) [@pooploser](https://forums.plex.tv/u/pooploser)\
**Post date:** [March 3, 2011, 2:22pm UTC](https://forums.plex.tv/t/swf-url-in-plugin/8086/4 "2011-03-03T14:22:36Z")

</div>

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

```auto

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!

---

<div class="post-metadata">

**Author:** ![Teevee](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@Teevee](https://forums.plex.tv/u/Teevee)\
**Post date:** [April 23, 2011, 1:49pm UTC](https://forums.plex.tv/t/swf-url-in-plugin/8086/5 "2011-04-23T13:49:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pooploser](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pooploser/32/133851_2.png) [@pooploser](https://forums.plex.tv/u/pooploser)\
**Post date:** [April 26, 2011, 6:16am UTC](https://forums.plex.tv/t/swf-url-in-plugin/8086/6 "2011-04-26T06:16:46Z")

</div>

did you download the latest version?   
  
[http://forums.plexapp.com/index.php/topic/24011-release-euronews-plugin/](http://forums.plexapp.com/index.php/topic/24011-release-euronews-plugin/)  
  
  
  
it worked for me last time i tried. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 20, 2019, 9:06pm UTC](https://forums.plex.tv/t/swf-url-in-plugin/8086/7 "2019-12-20T21:06:31Z")

</div>

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