Intel® Collaboration Suite for WebRTC
Community support and discussions on the Intel® Collaboration Suite for WebRTC (Intel® CS for WebRTC).
1146 Discussions

is RTCPeerConnection exposed anywhere in 4.2.1 JS SDK ?

Verstraeten__Alex
600 Views

Hi there, I'm migrating from 3.5.2 to 4.2.1, and I'm getting some trouble to find a reference to the underlaying peer connection of stream.

In 3.5.2 I used to perform:

stream.channel.peerConnection

and that would give me an instance of the RTCPeerConnection of my local stream.
but I'm not sure how to get that reference on 4.2.1.

My final goal is to get a list of RTCRtpSender's from that RTCPeerConnection, so I can call sender.replaceTrack() on each of them, as I used to do in 3.5.2 for switching cameras without republishing streams.

if that's not possible, is there any non-minified version of owt.js I could get so I can modify and expose the RTCPeerConnection myself?
I don't mind having to hack the source code, as I really do need this feature for my product,

thanks in advance

0 Kudos
3 Replies
Verstraeten__Alex
600 Views

well, I just found the repository for owt.j at https://github.com/open-webrtc-toolkit/owt-client-javascript

I cloned the 4.2.x branch, edited the file src/sdk/client.js

and hacked the "publish" function of Owt.Conference.ConferenceClient (around line #405)

changing

    const channel = createPeerConnectionChannel();
    return channel.publish(stream, options);

to:

    var channel = createPeerConnectionChannel();
    stream.channel = channel;
    return channel.publish(stream, options);

then I can reach the RTCPeerConnection of my stream using:

stream.channel._pc

just a one-line hack that works fine for my use-case, no error checking and no fancy stuff.

hope you expose it properly on new releases

0 Kudos
Jianjun_Z_Intel
Employee
600 Views

Hi Alex,

RTCPeerConnection is not exposed at this moment, and it will not be available in the upcoming 4.3 release either. However, we're planing to expose more WebRTC objects to developers. Basically, a Publication is associated with an RTCSender, and a Subscription is associated with an RTPReceiver. A PeerConnection might be shared by multiple streams in the future. BTW, this is not the final design. It needs to be reviewed before implementation.

0 Kudos
Jianjun_Z_Intel
Employee
600 Views

I've created an issue on Github. You may track its progress at https://github.com/open-webrtc-toolkit/owt-client-javascript/issues/312.

0 Kudos
Reply