So im building a chrome extension and I have placed an audio flash player that plays a radio station. It works while the popup is open but stops after popup closes. Is it possible to keep the audio player streaming after the popup closes? If so can you give me some idea on how to achieve this? Thanks
Edit @Serg
I think I already have it in a background page? My setup is as follows. In my popup.html I have a navigation bar that links to individual html pages. To get to these the links are targeted at an iframe.
snippet from popup.html
<div class="nav-bar">
<a href="latest.html" target="frame" style="color:#FFF"><li class="nav">Latest</li></a>
<a href="podcasts.html" target="frame" style="color:#FFF"><li class="nav">Podcasts</li></a>
<a href="books.html" target="frame" style="color:#FFF"><li class="nav">Books</li></a>
<a href="stream.html" target="frame" style="color:#FFF"><li class="nav">Radio Stream</li></a>
</div>
<iframe src="latest.html" scrolling="auto" width="480" height="330" style="border:0px;" name="frame"></iframe>
snippet from stream.html
<div id="player" style="float:right;width:480px;margin:0;padding:0"></div>
<script type="text/javascript">
var so = new SWFObject('http://www.radiostation.com/embed/minipro.swf','fmp256','480','70','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','false');
so.addParam('wmode','transparent');
//so.addParam('flashvars','playlistsize=40&playlist=bottom&file=http://www.radiostation.com/feed.xml');
so.write('player');
</script>
Can you help me understand what you mean by placing it in a background page? How would I go about doing it?
Edit2 @Serg I made an attempt at putting it into the background page but im not sure how to do it properly and then call it on the stream.html.
Snippet from background.html
function getPlayerStream(){
var so = new SWFObject('http://www.site.com/embed/minipro.swf','fmp256','480','70','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','false');
so.addParam('wmode','transparent');
//so.addParam('flashvars','playlistsize=40&playlist=bottom&file=http://www.site.com/feed.xml');
so.write('player');
}
stream.html
<html>
<head>
<link href="css/style.css" rel="stylesheet"/>
<script type="text/javascript" src="http://www.site.com/embed/swfobject.js"></script>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
background = chrome.extension.getBackgroundPage();
background.getPlayerStream();
</script>
</head>
<body>
<div id="content">
<div id="player" style="float:right;width:480px;margin:0;padding:0">The live feed player is currently offline.</div>
</div>
</body>
</html>
Embed your player into a background page.
Background page is a unique page that isn’t visible but always loaded. You can read about it here.
What you currently have in
stream.htmlneeds to be in a background page, if you want it to stay always loaded.UPDATE
Your actual
<div id="player">needs to be in a background page. You won’t be able to actually see the player in an iframe, only programmatically control it through javascript (if that radio player supports such option).