【发布时间】:2015-06-02 19:57:46
【问题描述】:
我正在尝试制作一个 Chrome 扩展程序,以便播放来自 youtube 的歌曲。我已经这样做了,但我有一个小问题。当我单击扩展图标时,会出现一个弹出窗口,我可以在其中搜索歌曲并播放它,但是当弹出窗口消失时,音乐停止播放。我该怎么做才能让音乐在后台播放? 这是查找歌曲并将 iframe 标记插入我的 popup.html 页面的函数
function showResponse(response) {
var responseString = response;
document.getElementById('response').innerHTML = responseString.items[0].id.videoId;
var videoId = responseString.items[0].id.videoId;
var iFrame = '<iframe width="300" height="300" src="https://www.youtube.com/embed/' + videoId + '"></iframe>';
document.getElementById('player').innerHTML = iFrame;
}
【问题讨论】:
-
没有上下文就不可能知道发生了什么。您可以发布代码的相关部分吗?
标签: google-chrome-extension youtube-api