tabCapture

The tabCapture API allows an extension to capture a media stream of a tab's content.

What it does

  • Captures the visible content of a tab as a live MediaStream.
  • The stream can contain either audio, video, or both.
  • This stream can be used with other web APIs, such as WebRTC for streaming or the MediaRecorder API for recording.
  • Unlike desktopCapture, this does not show a prompt to the user, but it does show a clear visual indicator (like a red dot or border) on the tab to inform the user that it is being captured.

When to use it

This permission is ideal for extensions that need to record, stream, or analyze the content of a single browser tab.

Examples:

  • A "tab recording" extension.
  • An extension that streams the content of a tab to a service like Twitch.
  • A tool that takes high-quality video captures of web animations.
  • A remote collaboration tool that shares a specific tab with other users.

Manifest Declaration

{
  "name": "My Tab Recorder",
  "version": "1.0",
  "manifest_version": 3,
  "permissions": [
    "tabCapture"
  ]
}

Security & Privacy

Why is it risky?

This permission allows an extension to record the video and audio from a specific browser tab. This could be used to capture sensitive information inside that tab, like a video conference, a private document, or a movie you are watching.

The main safety feature is that Chrome will display a prominent visual indicator (like a red dot or a blue border) on any tab that is being recorded. This makes it hard for an extension to spy on you secretly. However, you should still be aware that anything you do in a tab being captured is visible to the extension.

API Usage Example

This example starts capturing the active tab when the user clicks the extension icon.

// background.js

chrome.action.onClicked.addListener((tab) => {
  chrome.tabCapture.getMediaStreamId({ consumerTabId: tab.id }, (streamId) => {
    if (chrome.runtime.lastError) {
      console.error(chrome.runtime.lastError.message);
      return;
    }

    console.log("Got stream ID:", streamId);

    // In a real application, you would pass this streamId to a
    // content script or offscreen document to start the
    // navigator.mediaDevices.getUserMedia flow.
  });
});

// Example of how the streamId would be used inside an offscreen document
// (service workers don't have access to navigator.mediaDevices, so the
// stream must be consumed in a DOM context — typically an offscreen
// document declared with reasons: ['USER_MEDIA'] or 'DISPLAY_MEDIA').
/*
async function startCapture(streamId) {
  const stream = await navigator.mediaDevices.getUserMedia({
    audio: false,
    video: {
      mandatory: {
        chromeMediaSource: 'tab',
        chromeMediaSourceId: streamId
      }
    }
  });

  // Now 'stream' is a MediaStream of the tab's content.
  const video = document.createElement('video');
  video.srcObject = stream;
  video.play();
}
*/

Extensions with the tabCapture permission

Here are some popular browser extensions that use the "tabCapture" permission. To explore more, try our Advanced search.

Permission Metrics

Popularity

Security Risk


Usage by Platform