hongsown / Whep-Client

4 stars 0 forks source link

Allow Overwriting RTCPeerConnection Parameters #1

Closed elson-currentcorp closed 3 days ago

elson-currentcorp commented 1 month ago

Hi, thank you for creating this library.

Is it possible to allow overwriting RTCPeerConnection instantiation properties? For example:

const client = new WHEPClient(endpoint, videoElement, forwardRTCPeerConnectionParams);

I'm using this library with mediamtx right now: https://github.com/bluenviron/mediamtx?tab=readme-ov-file#web-browsers-1 and I find that it doesn't work with the current default properties:

this.peerConnection = new RTCPeerConnection({
    iceServers: [
        turnServerConfig // turnServer not needed to work but required as a class instantiation parameter
    ],
    iceTransportPolicy: 'relay', // Doesn't work at all with this set
    bundlePolicy: 'max-bundle', // Stream staggers occasionally if this is set
});

I'm not too familiar with WebRTC and its configurations, but these tweaks are what I found worked best with my setup.

I could create the PR if this change is welcomed.

hongsown commented 1 month ago

Thank you for your suggestion. I appreciate your interest in improving the library. Your proposal to allow customization of RTCPeerConnection initialization properties is a great idea. We'd be happy to review a pull request for this feature. I will review it as soon as possible. Thanks for your contribution!