# tabCapture
Documentation: [Chrome Tab Capture API](https://developer.chrome.com/docs/extensions/reference/tabCapture)
A promise-based wrapper for the Chrome `tabCapture` API to capture and retrieve tab media streams.
## Methods
- [createTabCapture(options)](#createTabCapture)
- [getCapturedTabs()](#getCapturedTabs)
- [getCaptureMediaStreamId(options)](#getCaptureMediaStreamId)
## Events
- [onCaptureStatusChanged(callback)](#onCaptureStatusChanged)
---
### createTabCapture
```
createTabCapture(options: chrome.tabCapture.CaptureOptions): Promise
```
Captures the visible media stream of a tab based on the specified options. Resolves with the `MediaStream` if successful, or `null` otherwise.
### getCapturedTabs
```
getCapturedTabs(): Promise
```
Retrieves details of all active tab capture sessions. Resolves with an array of `CaptureInfo` objects.
### getCaptureMediaStreamId
```
getCaptureMediaStreamId(options: chrome.tabCapture.GetMediaStreamOptions): Promise
```
Generates a media stream ID for capturing a tab via `navigator.mediaDevices.getUserMedia`. Resolves with the stream ID.
### onCaptureStatusChanged
```
onCaptureStatusChanged(
callback: (info: chrome.tabCapture.CaptureInfo) => void
): () => void
```
Adds a listener for tab capture status changes (started, stopped, source changed). Returns an unsubscribe function.