Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Urgent] TwilioError: Client is unable to apply a remote media description (twilio-video.js@v2.5.0) #1057

Closed
kumail-raza opened this issue Jun 10, 2020 · 15 comments
Assignees
Labels
needs more information Issues that require more information to resolve, such as Room SIDs, SDK versions, etc.

Comments

@kumail-raza
Copy link

kumail-raza commented Jun 10, 2020

@manjeshbhargav

Just after upgrade to Twilio Video SDK to 2.5.0, I am start receiving following warning and error. Not getting any idea what causing it so, can you guys have any idea or direction for me to look further?

Warning:

twilio-video.js:20066 >
2020-06-10 07:59:18.348Z | WARN in [PeerConnectionV2 #1: 7fdc73be-8fd9-42e8-b382-d794d6362015]: Calling setRemoteDescription with an RTCSessionDescription of type "answer" failed with the error "Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': The RTCPeerConnection's signalingState is 'closed'."

twilio-video.js:20066 2020-06-10 07:59:18.349Z | WARN in [PeerConnectionV2 #1: 7fdc73be-8fd9-42e8-b382-d794d6362015]: The SDP was v=0
o=- 3800764758 3800764758 IN IP4 0.0.0.0
s=VM9de82b73bc7d1589937b629c5bfaa408
t=0 0
a=msid-semantic: WMS
a=ice-lite
a=group:BUNDLE 0 1
a=msid-semantic:WMS *
m=audio 11245 UDP/TLS/RTP/SAVPF 111 0
c=IN IP4 3.235.111.154
a=setup:active
a=inactive
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=mid:0
a=rtcp:11245 IN IP4 3.235.111.154
a=rtpmap:111 opus/48000/2
a=rtpmap:0 PCMU/8000
a=rtcp-mux
a=fmtp:111 minptime=10;useinbandfec=1
a=ice-ufrag:KdEO
a=ice-pwd:oB+TVQCHam2Aq7WUj/xOtt
a=fingerprint:sha-256 E9:EE:76:37:06:71:CE:E5:4B:59:2A:B8:3E:59:E3:9E:05:96:0A:8B:07:34:18:41:7E:45:32:6E:16:0F:4F:E8
a=candidate:2 1 UDP 2013266430 3.235.111.154 11245 typ host
a=candidate:2 2 UDP 2013266429 3.235.111.154 15796 typ host
m=video 11245 UDP/TLS/RTP/SAVPF 96 125 114 116
c=IN IP4 3.235.111.154
a=rtcp-rsize
a=setup:active
a=inactive
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=mid:1
a=rtcp:11245 IN IP4 3.235.111.154
a=rtpmap:96 VP8/90000
a=rtpmap:125 H264/90000
a=rtpmap:114 red/90000
a=rtpmap:116 ulpfec/90000
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtcp-fb:125 goog-remb
a=rtcp-fb:125 ccm fir
a=rtcp-fb:125 nack
a=rtcp-fb:125 nack pli
a=rtcp-mux
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=ice-ufrag:KdEO
a=ice-pwd:oB+TVQCHam2Aq7WUj/xOtt
a=fingerprint:sha-256 E9:EE:76:37:06:71:CE:E5:4B:59:2A:B8:3E:59:E3:9E:05:96:0A:8B:07:34:18:41:7E:45:32:6E:16:0F:4F:E8
a=candidate:2 1 UDP 2013266430 3.235.111.154 11245 typ host
a=candidate:2 2 UDP 2013266429 3.235.111.154 15796 typ host

Error:

core.js:1440 ERROR Error: Uncaught (in promise): TwilioError: Client is unable to apply a remote media description
TwilioError: Client is unable to apply a remote media description
    at MediaClientRemoteDescFailedError.TwilioError (twilio-video.js:23194)
    at new MediaClientRemoteDescFailedError (twilio-video.js:23011)
    at twilio-video.js:11580
    at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:388)
    at Object.onInvoke (core.js:4733)
    at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:387)
    at Zone.webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:138)
    at zone.js:872
    at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:4724)
    at resolvePromise (zone.js:814)
    at resolvePromise (zone.js:771)
    at zone.js:873
    at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:4724)
    at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at drainMicroTaskQueue (zone.js:595)
