question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[iOS] `getDisplayMedia()` not working

See original GitHub issue

I have this RN app which was setup via Expo SDK 46 and, after realizing screen capture is provided by this package, I’ve decided to give it a try. I already had a working webrtc display app (using PeerJS), so I’ve created a simple RN client app with a button for obtaining a stream and connecting to the display and share it.

If I use getUserMedia({ video: true }) then I can see my camera feed being shared on the screen. However, if I use getDisplayMedia(), I get a blank stream.

The call to getDisplayMedia() doesn’t seem to fail and I get a stream though:

{"_reactTag": "A15DC054-32BA-4A9C-96BD-F02CF5D79923", "_tracks": [{"_constraints": [Object], "_enabled": true, "_muted": false, "_settings": [Object], "id": "3384
03C0-2147-409F-90D8-4347ED9CC0E0", "kind": "video", "label": "338403C0-2147-409F-90D8-4347ED9CC0E0", "readyState": "live", "remote": false}], "active": true, "id": "A15
DC054-32BA-4A9C-96BD-F02CF5D79923"}

I also couldn’t spot anything obvious on iOS syslog.

Expected Behavior

I would expect some sort of pop-up to ask for permissions to record screen, and then would expect to see my phone screen being shared on my display app.

Observed Behavior

Instead I get a blank stream, which reports 0 FPS on the display side.

Steps to reproduce the issue

  • Create Expo app
  • Install react-native-webrtc and @config-plugins/react-native-webrtc
  • Configure config plugin in app.json
  • Build development app via EAS and install on iPhone
  • Run sample code (via expo start --dev-client)

Platform Information

  • React Native Version: 0.69.4
  • Plugin Version: 1.100.1
  • OS: iOS
  • OS Version: 15.6

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
matalluicommented, Aug 17, 2022

Finally got it to work on iOS. I guess I was missing the whole ScreenCapturePickerView logic.

Even though I got it working, a few notes:

  • it’s still not clear to me what the workflow for ScreenCapturePickerView is (in terms of what it exactly does and timings)
  • the FPS on the stream are pretty low and, after some time, the stream stopped working (not the screen recorder) for no apparent reason (not sure if I did something wrong, or if it’s just an issue)

Either way, thanks for the help!! I’ll close this issue for now, but would like to see this better documented so everyone can understand exactly what to do to get screen capture working.

I’d be happy to help in whatever I can…

1reaction
saghulcommented, Aug 26, 2022

I didn’t know that was possible with Expo plugins, nice!

Read more comments on GitHub >

github_iconTop Results From Across the Web

getDisplayMedia() not working correctly on Android device
1 Answer 1 ... getDisplayMedia() is not supported on android and iOS. As per link it is not currently supported in iOS or...
Read more >
MediaDevices.getDisplayMedia() - Web APIs | MDN
The MediaDevices interface's getDisplayMedia() method prompts the user to select and grant permission to capture the contents of a display or portion ...
Read more >
Safari and iOS Safari - Implement Screen Capture API #8576
This is to track screen sharing in Appleland. Current status of getDisplayMedia() - https://developer.mozilla.org/en-US/docs/Web/API/ ...
Read more >
231455 – [iOS] Support getDisplayMedia - WebKit Bugzilla
Is there a way capture can fail? > Source/WebCore/platform/mediastream/ios/ReplayKitCaptureSource.mm:237 > + static constexpr Seconds ...
Read more >
Does getUserMedia works on iOS? | Apple Developer Forums
Hi,. getusermedia working in iOS 11.3 in the safari browser but not working in chrome browser. if it is possible to make it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found