infobip-rtc
Version:
Infobip RTC JavaScript SDK - Infobip WebRTC API Implementation
48 lines • 2.5 kB
JavaScript
import { WebrtcCallOptions } from "../options/WebrtcCallOptions";
import { DefaultWebrtcCall } from "./DefaultWebrtcCall";
import { WebrtcEndpoint } from "../../util/Endpoint";
import { DefaultIncomingApplicationCall } from "./DefaultIncomingApplicationCall";
import { Properties } from "../../Properties";
import { ApplicationCallOptions } from "../options/ApplicationCallOptions";
import { CallStatus } from "../CallStatus";
export class DefaultIncomingWebrtcCall extends DefaultWebrtcCall {
constructor(eventEmitter, gateway, logger, rtcConfig, device, hasRemoteVideo, currentUserIdentity, counterpartIdentity, remoteOffer, token, apiUrl, callId) {
super(WebrtcCallOptions.builder().build(), new WebrtcEndpoint(counterpartIdentity), new WebrtcEndpoint(currentUserIdentity));
this.eventEmitter = eventEmitter;
this.gateway = gateway;
this.logger = logger;
this.rtcConfig = rtcConfig;
this.device = device;
this.hasRemoteVideo = hasRemoteVideo;
this.applicationCall = new DefaultIncomingApplicationCall(this.eventEmitter, this.gateway, this.logger, this.rtcConfig, this.device, counterpartIdentity, Properties.WEBRTC_CALLS_CONFIGURATION_ID, remoteOffer, currentUserIdentity, token, apiUrl, callId);
this.initEventHandlers();
}
static mapOptions(webrtcCallOptions) {
return ApplicationCallOptions.builder()
.setAudio(webrtcCallOptions.audio)
.setAudioOptions(webrtcCallOptions.audioOptions)
.setVideo(webrtcCallOptions.video)
.setVideoOptions(webrtcCallOptions.videoOptions)
.setCustomData(webrtcCallOptions.customData)
.setDataChannel(webrtcCallOptions.dataChannel)
.setAutoReconnect(webrtcCallOptions === null || webrtcCallOptions === void 0 ? void 0 : webrtcCallOptions.autoReconnect)
.build();
}
hasRemoteCameraVideo() {
if (this.status() === CallStatus.RINGING || this.status() === CallStatus.CONNECTING) {
return this.hasRemoteVideo;
}
return super.hasRemoteCameraVideo();
}
counterpart() {
return this.sourceEndpoint;
}
accept(options) {
this.basicCallOptions = options || this.basicCallOptions;
this.applicationCall.accept(DefaultIncomingWebrtcCall.mapOptions(this.basicCallOptions));
}
decline(options) {
this.applicationCall.decline(options);
}
}
//# sourceMappingURL=DefaultIncomingWebrtcCall.js.map