Skip to content

how to get RTCPeerConnection? #2706

Answered by wemeetagain
fastalks asked this question in Q&A
Discussion options

You must be logged in to vote

I think you should be able to check the peerConnection property on the connection. (It won't be typesafe since the underlying types aren't exposed, just cast to any)
See https://github.com/libp2p/js-libp2p/blob/main/packages/transport-webrtc/src/maconn.ts#L11

eg:

const connection = dialer.getConnections(peerIdFromString(webRTCMultiaddr.getPeerId()))[0]
const rtcPeerConnection = (connection as any).peerConnection as RTCPeerConnection

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
4 replies
@fastalks
Comment options

@wemeetagain
Comment options

@ZababurinSergei
Comment options

@fastalks
Comment options

Answer selected by fastalks
Comment options

You must be logged in to vote
2 replies
@achingbrain
Comment options

@fastalks
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants