UNPKG

infobip-rtc

Version:

Infobip RTC JavaScript SDK - Infobip WebRTC API Implementation

30 lines 1.38 kB
import { PeerConnectionMediaMonitor } from "./PeerConnectionMediaMonitor"; import { PeerConnectionTag } from "./media/PeerConnectionTag"; export default class MonitoredPeerConnection { static create(rtcConfig, callId, peerConnectionTag, conferenceId, mediaType, logger, gateway) { const peerConnection = new RTCPeerConnection(rtcConfig); const monitor = new PeerConnectionMediaMonitor(callId, MonitoredPeerConnection.PEER_CONNECTION_NAMING_MAPPING[peerConnectionTag], conferenceId, peerConnection, mediaType, logger, gateway); return new MonitoredPeerConnection(peerConnection, monitor); } constructor(peerConnection, monitor) { this.peerConnection = peerConnection; this.monitor = monitor; } close() { this.peerConnection.close(); return this.monitor.stop(); } async restartIce() { this.peerConnection.restartIce(); const offer = await this.peerConnection.createOffer(); await this.peerConnection.setLocalDescription(offer); return offer; } } MonitoredPeerConnection.PEER_CONNECTION_NAMING_MAPPING = { [PeerConnectionTag.AV]: "AudioVideo", [PeerConnectionTag.VideoPublisher]: "VideoPublisher", [PeerConnectionTag.VideoSubscription]: "VideoSubscriber", [PeerConnectionTag.Audio]: "Audio" }; //# sourceMappingURL=MonitoredPeerConnection.js.map