所以我做了我的第一个扩展(一个广播电台),它工作得很好,但我有一个问题:
- 当弹出窗口关闭时,流停止播放。
基本上我的问题与这篇文章中的相同->在 chrome 扩展中运行广播电台
所以我需要帮助的是:
- 即使弹出窗口关闭,也能保持音乐播放。
编码:
1 - 清单.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>
PS:我不得不提一下,我不太擅长 javascript :(
提前致谢!