It appears that when the gDM flow is used we do not set properly the sourceId of the shared stream. When the user has multiple screens we use the sourceId to identify the display that is currently shared. Therefore in electron we can't identify the display that is used and we fail.
It doesn't get translated in the TS build, for one.
Script I used:
```python
import os
for (dirpath, dirnames, filenames) in os.walk('.'):
if '.git' in dirpath:
continue
if 'node_modules' in dirpath:
continue
if 'dist' in dirpath:
continue
if 'types' in dirpath:
continue
for filename in filenames:
path = os.path.join(dirpath, filename)
if not path.endswith('.js') and not path.endswith('.ts'):
continue
#print(path)
with open(path, 'r+') as f:
#print(f)
data = f.read()
if '__filename' in data:
p, ext = os.path.splitext(path)
txt = f"'{p[2:]}'"
print(txt)
data = data.replace('__filename', txt) # Assign the result back to data
f.seek(0)
f.write(data)
f.truncate()
```
Wrong check for unsupported getDisplayMedia when starting screen sharing will cause the app to never fallback to getUserMedia flow. This breaks screen sharing for all old electron clients that do not support getDisplayMedia.
feat(ScreenObtainer) add fallback option for Electron
If the enclosing Jitsi Meet app declares gDM in Electron is supported,
ignore the `electronUseGetDisplayMedia` config flag and use the gDM
flow. This facilitates having backwards compatibility since the Electron
app won't know if the deployment it's about to join has the gDM flow
support or not.
feat(ScreenObtainer): add more control over screen obtainer (#2371)
* feat(ScreenObtainer): add more control over screen obtainer
* fix(ScreenObtainer): fix constraints to select a preferential display surface
* fix(ScreenObtainer): remove Safari version check for displaySurface
* fix(ScreenObtainer): move all settings under screenShareSettings
feat(ScreenObtainer) Allow seamless switching of tab capture.
Allow users to seamlessly switch which tab they are sharing without having to stop the current share and select a new tab again. This is supported on Chrome 107 onwards.
feat(RTC): Add the ability to change desktop share fps.
Provide a method for changing the capture fps for desktop tracks during the call. These changes to the lib are needed for making it configurable from the UI.
fix: high CPU on Chrome with low fps screen sharing (#1570)
* fix: high CPU on Chrome with low fps screen sharing
It turns out that if 5 fps is set on the track constraints,
Chrome will capture the original video in 30 fps and only
further down the pipeline will downsample it to 5 fps.
This results in very high CPU usage. Specify max FPS in
getDisplayMedia to fix the problem.
Getting rid of track.applyConstraints should also fix another
issue on Firefox where it reports 0x0 screen size after this call.
* ref(RTCUtils): remove trackOptions
* remove extra &&
Both of the cases where user clicks cancel and when screen recording
permissions were not granted at the OS level are almost the same,
except for a small difference in the error.message.
This was only tested on Chrome 85.0.4183.121/Mac OS 10.15.6