defaultErrorLogger @ core.js:1440
webpackJsonp../node_modules/@angular/core/esm5/core.js.ErrorHandler.handleError @ core.js:1501
next @ core.js:5481
schedulerFn @ core.js:4319
webpackJsonp../node_modules/rxjs/_esm5/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:239
webpackJsonp../node_modules/rxjs/_esm5/Subscriber.js.SafeSubscriber.next @ Subscriber.js:186
webpackJsonp../node_modules/rxjs/_esm5/Subscriber.js.Subscriber._next @ Subscriber.js:127
webpackJsonp../node_modules/rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:91
webpackJsonp../node_modules/rxjs/_esm5/Subject.js.Subject.next @ Subject.js:56
webpackJsonp../node_modules/@angular/core/esm5/core.js.EventEmitter.emit @ core.js:4299
(anonymous) @ core.js:4755
webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:388
webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:138
webpackJsonp../node_modules/@angular/core/esm5/core.js.NgZone.runOutsideAngular @ core.js:4681
onHandleError @ core.js:4755
webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.handleError @ zone.js:392
webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.runGuarded @ zone.js:154
_loop_1 @ zone.js:677
api.microtaskDrainDone @ zone.js:686
drainMicroTaskQueue @ zone.js:602
Promise.then (async)
scheduleMicroTask @ zone.js:578
webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:410
onScheduleTask @ zone.js:297
webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:401
webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:232
webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask @ zone.js:252
scheduleResolveOrReject @ zone.js:862
resolvePromise @ zone.js:808
(anonymous) @ zone.js:724
Promise.then (async)
(anonymous) @ zone.js:1042
ZoneAwarePromise @ zone.js:891
Ctor.then @ zone.js:1041
resolvePromise @ zone.js:775
(anonymous) @ zone.js:873
webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:421
onInvokeTask @ core.js:4724
webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:420
webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.runTask @ zone.js:188
drainMicroTaskQueue @ zone.js:595
webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask @ zone.js:500
invokeTask @ zone.js:1540
globalZoneAwareCallback @ zone.js:1566

Chrome: Version 83.0.4103.61 (Official Build) (64-bit)
Twilio Client SDK : 1.11
Twilio Video SDK : 2.5.0
Angular: 5+

@kumail-raza kumail-raza changed the title TwilioError: Client is unable to apply a remote media description TwilioError: Client is unable to apply a remote media description (v2.5.0) Jun 10, 2020
@kumail-raza kumail-raza changed the title TwilioError: Client is unable to apply a remote media description (v2.5.0) TwilioError: Client is unable to apply a remote media description (twilio-video.js@v2.5.0) Jun 10, 2020
@kumail-raza
Copy link
Author

@philnash @manjeshbhargav

Kindly check and update let I know if any futher details require from my side?

@kumail-raza kumail-raza changed the title TwilioError: Client is unable to apply a remote media description (twilio-video.js@v2.5.0) [Urgent] TwilioError: Client is unable to apply a remote media description (twilio-video.js@v2.5.0) Jun 17, 2020
@pRoy24
Copy link

pRoy24 commented Jun 23, 2020

Hitting the same issue after upgrading to v2.5.1 ..upgraded hoping to resolve an issue one of our customers is facing in which the remove video intermittently shows a black screen on firefox.

@manjeshbhargav
Copy link
Collaborator

Hi @kumail-raza ,

Thanks for reporting this issue. It looks like this may happen mostly while you are disconnecting from a Room. Did you see any side-effects related to media because of this?

Thanks,

Manjesh Malavalli
JSDK Team

@manjeshbhargav manjeshbhargav self-assigned this Jun 23, 2020
@manjeshbhargav manjeshbhargav added the needs more information Issues that require more information to resolve, such as Room SIDs, SDK versions, etc. label Jun 23, 2020
@kumail-raza
Copy link
Author

It looks like this may happen mostly while you are disconnecting from a Room.

Can you elaborate it bit more?

