oney/RCTWebRTCDemo

getting error(evaluating 'webRTCModule.mediaStreamTrackGetSources')

Opened this issue ยท 17 comments

Hai, i cloned your repo and run as per the document,facing problem when using the code in separate project, getting an error like this undefined is not an object(evaluating 'WebRTCModule.mediaStreamTrackGetSources') below is the error
error
please give me suggestions that is there any thing need to add to my project.

Here i tried some part(added the frameWorks) above error is not showing but not running in xcode facing error like arm64 below is the error
screen shot 2016-08-25 at 4 36 15 pm
Please respond for it

please respond

Please respond

I also have same bug when get local stream via RTCView to my source code. I tried with same react, react-native, react-native-webrtc libs version, but no luck. Can someone suggest me about this issue?

please try latest demo which use master branch of react-native-webrtc now

any support on this, guys? still not working

what is your error exactly?

  • the demo itself, or your own project.
  • the version of webrtc or demo
  • use case
  • how to reproduce it
  • what have you tried
  • a bit of code snippets would help.

Howdy!

I've also encountered this error. Let me see if I can provide a little more info that could help.

  • Running RCTWebRTCDemo master branch, pulled today.
  • React Native v 0.40
  • React Native CLI v 2.0.1
  • MacOS 10.11.6
  • Xcode 8.2.1
  • Encountered running Simulator with iPhone 6, and also simulating on a real iPhone 6S.

I haven't really tried anything to fix it yet, but I got the same-ish error message as shaikhussian.

screen shot 2017-01-16 at 11 54 08 am

I followed the error messages to the following code snippets:
getSources
MediaStreamTrack.js:30

export default class MediaStreamTrack extends EventTarget(MEDIA_STREAM_TRACK_EVENTS) {
  static getSources(success: (sources: Array<SourceInfo>) => void) {
    WebRTCModule.mediaStreamTrackGetSources(success);
  }

getLocalStream
main.js:205

