So I made my first extension (a shoutcast radio), it works fine, but I have a problem with it:
- The stream stops playing when the popup gets closed.
Basically my problem is the same as in this post ->running a shoutcast radio in a chrome extension
So what I need help for is:
- Keeping the music playing even when the popup is closed.
The code:
1 - manifest.json:
{
"name": "Kombat Syndicate Radio Extension",
"version": "1.0",
"manifest_version": 2,
"description": "Kombat Syndicate Radio",
"browser_action": {
"default_icon": "icon.png",
"19": "icons/icon.png",
"128": "icons/icon_128.png",
"default_popup": "ksradio.html"
},
"permissions": ["tabs", "http://*/*"]
}
2 - ksradio.html:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="script.js"></script>
</head>
<body>
<h1><img style="margin-top:-15px;-webkit-box-reflect: below 0px -webkit- gradient(linear, left top, left bottom, from(transparent), color-stop(87%, transparent), to(white));
" src="icons/ks_radio_icon.png" /><br />Kombat Syndicate Radio</h1>
<div align="center" text-align="center" id="content">
<div id="smallffmp3">
<audio controls src="http://85.25.118.16:7502/;"></audio>
</div>
<a href="http://85.25.118.16:7502/listen.pls" target="_blank"><img src="icons/VLC_48.png" title="VLC Media Player"/></a>
<a href="#" id="wmppop"><img src="icons/WMP_48.png" /></a>
<a href="http://85.25.118.16:7502/listen.pls" target="_blank"><img src="icons/WinAmp_48.png" title="WinAmp Media Player" /></a>
<a href="http://85.25.118.16:7502/listen.pls" target="_blank"><img src="icons/iTunes_48.png" title="iTunes" /></a>
<iframe align="middle" style="display:block;" name="infos" src="http://phpks.comoj.com/radioinfos.php" width="65%" height="70%" frameborder="0" scrolling="no" seamless></iframe>
</div>
</body>
</html>
P.S: I have to mention that I'm not really good with javascript :(
Thanks in advance!
来源:https://stackoverflow.com/questions/13871128/google-chrome-extension-popup-keeping-the-popup-running-even-when-its-closed