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
please give me suggestions that is there any thing need to add to my project.
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.
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.
- http://stackoverflow.com/questions/40595830/simple-example-for-accessing-the-camera-via-webrtc-in-react-native-android
- https://github.com/oney/react-native-webrtc/blob/master/Documentation/iOSInstallation.md
- facebook/react-native#4968
From the error message, here are the steps I followed to get the app working correctly on my phone.
- remove npm module: rm -rf $YourProject/node_modules/react-native-webrtc
- watchman watch-del-all
- clean npm cache: npm cache clean
- npm install react-native-webrtc
- npm start -- --reset-cache
- In xocde project, click Product -> clean
- Build/Run on my test iPhone, NOT in simulator.
thanks for sharing, mate!
So on simulator demo won't work?
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
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?