screenshare stream publishing with react native

Guys, let’s clarify things. Please answer to this question with a clear response:

  • When using getDisplayMedia() the issue also happens when running your code in Chrome browser with Chrome55 handler. Yes or not?

Chrome browser on Android or on Windows?

Both.

It works on desktop only. There is no getDisplayMedia on android chrome https://caniuse.com/#search=getDisplayMedia . We are working with mobile app on react native which has getDisplayMedia. Stream perfectly works with p2p webrtc but not supported for some reason with mediasoup-client. That’s why we are asking for help.

Well, the problem is that I say things during the thread and you just ignore them and paste whatever other code or logs, so it’s extremely hard to focus and understand the scenario.

For instance, I asked:

Your response:

In that response I assume you are doing what I asked, this is, testing your code in desktop Chrome browser with Chrome55 handler. And that response shows the same error in the logs.
Now honestly I have no idea if you did that or not.

So what is the log above in your response with Chrome55 handler logs?

It’s about getDisplayMedia.

I think you understand that it’s imposible to run react native code with react native stream on desktop. We only can use Chrome55 handler with react native like we show you before. And for camera it works as good as ReactNative handler. But for screenshare both don’t work.

So, React-Native is no more supported by mediasoup?

I said react-native-webrtc. I’m not the author or maintainer of it.

But stream perfectly works in p2p webrtc as we said. So there is no problem with it, it’s only not supported by mediasoup.

I understand that yesterday I did a specific question, I assumed you answered to it, and then I spent time modifying the mediasoup-demo project locally to behave as your scenario (by just enabling screen sharing without mic/webcam/datachannel). And I tested it with Chrome55 handler and it worked perfectly. Then I told that here. Then it was completely useless because I got this as response:

Now, let’s clarify some things:

  • react-native-webrtc handles its own MediaStream and MediaStreamTrack wrappers. It does NOT work with native MediaStream(Track) obtained via native getDisplayMedia().
  • react-native-webrtc is a JavaScript layer that “behaves” as a PeerConnection and talks to a native Java/ObjC layer (for Android on iOS) and such a native layer uses libwebrtc C++ library.
  • There is no support for getDisplayMedia() in react-native-webrtc, so you cannot obtain a native MediaStreamTrack using native getDisplayMedia and expect it to work with react-native-webrtc. In fact, react-native-webrtc just works with tracks generated by itself. That’s why it implements getUserMedia(). But it does not implement getDisplayMedia(). That would be a good addition for react-native-webrtc project but nothing that we can do in mediasoup-client.
  • And yes, the error (“no active media section found”) makes 100% sense given this rationale.

In p2p WebRTC using react-native-webrtc?

Yes, it’s the same stream which track we are publishing with mediasoup producer.
https://puu.sh/FsF3n/df317c09e4.mp4
We got this stream in google chrome and will try to re-publish with mediasoup. Maybe this way it will work.

Try uninstalling react-native-webrtc from your app and try again in your p2p code. It will work, because you are not using it.

Thanks, will try.

If you are using getDisplayMedia in React Native, then you are using this fork/branch of react-native-webrtc:

May I know why you did not mention this?

Sorry for not mention. Our mobile devs use only this part https://github.com/jitsi/react-native-webrtc/tree/getdisplaymedia from the fork in our own fork of original https://github.com/react-native-webrtc/react-native-webrtc

It’s hard to help if you use a fork of a dependency of mediasoup-client and don’t tell it. I’m afraid there is a bug in that fork. And somehow I’m here giving support about a library that I don’t maintain.

  • Update mediasoup-client to the latest version 3.6.4.
  • Edit lib/handler/ReactNative.js, just before line 194 (if (!this._transportReady)) add:
console.warn('--- send() offer.sdp:\n', offer.sdp);
console.warn('--- send() localSdpObject:\n', JSON.stringify(localSdpObject, null, '  '));

Paste the result. Spoiler: there is a bug in that fork. mediasoup-client does not care the source/nature of the given video track. No bug here.

backend.js:32 — send() offer.sdp:
v=0
o=- 1633699851668386384 2 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS

backend.js:32 — send() localSdpObject:
{
“version”: 0,
“origin”: {
“username”: “-”,
“sessionId”: “1633699851668386384”,
“sessionVersion”: 2,
“netType”: “IN”,
“ipVer”: 4,
“address”: “127.0.0.1”
},
“name”: “-”,
“timing”: {
“start”: 0,
“stop”: 0
},
“msidSemantic”: {
“semantic”: “”,
“token”: “WMS”
},
“media”: []
}

pretty much empty.

Exactly. Just talked to his author. That fork is not ready at all and it’s not in sync with latest versions of mainstream project. Nothing I can do.

So essentially you don’t have any advice apart from restreaming this through a headless chrome on the server (obviously workable, but very crude solution)?

And yes, then again; just sending the screenshare stream through p2p, works fine. We are able to reliably receive it on a desktop Chrome. Through the same forked version.