Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const initOffer = (endpoint, offerSdp) => {
const offer = SDPInfo.process(offerSdp)
// transport :: Transport
const transport = endpoint.createTransport({
dtls: offer.getDTLS(),
ice: offer.getICE()
})
transport.setRemoteProperties({
audio: offer.getMedia('audio'),
video: offer.getMedia('video')
})
// answer :: SDPInfo
const answer = new SDPInfo()
// dtlsInfo :: DTLSInfo
const dtlsInfo = transport.getLocalDTLSInfo()
answer.setDTLS(dtlsInfo)
// iceInfo :: ICEInfo
const iceInfo = transport.getLocalICEInfo()
answer.setICE(iceInfo)
// localCandidates :: Array CandidateInfo
const localCandidates = endpoint.getLocalCandidates()
for (const candidate of localCandidates) {
answer.addCandidate(candidate)
}
return {