how to capture tab audio even after popup is closed

413 views
Skip to first unread message

Vivek Sagar

unread,
Jun 6, 2023, 10:00:07 AM6/6/23
to Chromium Extensions
i used this approach ->
popup.js file:

chrome.tabCapture.capture({ audio: true }, (stream) => {
  const context = new AudioContext();
  const track = context.createMediaStreamSource(stream);


Audio capturing works until the popup get closed any way to make it persistent

Oliver Dunk

unread,
Jun 6, 2023, 10:23:32 AM6/6/23
to Vivek Sagar, Chromium Extensions
Assuming you're using Manifest V3, you'll need to open a new tab or window and do the recording from there. There unfortunately isn't a way to do recording of video in the background (unless you are comfortable using the getDisplayMedia API from an offscreen document and prompting the user) at the moment.

We've committed to adding a way of doing this which we are tracking here: https://developer.chrome.com/docs/extensions/migrating/known-issues/#closing-the-platform-gap
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, 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/689978bc-bbb8-4d00-a2ab-9e5ce756c7bbn%40chromium.org.

Vivek Sagar

unread,
Jun 6, 2023, 11:17:27 AM6/6/23
to Chromium Extensions, Oliver Dunk, Chromium Extensions, Vivek Sagar
can you elaborate more like how can i open new tab for eg i want to recors audio coming from youtube video

Oliver Dunk

unread,
Jun 6, 2023, 11:20:12 AM6/6/23
to Vivek Sagar, Chromium Extensions
The example here should help: https://developer.chrome.com/docs/extensions/mv3/screen_capture/#audio-and-video. You'll just need a way of getting the tab ID for the page with YouTube.

We recently added a more complete sample here which might help: https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/api-samples/tabCapture
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB

Reply all
Reply to author
Forward
0 new messages