@pRoy24
Copy link

pRoy24 commented Jul 8, 2020

Also after upgrading the 2.5.0 room._options.iceServers is undefined

This is causing tis code in our app to fail
connectOptions['iceServers'] = room._options.iceServers.filter((iceServer) => iceServer.urls.startsWith("turn"))

@kumail-raza
Copy link
Author

@pRoy24 Didn't understand are you from Twilio Team and answering or a user of Twilio?

@pRoy24
Copy link

pRoy24 commented Jul 14, 2020

@pRoy24 Didn't understand are you from Twilio Team and answering or a user of Twilio?

Not from Twilio team... I am also a user

@kumail-raza
Copy link
Author

@manjeshbhargav no I didn't notice any side effect just that my application flow breaks and app crashes. Well we have feature to check network connectivity, similar to one that you guys have https://networktest.twilio.com/, basically not wrong we integrate that into our application the rules and test it is performing. Well we have remove that feature as it not giving actual result as we find users with very high bandwidth internet testing response with slow internet speed.

So for me this issue resolve with the removal of that feature. We will see later when we need it back.

@masious
Copy link

masious commented Sep 24, 2020

I'm experiencing the same issue. Any updates?

@tavoohoh
Copy link

tavoohoh commented Dec 9, 2021

I am facing this error too. I am implementing twilio video in a vue app for both web and iOS/Android devices using capacitor. The web version video is working, it connect to peer-to-peer or group rooms (showing video and audio) but in the iOS version the remote video is a black screen, also no audio is received.

The console is throwing the following warning:

"warn" – "[PeerConnectionV2 #2: a25247b4-ca57-42c2-b3fe-54a7db1b8487]"
"Calling setRemoteDescription with an RTCSessionDescription of type \"answer\" failed with the error \"Failed to set remote answer sdp: The order of m-lines in answer doesn't match order in offer. Rejecting answer.\"."

And the following error:

Unhandled Promise Rejection: TwilioError: Client is unable to apply a remote media description

And after seconds the following error:

WebSocket connection to 'wss://sdkgw.us1.twilio.com/v1/VideoEvents' failed: The operation couldn’t be completed. Socket is not connected

Not sure if it's a browser compatibility error, and if so if there is a work around.

@rykkers
Copy link

rykkers commented Jan 26, 2022

Did you manage to resolve? I'm getting exactly the same with a very similar Capacitor iOS setup

@tavoohoh
Copy link

tavoohoh commented Jan 26, 2022

I was able to solved with this hack in iOS. Go to CapacitorBridge and modify the getWebView function. For me was in Pods -> Development Pods -> Capacitor -> CapacitorBridge:120

   public func getWebView() -> WKWebView? {
        if let ua = webView?.value(forKey: "userAgent") as? String {
            webView?.customUserAgent = ua + " Safari"
        }

        return webView
    }

This was found here: twilio/twilio-webrtc.js#133 (comment)

Hope this helps @rykkers

@rykkers
Copy link

rykkers commented Jan 26, 2022

Yes, thanks, amazing. I found my way to that PR (twilio/twilio-webrtc.js#133) and so far have just done a little hack to the twilio javascript guessBrowser() function to that it maps everything to safari.

But thanks for the location of where i can manually set the UA. Obviously too late to do it via capacitor config!

@tavoohoh
Copy link

Can you provide more info about that solution? It's sounds cleaner

@rykkers
Copy link

rykkers commented Feb 1, 2022

So as part of my scripts that pull sources, once Twilio is updated, i just do a find and replace on their script that finds "/Safari/.test(userAgent)" and replaces it with "/Safari|Macintosh|iPhone|iPad/.test(userAgent)"

That way, it keeps patching itself even when Twilio updates and then when Twilio finally update their code to improve the "/Safari/" test then my find will no longer find it and i'll have a nice error message to let me know to check the source.

Note, only tested on iPad, so i'm sure i'd have to add a few more cases in there to match all iPhone versions as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more information Issues that require more information to resolve, such as Room SIDs, SDK versions, etc.
Projects
None yet
Development

No branches or pull requests

6 participants