Screencapture with system audio

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Screencapture with system audio

Postby kadrian » Wed Aug 09, 2023 10:52 am

I would like to capture video stream of the first monitor with system audio.
I try to set costrains like this, which works well in chrome (with selection window):

navigator.mediaDevices.getDisplayMedia( {
video: { width: 1920, height: 1080, displaySurface: 'monitor', logicalSurface: true, cursor: 'always'},
audio: true,
systemAudio: "include",
});

I tried to make this work in CEF (I use currently 115.3.110 nuget package):

- CEF doesn't support permissions, so I either have to use "enable-media-stream" or "use-fake-ui-for-media-stream" (or both).

- if I use "enable-media-stream", I get this kind of stream for 2 monitors:
aspectRatio: 3.5555555555555554
deviceId:"screen:-1:0"
frameRate: 30
height: 540
resizeMode: "crop-and-scale"
width:1920

- if I use "use-fake-ui-for-media-stream", then I don't get system audio, but:
MediaStreamTrack {kind: 'audio', id: '08bdd568-4e28-4fcf-abaf-f557bf21e58e', label: 'Fake audio', enabled: true, muted: false, …}
contentHint: ""
enabled: true
id: "08bdd568-4e28-4fcf-abaf-f557bf21e58e"
kind: "audio"
label: "Fake audio"
muted: false
oncapturehandlechange: null
onended: null
onmute: null
onunmute: null
readyState: "live"

-I read that "enable-chrome-runtime" solved the problem for some people, but I didn't notice any difference with the above cases, when I added that argument

How could I capture video stream of my first(default) monitor together with system audio?
kadrian
Newbie
 
Posts: 3
Joined: Wed Aug 09, 2023 10:19 am

Re: Screencapture with system audio

Postby magreenblatt » Wed Aug 09, 2023 11:34 am

Try the cefsimple application with the "--enable-chrome-runtime" command-line flag. This functionality may require the complete Chrome UI.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Screencapture with system audio

Postby kadrian » Thu Aug 10, 2023 7:47 am

"cefsimple --enable-chrome-runtime" is really working in the same way as chrome. I can get system audio with the monitor stream I select on the selection screen.

This solution provides all controls and pop-ups of the browser. Our goal is to hide as much details as possible, preferably offscreen, but if we need a minimal interaction like allowing devices and selecting screen, that's ok, but we don't want a full browser with all controls, which also pops up addition window (on different screen than I started cefsample) about screen/audio share.
kadrian
Newbie
 
Posts: 3
Joined: Wed Aug 09, 2023 10:19 am

Re: Screencapture with system audio

Postby magreenblatt » Thu Aug 10, 2023 8:52 am

magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Screencapture with system audio

Postby kadrian » Thu Aug 10, 2023 10:47 am

kadrian
Newbie
 
Posts: 3
Joined: Wed Aug 09, 2023 10:19 am

Re: Screencapture with system audio

Postby magreenblatt » Thu Aug 10, 2023 11:40 am

kadrian wrote:I posted this issue:
https://github.com/chromiumembedded/cef/issues/3552

Thanks :)
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 233 guests