Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

activeTab permission issue for Chrome extension

Tags:

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 running tabCapture.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!