import Peer , { SfuRoom } from "skyway-js" ; export const initPeer = ( forceTurn ) : Promise < Peer > => { return new Promise ( ( resolve , reject ) => { const peer = new Peer ( { key : "" , debug : 2 , config : { iceTransportPolicy : forceTurn ? "relay" : "all" , } , } ) ; peer . once ( "open" , ( ) => { peer . removeListener ( "error" , reject ) ; resolve ( peer ) ; } ) ; peer . once ( "error" , reject ) ; } ) ; } ; export const getPeerConnectionFromSfuRoom = ( room ) : RTCPeerConnection => { return room . _negotiator . _pc ; } ;