Offscreen documents API should allow access to chrome.tabCapture API

782 views
Skip to first unread message

Alexander Harding

unread,
Aug 31, 2022, 5:46:42 PM8/31/22
to Chromium Extensions

Since one of the main points of the offscreen document api is to allow video capture, I strongly suggest chrome.tabCapture is also in this context.

Denis L

unread,
Sep 2, 2022, 11:12:06 AM9/2/22
to Chromium Extensions, aeha...@gmail.com
The API limitation was made by design and according to the original proposal, I do not think the Chromium team will consider it: 

Btw, where did you find any doc about this experimental API? 

Alexander Harding

unread,
Sep 2, 2022, 11:18:12 AM9/2/22
to Denis L, Chromium Extensions, Alexander Harding
If you’re referring to the tabCapture API, it’s not experimental, and it’s been around for ages, and it’s well documented: https://developer.chrome.com/docs/extensions/reference/tabCapture/.

The API limitation is to prevent people using the offscreen document API as a ‘background page’. But the tabCapture API, while in MV2 was usable in the background page, is no longer available in the background service worker in MV3 because the service worker context lacks some of the APIs that the tabCapture API relies on.

Literally the entire point of the offscreen document API is to provide a DOM environment for DOM only APIs. That’s why chrome.tabCapture should be available in the offscreen document API.

Denis L

unread,
Sep 2, 2022, 1:44:33 PM9/2/22
to Chromium Extensions, aeha...@gmail.com, Chromium Extensions, Denis L
Yeah, I understand the motivation here.
But as far as I know, the `tabCapture` API is not a part of DOM API, it is part of `chrome.*` API. 
The idea of the offscreen document is to provide access to native DOM features and communicate with the rest of the extension via chrome.messages. No other `chrome` methods will be allowed there. 

Juraj M.

unread,
Sep 2, 2022, 1:51:10 PM9/2/22
to Chromium Extensions, d3l...@gmail.com, aeha...@gmail.com, Chromium Extensions
What about the `chrome.tabs.captureVisibleTab`?
Also, the proposal document mentions "video capture" several times. Is there some DOM API for video capture?

Alexander Harding

unread,
Sep 2, 2022, 2:04:10 PM9/2/22
to Juraj M., Chromium Extensions, d3l...@gmail.com
1. chrome.tabCapture returns a MediaStream, which IS a DOM API. Chrome.* DOM dependent APIs, like chrome.tabCapture, should be in the Offscreen Document.
2. chrome.tabs.captureVisibleTab just takes a picture. I need a video - a MediaStream - which is what chrome.tabCapture does.
3. getUserMedia for webcam stuff, and allowing the user to select screens/windows for recording. But that is a separate use case than chrome.tabCapture (chrome.tabCapture allows the application to specify a tabId (if you have the respective activeTab permissions).

--
You received this message because you are subscribed to a topic in the Google Groups "Chromium Extensions" group.
To unsubscribe from this topic, visit https://groups.google.com/a/chromium.org/d/topic/chromium-extensions/Ekw1nYHyiO8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/01836534-8d0a-4a7e-966e-f545c91b3113n%40chromium.org.

Reply all
Reply to author
Forward
0 new messages