twilio-video.js
twilio-video.js copied to clipboard
Feature request: Expose RTCPeerConnection instance
- [ ] I have verified that the issue occurs with the latest twilio-video.js release and is not marked as a known issue in the CHANGELOG.md.
- [ ] I reviewed the Common Issues and open GitHub issues and verified that this report represents a potentially new issue.
- [ ] I verified that the Quickstart application works in my environment.
- [ ] I am not sharing any Personally Identifiable Information (PII) or sensitive account information (API keys, credentials, etc.) when reporting this issue.
Code to reproduce the issue:
// TODO
Expected behavior:
Let me know if I'm missing something here but I need access to the internally created RTCPeerConnection instance. This is not immediately obvious and makes it hard to plug in with other third party libraries. For example this can be helpful for plugging in with https://www.npmjs.com/package/@peermetrics/webrtc-stats or https://www.npmjs.com/package/webrtcmetrics. My use case is to plugin in connection quality logging and visual indicators for "Peer-to-Peer" sessions specifically. I get that your SDK doesn't support the Network Quality API for Peer-to-Peer connection types. At a minimum the RTCPeerConnection instance should be exposed to assist with this limitation. I'm happy to open a PR for this - Let me know.
In summary:
Implement and document a simple way to expose the RTCPeerConnection created instance. room.getRTCPeerConnectionInstance()
??
Actual behavior:
The internally created browser based RTCPeerConnection is not immediately available for simple consumption.
TODO
Software versions:
- [ ] Browser(s):
- [ ] Operating System:
- [ ] twilio-video.js:
- [ ] Third-party libraries (e.g., Angular, React, etc.):
Hello @gkweb, We have not heard from other customers requesting such access. but will definitely keep this on our radar.
For P2P rooms twilio sdk creates multiple Peer Connection instances (one per remoteParticipant). You can get an array of peer connection using following code. Please Note that since these are internal undocumented methods, they are subject to change w/o any notice.
const pcs = Array.from(room._signaling._peerConnectionManager._peerConnections.values()).map(pc => pc._peerConnection._peerConnection)
Thanks, Makarand
Hey @makarandp0 we definitely want access also! We're using this signalling private accessor but like you said - any change will break it.
Hey @makarandp0, I think this is an important access for us that clients are using P2P rooms.
Is this something that is still in your pipeline or is already available? I noticed the issue is closed but no mention of the status
Hello @gkweb, We have not heard from other customers requesting such access. but will definitely keep this on our radar.
For P2P rooms twilio sdk creates multiple Peer Connection instances (one per remoteParticipant). You can get an array of peer connection using following code. Please Note that since these are internal undocumented methods, they are subject to change w/o any notice.
const pcs = Array.from(room._signaling._peerConnectionManager._peerConnections.values()).map(pc => pc._peerConnection._peerConnection)
Thanks, Makarand
Hi, Even after I closed the connection, in chrome://webrtc-internals it still visible. After reading articles related to this issue, I came to know we have to set RTCPeerConnection object to null after closing it.
But using the above code snipet, even though i can able to access twilio rtcpeerconnection object, I am not able to set to null.
Could you please any one help me on this?