Skip to content

Commit

Permalink
Merge pull request #93 from cloudflare/clean-up-peer-connection-creation
Browse files Browse the repository at this point in the history
Clean up RTCPeerConnection creation
  • Loading branch information
third774 authored Aug 21, 2024
2 parents 4e5bbe8 + 9ce8b1a commit 4af2783
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions app/utils/rxjs/RxjsPeer.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ export class RxjsPeer {
let peerConnection: RTCPeerConnection
const setup = () => {
peerConnection?.close()
peerConnection = createPeerConnection({
peerConnection = new RTCPeerConnection({
iceServers: config.iceServers,
bundlePolicy: 'max-bundle',
})
peerConnection.addEventListener('connectionstatechange', () => {
if (
Expand Down Expand Up @@ -526,17 +527,6 @@ export class RxjsPeer {
}
}

function createPeerConnection(
configuration: RTCConfiguration = {
iceServers: [{ urls: 'stun:stun.cloudflare.com:3478' }],
bundlePolicy: 'max-bundle',
}
) {
const pc = new RTCPeerConnection(configuration)

return pc
}

async function resolveTrack(
peerConnection: RTCPeerConnection,
compare: (t: RTCRtpTransceiver) => boolean,
Expand Down

0 comments on commit 4af2783

Please sign in to comment.