Comments (11)
Do you connect with internet? Because the default STUN server is 18.191.223.12
from libpeer.
Yes.
I tracked down the problem and here is the workaround diff which makes example work (record.h264
gets saved):
--- a/examples/recording/index_html.h
+++ b/examples/recording/index_html.h
@@ -13,6 +13,7 @@ const char index_html[] = " \
<body> \n \
<video style='display:block; margin: 0 auto;' id='localVideo' autoplay muted></video> \n \
<script> \n \
+ var counter=0; \n \
function jsonRpc(payload, cb) { \n \
var xhttp = new XMLHttpRequest(); \n \
xhttp.onreadystatechange = function() { \n \
@@ -45,7 +46,14 @@ console.log(JSON.parse(atob(sdp))); \n\
} \n \
} \n \
pc.onicecandidate = event => { \n \
- if (event.candidate === null) { \n \
+ counter++; \n \
+ console.log(\"counter = \" + String(counter)); \n \
+ console.log(event); \n \
+ if (event.candidate === null || event.candidate.address.length > 15) { \n \
+ console.log(\"ignoring this event\") \n \
+ } \n \
+ else \n \
+ { \n \
let sdp = pc.localDescription.sdp; \n \
var payload = {\"jsonrpc\": \"2.0\", \"method\": \"call\", \"params\": btoa(sdp)}; \n \
jsonRpc(payload, jsonRpcHandle); \n \
(counter
is used only for debugging.)
from libpeer.
OK, Thanks!
from libpeer.
I have no experience with javascript and the workaround was found just empirically. It definitely needs a more correct approach.
from libpeer.
I see you ignoring the ice candidate which the length of address is larger than 15. I guess it is a mDNS address. I tried to remove it and transfer to a ipv4 address, but it still seems to have some problems. I will check that.
from libpeer.
I'm not only ignoring candidates which are not IPs basically, but since there is only one IP candidate, jsonRpc
is called only once. Otherwise, setRemoteDescription
was called 2 times what caused an error.
Without my changes jsonRpc
was not called at all, because the condition for calling was event.candidate === null
(now it's the opposite).
from libpeer.
I used chrome://webrtc-internals
for debugging.
from libpeer.
According to the onicecanidate API, if the event's candidate property is null, ICE gathering has finished. It should be waited until all candidates are obtained, then send the offer. So you don't get event with null candidate property?
from libpeer.
So you don't get event with null candidate property?
It seems the browser does not get event with null candidate property. Log without workaround:
11/29/2021, 2:07:23 PM transceiverAdded
11/29/2021, 2:07:23 PM createOffer
11/29/2021, 2:07:23 PM negotiationneeded
11/29/2021, 2:07:23 PM createOfferOnSuccess (type: "offer", 2 sections)
11/29/2021, 2:07:23 PM setLocalDescription (type: "offer", 2 sections)
11/29/2021, 2:07:23 PM setLocalDescriptionOnSuccess
11/29/2021, 2:07:23 PM signalingstatechange
11/29/2021, 2:07:23 PM transceiverModified
11/29/2021, 2:07:23 PM icegatheringstatechange
11/29/2021, 2:07:23 PM icecandidate (host)
11/29/2021, 2:07:23 PM icecandidate (srflx)
When workaround is in use the log continues further with setRemoteDescription (type: "answer", 2 sections)
.
from libpeer.
After getting null candidate, the browser should call jsonRpc
function to send the offer to recording program. When recording program accepts the offer and response an answer, browser should be callback to jsonRpcHandle
and setRemoteDescription
.
I think the recording program doesn't response the answer, because mDNS parse failed or it need more time to resolve.
I created a branch to disable mDNS resolver. If possible, please try again. Thanks.
from libpeer.
This example is no longer supported
from libpeer.
Related Issues (20)
- [QUESTION] Can it work with ESP32 Arduino? HOT 2
- whip的esp32s3编译报错 HOT 6
- mdns? HOT 3
- Error during make HOT 1
- the sample demo in waiting status forever HOT 7
- missing headers HOT 2
- Windows support HOT 5
- Is usrsctp required to open the data channel for string HOT 1
- Support WHEP
- Permissions and candidates
- IPv6 support HOT 1
- how to test
- libpeer does not work in Firefox, and takes ~40s to load in Chrome HOT 2
- Candidate pairs are not tested based on priority.
- Where to set ICE Candidate generate by remote?
- Can't compile for Arduino ESP32. HOT 1
- ports_resolve_mdns_host always return -1 for ESP32
- More documentation please + Arduino support if possible
- Is libpeer ice connection only support a=setup:passive?
- Any support or idea how to run on STM32 MCU ? thanks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libpeer.