mirror of
https://github.com/xtr-dev/rondevu-demo.git
synced 2025-12-13 03:53:22 +00:00
Fix: Manually serialize ICE candidates for wrtc compatibility
wrtc library doesn't have toJSON() method on RTCIceCandidate. Manually extract candidate properties instead.
This commit is contained in:
@@ -118,10 +118,17 @@ async function main() {
|
||||
if (event.candidate) {
|
||||
console.log(' 📤 Sending ICE candidate')
|
||||
try {
|
||||
// wrtc doesn't have toJSON, manually create the object
|
||||
const candidateInit = {
|
||||
candidate: event.candidate.candidate,
|
||||
sdpMLineIndex: event.candidate.sdpMLineIndex,
|
||||
sdpMid: event.candidate.sdpMid,
|
||||
usernameFragment: event.candidate.usernameFragment
|
||||
}
|
||||
await rondevu.getAPIPublic().addOfferIceCandidates(
|
||||
serviceData.serviceFqn,
|
||||
serviceData.offerId,
|
||||
[event.candidate.toJSON()]
|
||||
[candidateInit]
|
||||
)
|
||||
} catch (err) {
|
||||
console.error(' ❌ Failed to send ICE candidate:', err.message)
|
||||
|
||||
Reference in New Issue
Block a user