AirenSoft / OvenLiveKit-Web

OvenLiveKit for Web is a JavaScript-based Live Streaming Encoder
MIT License
49 stars 24 forks source link

Screen sharing? #10

Open brootle opened 2 years ago

brootle commented 2 years ago

Hi! Can you, please, test and add example to documentation for screen sharing using OvenLiveKit?

It's funny, but I made it work simply by replacing ovenLivekit.getUserMedia with ovenLivekit.getDisplayMedia. As a result captured screen stream gets displayed in my video element and stream is sent to media engine. In my test scenario constrains were set to video: { width: 1280, height: 720 } and I was sharing browser tab. I am not sure if I simply got lucky that it did work and if display media is supported and what constrains should I use?

Thanks!

PS I just noticed the previous question was exactly regarding same problem and checking https://github.com/AirenSoft/OvenLiveKit-Web/blob/17e7387782bc63485ea6694cda18a2b2d7161ab9/src/OvenLiveKit.js#L222

but still not sure what to do with constraints and video element as I am having problems trying to share app window or entire screen

SangwonOh commented 2 years ago

@brootle. As I mentioned in the issue below, the screen sharing feature is implemented, but needs a little more testing.

And the constraints required for screen sharing comply with the standard specifications. You can find more details below.

https://www.w3.org/TR/screen-capture/#constrainable-properties

brootle commented 2 years ago

@SangwonOh when do you think this feature will be released, and maybe some examples and test page added? I assume passing {video: true} as constraints is not enough to make it work?

brootle commented 2 years ago

@SangwonOh sorry to bother you again, but can you post minimalistic example on screen sharing somewhere in examples for this repo? From my side ovenLivekit.getDisplayMedia only worked for sharing a tab of google chrome browser, but not for entire screen or window...

Quisi commented 2 years ago

@brootle i am really interested in screen capture. As far as i researched we need to accomplish some basic rules (w3c working draft https://w3c.github.io/mediacapture-screen-share/) but that should be possible. it might be a tec issue to get the whole desktop/window screen from a browser app, idk.

can you give me a short walkthrou what you have done or already achived so far?

SangwonOh commented 7 months ago

@brootle , @Quisi Hi! Long time no see. Thanks to the efforts of the OvenMediaEngine team, screen capture is now quite stable. Please check it out at our https://space.ovenplayer.com/.

image

And the real usage of ovenLiveKit can also be found at https://github.com/AirenSoft/OvenSpace/blob/24161b33fdaf3f7cca5cdaf753069a05e8a52873/static/js/ovenspace.js#L198.

Thanks.