mirror of
https://github.com/xtr-dev/rondevu-demo.git
synced 2025-12-15 12:33:23 +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) {
|
if (event.candidate) {
|
||||||
console.log(' 📤 Sending ICE candidate')
|
console.log(' 📤 Sending ICE candidate')
|
||||||
try {
|
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(
|
await rondevu.getAPIPublic().addOfferIceCandidates(
|
||||||
serviceData.serviceFqn,
|
serviceData.serviceFqn,
|
||||||
serviceData.offerId,
|
serviceData.offerId,
|
||||||
[event.candidate.toJSON()]
|
[candidateInit]
|
||||||
)
|
)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(' ❌ Failed to send ICE candidate:', err.message)
|
console.error(' ❌ Failed to send ICE candidate:', err.message)
|
||||||
|
|||||||
Reference in New Issue
Block a user