tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
84.07k stars 2.53k forks source link

[feat] screensharing without pop up window #11272

Open vangork opened 2 weeks ago

vangork commented 2 weeks ago

Describe the problem

Currently to share the screen, we can call navigator.mediaDevices.getDisplayMedia which will popup a mandatory window to ask user to choose which screen to share.

Describe the solution you'd like

Is there possible to get the screenid from the tauri api(like electron desktopCapturer), and call navigator.getUserMedia to produce the mediastream with the screenid directly like following so as to avoid the popup window?

const stream = navigator.getUserMedia({
    audio: false,
    video: {
        mandatory: {
            chromeMediaSource: 'desktop',
            chromeMediaSourceId: screenId,
        }
    }
})

Alternatives considered

No response

Additional context

No response

FabianLars commented 1 week ago

The webviews don't have any apis that would make this possible as far as i can see. For Windows there's this tracking issue for example https://github.com/MicrosoftEdge/WebView2Feedback/issues/2442 (doesn't look like it but check the linked issues at the bottom).

getDisplayMedia is more or less unsupported (at least officially) on macOS so finding any discussions about anything somewhat related is pretty hard but judging by the apis that do exist (including private ones) this doesn't seem possible on macOS either.

No webrtc support on Linux so no need to look into that.