ReferenceError: Can't find variable: RTCRtpReceiver

hi,
I try to build a mobile app with react-native , on server side everything works perfectly i can create router and send routerRtpCapabilities but on mobile side when i try to create device i receive this error i already google it but there is nothing i can found , i ask here maybe someone can say what is it

before advices what i done =>

mediasoupClient.detectDevice()

Performs current browser/device detection and returns the corresponding mediasoup-client WebRTC handler name (or nothing if the browser/device is not supported).

@async

@returns BuiltinHandlerName | undefined

const handlerName = mediasoupClient.detectDevice();

if (handlerName) {
  console.log("detected handler: %s", handlerName);
} else {
  console.warn("no suitable handler found for current browser/device");
}

when i run code above to check browser result === // no suitable handler found for current browser/device

so what am i gonna do reinstall Chrome or Edge11 ?

and also
react-native-webrtc globalRegistiry is done with all build.gradle and java etc

reasen can be Browsers ===>>

if i use // const device = new Device({handlerName: “Edge11”})
i can create device but can not load it gives this error
error log is // ReferenceError:Can’t find variable: RTCRtpReceiver

and if i use // const device = new Device({handlerName: “Chrome55”})
i ca not even create device and error log
// ReferenceError: Can’t find variable: MediaStream

here is the code =>

import * as mediasoup from ‘mediasoup-client’

let device = null

export async function main() {

try {
  device = new mediasoup.Device({handlerName: "Chrome55"})
  console.log(device.handlerName)
  
  return device
} catch (e) {
  if (e.name === 'UnsupportedError') {
    console.error('browser not supported')
    return;
  } else {
    console.error('new Device',e);
  }
}

}

export async function joinRoom(routerRtpCapabilities) {

console.log('join room')

await device.load({routerRtpCapabilities});


return routerRtpCapabilities;

and react-native logs

socket.io message: {“id”: “FaRP230022-46l2GAABR”, “type”: “welcome”}
LOG connected to server. clientId=FaRP230022-46l2GAABR
LOG getRouterRtpCapabilities: {“codecs”: [{“channels”: 2, “clockRate”: 48000, “kind”: “audio”, “mimeType”: “audio/opus”, “parameters”: [Object], “preferredPayloadType”: 100, “rtcpFeedback”: [Array]}], “headerExtensions”: [{“direction”: “sendrecv”, “kind”: “audio”, “preferredEncrypt”: false, “preferredId”: 1, “uri”: “urn:ietf:params:rtp-hdrext:sdes:mid”}, {“direction”: “sendrecv”, “kind”: “video”, “preferredEncrypt”: false, “preferredId”: 1, “uri”: “urn:ietf:params:rtp-hdrext:sdes:mid”}, {“direction”: “recvonly”, “kind”: “video”, “preferredEncrypt”: false, “preferredId”: 2, “uri”: “urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id”}, {“direction”: “recvonly”, “kind”: “video”, “preferredEncrypt”: false, “preferredId”: 3, “uri”: “urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id”}, {“direction”: “sendrecv”, “kind”: “audio”, “preferredEncrypt”: false, “preferredId”: 4, “uri”: “docs/native-code/rtp-hdrext/abs-send-time - src - Git at Google”}, {“direction”: “sendrecv”, “kind”: “video”, “preferredEncrypt”: false, “preferredId”: 4, “uri”: “docs/native-code/rtp-hdrext/abs-send-time - src - Git at Google”}, {“direction”: “recvonly”, “kind”: “audio”, “preferredEncrypt”: false, “preferredId”: 5, “uri”: “http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01”}, {“direction”: “sendrecv”, “kind”: “video”, “preferredEncrypt”: false, “preferredId”: 5, “uri”: “http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01”}, {“direction”: “sendrecv”, “kind”: “video”, “preferredEncrypt”: false, “preferredId”: 6, “uri”: “draft-ietf-avtext-framemarking-07”}, {“direction”: “sendrecv”, “kind”: “video”, “preferredEncrypt”: false, “preferredId”: 7, “uri”: “urn:ietf:params:rtp-hdrext:framemarking”}, {“direction”: “sendrecv”, “kind”: “audio”, “preferredEncrypt”: false, “preferredId”: 10, “uri”: “urn:ietf:params:rtp-hdrext:ssrc-audio-level”}, {“direction”: “sendrecv”, “kind”: “video”, “preferredEncrypt”: false, “preferredId”: 11, “uri”: “urn:3gpp:video-orientation”}, {“direction”: “sendrecv”, “kind”: “video”, “preferredEncrypt”: false, “preferredId”: 12, “uri”: “urn:ietf:params:rtp-hdrext:toffset”}]}
ERROR new Device [ReferenceError: Can’t find variable: MediaStream]
LOG join room
WARN Possible Unhandled Promise Rejection (id: 0):
TypeError: null is not an object (evaluating 'device.load()

If anyone need some other logs or want to test other things just ask me
Thanks

1 Like