  MediaStreamTrack.getSources(sourceInfos => {
    console.log(sourceInfos);
    let videoSourceId;
    for (const i = 0; i < sourceInfos.length; i++) {
      const sourceInfo = sourceInfos[i];
      if(sourceInfo.kind == "video" && sourceInfo.facing == (isFront ? "front" : "back")) {
        videoSourceId = sourceInfo.id;
      }
    }

unknown
main.js:205

socket.on('connect', function(data) {
  console.log('connect');
  getLocalStream(true, function(stream) {
    localStream = stream;
    container.setState({selfViewSrc: stream.toURL()});
    container.setState({status: 'ready', info: 'Please enter or create room ID'});
  });
});

Also, I had run into the same problem as reported in this issue: #41
I was able to silence the error by making the change listed there, but I dont know if that some affected socket.io down the line.

Also, here's the console log for when I tried to run the code in the Simulator.

2017-01-16 12:15:14.833410 RCTWebRTCDemo[17641:913618] [] nw_host_stats_add_src recv too small, received 24, expected 28
2017-01-16 12:15:14.833928 RCTWebRTCDemo[17641:913618] [] nw_host_stats_add_src recv too small, received 24, expected 28
2017-01-16 12:15:14.836077 RCTWebRTCDemo[17641:913617] [] nw_host_stats_add_src recv too small, received 24, expected 28
2017-01-16 12:15:14.854 [info][tid:main][RCTBatchedBridge.m:72] Initializing <RCTBatchedBridge: 0x60000018b120> (parent: <RCTBridge: 0x6080000b2660>, executor: RCTJSCExecutor)
2017-01-16 12:15:14.961632 RCTWebRTCDemo[17641:913618] [] nw_host_stats_add_src recv too small, received 24, expected 28
2017-01-16 12:15:15.046773 RCTWebRTCDemo[17641:913632] [] nw_host_stats_add_src recv too small, received 24, expected 28
2017-01-16 12:15:15.177308 RCTWebRTCDemo[17641:913632] [] nw_host_stats_add_src recv too small, received 24, expected 28
2017-01-16 12:15:15.182019 RCTWebRTCDemo[17641:913632] [] nw_host_stats_add_src recv too small, received 24, expected 28
2017-01-16 12:15:15.185040 RCTWebRTCDemo[17641:913632] [] ____nwlog_simulate_crash_inner_block_invoke dlopen CrashReporterSupport failed
2017-01-16 12:15:15.185331 RCTWebRTCDemo[17641:913632] [] __nwlog_err_simulate_crash simulate crash failed "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"
2017-01-16 12:15:15.186367 RCTWebRTCDemo[17641:913632] [] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
        [x86_64] libnetcore-856.30.16
    0   libsystem_network.dylib             0x0000000109443666 __nw_create_backtrace_string + 123
    1   libnetwork.dylib                    0x0000000109cb1006 nw_socket_add_input_handler + 3164
    2   libnetwork.dylib                    0x0000000109c8e555 nw_endpoint_flow_attach_protocols + 3768
    3   libnetwork.dylib                    0x0000000109c8d572 nw_endpoint_flow_setup_socket + 563
    4   libnetwork.dylib                    0x0000000109c8c298 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
    5   libnetwork.dylib                    0x0000000109ca7ae1 nw_endpoint_handler_path_change + 1261
    6   libnetwork.dylib                    0x0000000109ca7510 nw_endpoint_handler_start + 570
    7   libnetwork.dylib                    0x0000000109cbf1f9 nw_endpoint_resolver_start_next_child + 2240
    8   libdispatch.dylib                   0x00000001091c0978 _dispatch_call_block_and_release + 12
    9   libdispatch.dylib                   0x00000001091ea0cd _dispatch_client_callout + 8
    10  libdispatch.dylib                   0x00000001091c7e17 _dispatch_queue_serial_drain + 236
    11  libdispatch.dylib                   0x00000001091c8b4b _dispatch_queue_invoke + 1073
    12  libdispatch.dylib                   0x00000001091cb385 _dispatch_root_queue_drain + 720
    13  libdispatch.dylib                   0x00000001091cb059 _dispatch_worker_thread3 + 123
    14  libsystem_pthread.dylib             0x00000001095934de _pthread_wqthread + 1129
    15  libsystem_pthread.dylib             0x0000000109591341 start_wqthread + 13
2017-01-16 12:15:15.189735 RCTWebRTCDemo[17641:913632] [] __nw_connection_get_connected_socket_block_invoke 4 Connection has no connected handler
2017-01-16 12:15:15.242 [warn][tid:com.facebook.react.JavaScript] Warning: Native component for "RTCVideoView" does not exist
2017-01-16 12:15:15.247 [info][tid:com.facebook.react.WebSocketModuleQueue][RCTSRWebSocket.m:555] SocketRocket: In debug mode.  Allowing connection to any root cert
2017-01-16 12:15:15.314889 RCTWebRTCDemo[17641:913632] [] nw_host_stats_add_src recv too small, received 24, expected 28
2017-01-16 12:15:15.317257 RCTWebRTCDemo[17641:913632] [] __nwlog_err_simulate_crash simulate crash already simulated "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"

Okay I got to the bottom of this (kinda). I just didn't setup the iOS project correctly.
I followed the directions from here and here and here. Turns out this problem was already addressed by @zxcpoiu on Stack Overflow.

From the error message, here are the steps I followed to get the app working correctly on my phone.

  1. remove npm module: rm -rf $YourProject/node_modules/react-native-webrtc
  2. watchman watch-del-all
  3. clean npm cache: npm cache clean
  4. npm install react-native-webrtc
  5. npm start -- --reset-cache
  6. In xocde project, click Product -> clean
  7. Build/Run on my test iPhone, NOT in simulator.

thanks for sharing, mate!

So on simulator demo won't work?

0x5e commented

Try this (iOS):
Targets(RCTWebRCTDemo) => Build Phrases => Link Binary With Libraries
Add libRCTWebRTC.a, rebuild

Be sure to do a react-native link

This will install the native code. I had this problem until I did this

@jam1401 It works like a charm! Thanks ;)

You should update your version: "react-native-webrtc": "^1.67.1"

It's work for me !!!

I've tried all solutions here... still doesn't work.
I even tried starting a new project

I have the libraries linked, and I followed the IOS installation
I ran react-native link

My react-native-webrtc version: "react-native-webrtc": "^1.69.1"

I also followed the suggestion by @rfelixallen

Nothing is fixing it... any other ideas?