I'm running the following code in a background.js script for my Chrome extension:
chrome.browserAction.onClicked.addListener(captureCurrentTab());
function handleCapture(stream) {
console.log('content captured');
console.log("backround.js stream: ", stream);
alert(stream);
// localStream = stream; // used by RTCPeerConnection addStream();
// initialize(); // start signalling and peer connection process
}
function captureCurrentTab() {
console.log('reqeusted current tab');
chrome.tabs.query({active : true}, function(tab) {
console.log('got current tab');
chrome.tabCapture.capture({
audio : true,
video : false
}, handleCapture);
});
}
However, this gives me the following error:
Unchecked
runtime.lastError
while runningtabCapture.capture
: Extension has not been invoked for the current page (see activeTab permission). Chrome pages cannot be captured.
However, I specifically am granting activeTab permission in manifest.json:
"permissions": [
"tabs",
"tabCapture",
"activeTab",
]
Thanks for your help!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With