2018-03-08 05:20:37 +08:00
|
|
|
const isFirefox = typeof window.InstallTrigger !== 'undefined';
|
|
|
|
const isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
|
|
|
|
const isChrome = !!window.chrome && !isOpera;
|
|
|
|
const isSafari = navigator.userAgent.indexOf('Safari') >= 0 && !isChrome;
|
2019-01-22 02:02:57 +08:00
|
|
|
const hasDisplayMedia = (typeof navigator.getDisplayMedia === 'function'
|
|
|
|
|| typeof navigator.mediaDevices.getDisplayMedia === 'function');
|
2018-03-08 05:20:37 +08:00
|
|
|
const kurentoHandler = null;
|
2018-04-26 00:56:16 +08:00
|
|
|
const SEND_ROLE = "send";
|
|
|
|
const RECV_ROLE = "recv";
|
|
|
|
const SFU_APP = "screenshare";
|
2018-07-21 03:34:50 +08:00
|
|
|
const ON_ICE_CANDIDATE_MSG = "iceCandidate";
|
2018-04-26 00:56:16 +08:00
|
|
|
const START_MSG = "start";
|
|
|
|
const START_RESPONSE_MSG = "startResponse";
|
2018-05-08 01:44:18 +08:00
|
|
|
const PING_INTERVAL = 15000;
|
2017-06-14 04:18:21 +08:00
|
|
|
|
|
|
|
Kurento = function (
|
2018-03-08 05:20:37 +08:00
|
|
|
tag,
|
|
|
|
voiceBridge,
|
2018-06-29 02:50:56 +08:00
|
|
|
userId,
|
2018-03-08 05:20:37 +08:00
|
|
|
internalMeetingId,
|
|
|
|
onFail = null,
|
|
|
|
chromeExtension = null,
|
2018-05-08 01:44:18 +08:00
|
|
|
userName = null,
|
2018-06-29 02:50:56 +08:00
|
|
|
caleeName = null,
|
2018-05-08 01:44:18 +08:00
|
|
|
onSuccess = null
|
2018-03-08 05:20:37 +08:00
|
|
|
) {
|
2018-05-08 01:44:18 +08:00
|
|
|
|
2017-06-14 04:18:21 +08:00
|
|
|
this.ws = null;
|
2018-03-10 02:35:37 +08:00
|
|
|
this.video = null;
|
|
|
|
this.screen = null;
|
|
|
|
this.webRtcPeer = null;
|
2017-07-04 03:13:00 +08:00
|
|
|
this.mediaCallback = null;
|
2017-07-27 00:59:05 +08:00
|
|
|
|
2018-07-11 01:45:03 +08:00
|
|
|
this.voiceBridge = voiceBridge;
|
2017-07-27 00:59:05 +08:00
|
|
|
this.internalMeetingId = internalMeetingId;
|
2017-06-14 04:18:21 +08:00
|
|
|
|
2018-06-29 02:50:56 +08:00
|
|
|
this.userId = userId;
|
|
|
|
this.userName = userName;
|
|
|
|
this.caleeName = caleeName;
|
|
|
|
|
2018-05-10 07:38:20 +08:00
|
|
|
// Limiting max resolution to WQXGA
|
2018-03-10 02:35:37 +08:00
|
|
|
// In FireFox we force full screen share and in the case
|
|
|
|
// of multiple screens the total area shared becomes too large
|
2018-05-10 07:38:20 +08:00
|
|
|
this.vid_max_width = 2560;
|
|
|
|
this.vid_max_height = 1600;
|
2018-05-10 00:39:59 +08:00
|
|
|
this.width = window.screen.width;
|
|
|
|
this.height = window.screen.height;
|
2017-06-14 04:18:21 +08:00
|
|
|
|
2017-07-18 03:30:58 +08:00
|
|
|
// TODO properly generate a uuid
|
2017-06-14 04:18:21 +08:00
|
|
|
this.sessid = Math.random().toString();
|
|
|
|
|
|
|
|
this.renderTag = 'remote-media';
|
|
|
|
|
2018-06-29 02:50:56 +08:00
|
|
|
this.userId = userId;
|
2017-06-14 04:18:21 +08:00
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
this.kurentoPort = 'bbb-webrtc-sfu';
|
2017-06-14 04:18:21 +08:00
|
|
|
this.hostName = window.location.hostname;
|
2018-03-08 05:20:37 +08:00
|
|
|
this.socketUrl = `wss://${this.hostName}/${this.kurentoPort}`;
|
2018-05-08 01:44:18 +08:00
|
|
|
this.pingInterval = null;
|
2017-06-14 04:18:21 +08:00
|
|
|
|
|
|
|
if (chromeExtension != null) {
|
|
|
|
this.chromeExtension = chromeExtension;
|
2017-11-06 22:27:12 +08:00
|
|
|
window.chromeExtension = chromeExtension;
|
2017-06-14 04:18:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (onFail != null) {
|
2017-07-18 03:30:58 +08:00
|
|
|
this.onFail = Kurento.normalizeCallback(onFail);
|
2017-06-14 04:18:21 +08:00
|
|
|
} else {
|
2018-03-08 05:20:37 +08:00
|
|
|
const _this = this;
|
2017-06-14 04:18:21 +08:00
|
|
|
this.onFail = function () {
|
|
|
|
_this.logError('Default error handler');
|
|
|
|
};
|
|
|
|
}
|
2018-05-08 01:44:18 +08:00
|
|
|
|
|
|
|
if (onSuccess != null) {
|
|
|
|
this.onSuccess = Kurento.normalizeCallback(onSuccess);
|
|
|
|
} else {
|
|
|
|
var _this = this;
|
|
|
|
this.onSuccess = function () {
|
|
|
|
_this.logSuccess('Default success handler');
|
|
|
|
};
|
|
|
|
}
|
2017-06-14 04:18:21 +08:00
|
|
|
};
|
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
this.KurentoManager = function () {
|
2017-06-14 04:18:21 +08:00
|
|
|
this.kurentoVideo = null;
|
2017-11-06 22:27:12 +08:00
|
|
|
this.kurentoScreenshare = null;
|
2018-05-08 01:44:18 +08:00
|
|
|
this.kurentoAudio = null;
|
2017-06-14 04:18:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
KurentoManager.prototype.exitScreenShare = function () {
|
2018-03-08 05:20:37 +08:00
|
|
|
console.log(' [exitScreenShare] Exiting screensharing');
|
|
|
|
if (typeof this.kurentoScreenshare !== 'undefined' && this.kurentoScreenshare) {
|
|
|
|
if (this.kurentoScreenshare.ws !== null) {
|
|
|
|
this.kurentoScreenshare.ws.onclose = function () {};
|
2017-11-06 22:27:12 +08:00
|
|
|
this.kurentoScreenshare.ws.close();
|
2017-07-04 03:13:00 +08:00
|
|
|
}
|
2017-11-06 22:27:12 +08:00
|
|
|
|
2018-05-08 01:44:18 +08:00
|
|
|
if (this.kurentoScreenshare.pingInterval) {
|
|
|
|
clearInterval(this.kurentoScreenshare.pingInterval);
|
|
|
|
}
|
2017-11-06 22:27:12 +08:00
|
|
|
|
2018-05-08 01:44:18 +08:00
|
|
|
this.kurentoScreenshare.dispose();
|
2017-11-06 22:27:12 +08:00
|
|
|
this.kurentoScreenshare = null;
|
|
|
|
}
|
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
if (typeof this.kurentoVideo !== 'undefined' && this.kurentoVideo) {
|
2017-11-06 22:27:12 +08:00
|
|
|
this.exitVideo();
|
2017-06-14 04:18:21 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-09-09 01:00:00 +08:00
|
|
|
KurentoManager.prototype.exitVideo = function () {
|
2018-03-08 05:20:37 +08:00
|
|
|
console.log(' [exitScreenShare] Exiting screensharing viewing');
|
|
|
|
if (typeof this.kurentoVideo !== 'undefined' && this.kurentoVideo) {
|
|
|
|
if (this.kurentoVideo.ws !== null) {
|
|
|
|
this.kurentoVideo.ws.onclose = function () {};
|
2017-11-06 22:27:12 +08:00
|
|
|
this.kurentoVideo.ws.close();
|
|
|
|
}
|
|
|
|
|
2018-05-08 01:44:18 +08:00
|
|
|
if (this.kurentoVideo.pingInterval) {
|
|
|
|
clearInterval(this.kurentoVideo.pingInterval);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.kurentoVideo.dispose();
|
2017-11-06 22:27:12 +08:00
|
|
|
this.kurentoVideo = null;
|
|
|
|
}
|
2018-05-08 01:44:18 +08:00
|
|
|
};
|
2017-11-06 22:27:12 +08:00
|
|
|
|
2018-05-08 01:44:18 +08:00
|
|
|
KurentoManager.prototype.exitAudio = function () {
|
|
|
|
console.log(' [exitAudio] Exiting listen only audio');
|
|
|
|
if (typeof this.kurentoAudio !== 'undefined' && this.kurentoAudio) {
|
|
|
|
if (this.kurentoAudio.ws !== null) {
|
|
|
|
this.kurentoAudio.ws.onclose = function () {};
|
|
|
|
this.kurentoAudio.ws.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.kurentoAudio.dispose();
|
|
|
|
this.kurentoAudio = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.kurentoAudio) {
|
|
|
|
this.kurentoAudio = null;
|
2017-11-06 22:27:12 +08:00
|
|
|
}
|
2017-09-09 01:00:00 +08:00
|
|
|
};
|
|
|
|
|
2018-05-08 01:44:18 +08:00
|
|
|
|
2017-06-14 04:18:21 +08:00
|
|
|
KurentoManager.prototype.shareScreen = function (tag) {
|
|
|
|
this.exitScreenShare();
|
2018-03-08 05:20:37 +08:00
|
|
|
const obj = Object.create(Kurento.prototype);
|
2017-06-14 04:18:21 +08:00
|
|
|
Kurento.apply(obj, arguments);
|
2017-11-06 22:27:12 +08:00
|
|
|
this.kurentoScreenshare = obj;
|
2018-04-26 00:56:16 +08:00
|
|
|
this.kurentoScreenshare.setScreensharing(tag);
|
2017-06-14 04:18:21 +08:00
|
|
|
};
|
|
|
|
|
2017-07-04 03:13:00 +08:00
|
|
|
KurentoManager.prototype.joinWatchVideo = function (tag) {
|
|
|
|
this.exitVideo();
|
2018-03-08 05:20:37 +08:00
|
|
|
const obj = Object.create(Kurento.prototype);
|
2017-07-04 03:13:00 +08:00
|
|
|
Kurento.apply(obj, arguments);
|
|
|
|
this.kurentoVideo = obj;
|
|
|
|
this.kurentoVideo.setWatchVideo(tag);
|
|
|
|
};
|
|
|
|
|
2018-07-11 03:59:05 +08:00
|
|
|
Kurento.prototype.fetchStunTurnServer = function (callback) {
|
|
|
|
let iceServers = [];
|
|
|
|
const handleFetchError = function (response) {
|
|
|
|
console.error("[screenshare] Could not fetch stun/turn servers, using default");
|
|
|
|
callback(iceServers);
|
|
|
|
}
|
|
|
|
|
|
|
|
BBB.getSessionToken(function(sessionToken) {
|
|
|
|
$.ajax({
|
|
|
|
dataType: 'json',
|
|
|
|
url: '/bigbluebutton/api/stuns',
|
|
|
|
data: {sessionToken:sessionToken}
|
|
|
|
}).done(function(data) {
|
|
|
|
if (data.response && data.response.returncode === 'FAILED') {
|
|
|
|
return handleFetchError(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
let stuns = data['stunServers'].map(function (s) {
|
|
|
|
return { urls : s.url };
|
|
|
|
});
|
|
|
|
|
|
|
|
let turns = data['turnServers'].map(function (t) {
|
|
|
|
return { urls: t.url, username: t.username, credential: t.password };
|
|
|
|
});
|
|
|
|
iceServers = stuns.concat(turns);
|
|
|
|
return callback(iceServers);
|
|
|
|
}).fail(function(data, textStatus, errorThrown) {
|
|
|
|
return handleFetchError(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Kurento.prototype.addIceServers = function (callback) {
|
|
|
|
let configuration;
|
|
|
|
this.fetchStunTurnServer(function (iceServers) {
|
|
|
|
if (iceServers && iceServers.length > 0) {
|
|
|
|
configuration = {};
|
|
|
|
configuration.iceServers = iceServers;
|
|
|
|
}
|
|
|
|
return callback(configuration);
|
|
|
|
});
|
|
|
|
};
|
2017-07-04 03:13:00 +08:00
|
|
|
|
2018-04-26 00:56:16 +08:00
|
|
|
Kurento.prototype.setScreensharing = function (tag) {
|
|
|
|
this.mediaCallback = this.startScreensharing.bind(this);
|
2017-06-14 04:18:21 +08:00
|
|
|
this.create(tag);
|
|
|
|
};
|
|
|
|
|
|
|
|
Kurento.prototype.create = function (tag) {
|
|
|
|
this.setRenderTag(tag);
|
|
|
|
this.init();
|
|
|
|
};
|
|
|
|
|
2018-05-09 22:21:03 +08:00
|
|
|
Kurento.prototype.downscaleResolution = function (oldWidth, oldHeight) {
|
|
|
|
const factorWidth = this.vid_max_width / oldWidth;
|
|
|
|
const factorHeight = this.vid_max_height / oldHeight;
|
|
|
|
let width, height;
|
|
|
|
|
|
|
|
if (factorWidth < factorHeight) {
|
|
|
|
width = Math.trunc(oldWidth * factorWidth);
|
|
|
|
height = Math.trunc(oldHeight * factorWidth);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
width = Math.trunc(oldWidth * factorHeight);
|
|
|
|
height = Math.trunc(oldHeight * factorHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
return { width, height };
|
|
|
|
};
|
|
|
|
|
2017-06-14 04:18:21 +08:00
|
|
|
Kurento.prototype.init = function () {
|
2018-03-08 05:20:37 +08:00
|
|
|
const self = this;
|
|
|
|
if ('WebSocket' in window) {
|
|
|
|
console.log('this browser supports websockets');
|
2017-06-14 04:18:21 +08:00
|
|
|
this.ws = new WebSocket(this.socketUrl);
|
|
|
|
|
2017-11-06 22:27:12 +08:00
|
|
|
this.ws.onmessage = this.onWSMessage.bind(this);
|
|
|
|
this.ws.onclose = (close) => {
|
2017-07-06 01:58:19 +08:00
|
|
|
kurentoManager.exitScreenShare();
|
2018-03-08 05:20:37 +08:00
|
|
|
self.onFail('Websocket connection closed');
|
2017-06-14 04:18:21 +08:00
|
|
|
};
|
2017-11-06 22:27:12 +08:00
|
|
|
this.ws.onerror = (error) => {
|
2017-07-06 01:58:19 +08:00
|
|
|
kurentoManager.exitScreenShare();
|
2018-03-08 05:20:37 +08:00
|
|
|
self.onFail('Websocket connection error');
|
2017-06-14 04:18:21 +08:00
|
|
|
};
|
2017-11-06 22:27:12 +08:00
|
|
|
this.ws.onopen = function () {
|
2018-05-08 01:44:18 +08:00
|
|
|
self.pingInterval = setInterval(self.ping.bind(self), PING_INTERVAL);
|
2017-07-04 03:13:00 +08:00
|
|
|
self.mediaCallback();
|
2018-03-08 05:20:37 +08:00
|
|
|
};
|
|
|
|
} else { console.log('this browser does not support websockets'); }
|
2017-06-14 04:18:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
Kurento.prototype.onWSMessage = function (message) {
|
2018-03-08 05:20:37 +08:00
|
|
|
const parsedMessage = JSON.parse(message.data);
|
2017-06-14 04:18:21 +08:00
|
|
|
switch (parsedMessage.id) {
|
2018-04-26 00:56:16 +08:00
|
|
|
case 'startResponse':
|
|
|
|
this.startResponse(parsedMessage);
|
2017-09-09 01:00:00 +08:00
|
|
|
break;
|
2017-06-14 04:18:21 +08:00
|
|
|
case 'stopSharing':
|
2017-07-11 04:51:37 +08:00
|
|
|
kurentoManager.exitScreenShare();
|
2017-06-14 04:18:21 +08:00
|
|
|
break;
|
|
|
|
case 'iceCandidate':
|
2017-11-06 22:27:12 +08:00
|
|
|
this.webRtcPeer.addIceCandidate(parsedMessage.candidate);
|
2017-07-04 03:13:00 +08:00
|
|
|
break;
|
2018-05-08 01:44:18 +08:00
|
|
|
case 'webRTCAudioSuccess':
|
|
|
|
this.onSuccess(parsedMessage.success);
|
|
|
|
break;
|
|
|
|
case 'webRTCAudioError':
|
|
|
|
this.onFail(parsedMessage.error);
|
|
|
|
break;
|
|
|
|
case 'pong':
|
|
|
|
break;
|
2017-06-14 04:18:21 +08:00
|
|
|
default:
|
|
|
|
console.error('Unrecognized message', parsedMessage);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Kurento.prototype.setRenderTag = function (tag) {
|
|
|
|
this.renderTag = tag;
|
|
|
|
};
|
|
|
|
|
2018-04-26 00:56:16 +08:00
|
|
|
Kurento.prototype.startResponse = function (message) {
|
2018-03-08 05:20:37 +08:00
|
|
|
if (message.response !== 'accepted') {
|
|
|
|
const errorMsg = message.message ? message.message : 'Unknow error';
|
|
|
|
console.warn(`Call not accepted for the following reason: ${errorMsg}`);
|
2018-05-08 01:44:18 +08:00
|
|
|
switch (message.type) {
|
|
|
|
case 'screenshare':
|
|
|
|
if (message.role === SEND_ROLE) {
|
|
|
|
kurentoManager.exitScreenShare();
|
|
|
|
}
|
|
|
|
else if (message.role === RECV_ROLE) {
|
|
|
|
kurentoManager.exitVideo();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'audio':
|
|
|
|
kurentoManager.exitAudio();
|
|
|
|
break;
|
|
|
|
}
|
2017-06-14 04:18:21 +08:00
|
|
|
} else {
|
2018-05-08 01:44:18 +08:00
|
|
|
console.debug(`Procedure for`, message.type, `was accepted with SDP => ${message.sdpAnswer}`);
|
2017-06-14 04:18:21 +08:00
|
|
|
this.webRtcPeer.processAnswer(message.sdpAnswer);
|
|
|
|
}
|
2018-03-08 05:20:37 +08:00
|
|
|
};
|
2017-06-14 04:18:21 +08:00
|
|
|
|
|
|
|
Kurento.prototype.onOfferPresenter = function (error, offerSdp) {
|
2018-03-08 05:20:37 +08:00
|
|
|
const self = this;
|
2018-05-09 22:21:03 +08:00
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
if (error) {
|
|
|
|
console.log(`Kurento.prototype.onOfferPresenter Error ${error}`);
|
2017-11-06 22:27:12 +08:00
|
|
|
this.onFail(error);
|
2017-06-14 04:18:21 +08:00
|
|
|
return;
|
|
|
|
}
|
2017-07-18 03:30:58 +08:00
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
const message = {
|
2018-04-26 00:56:16 +08:00
|
|
|
id: 'start',
|
|
|
|
type: SFU_APP,
|
|
|
|
role: SEND_ROLE,
|
2017-11-06 22:27:12 +08:00
|
|
|
internalMeetingId: self.internalMeetingId,
|
|
|
|
voiceBridge: self.voiceBridge,
|
2018-06-29 02:50:56 +08:00
|
|
|
callerName: self.userId,
|
2018-03-08 05:20:37 +08:00
|
|
|
sdpOffer: offerSdp,
|
2018-05-10 00:39:59 +08:00
|
|
|
vh: this.height,
|
|
|
|
vw: this.width,
|
2017-06-14 04:18:21 +08:00
|
|
|
};
|
2018-04-26 00:56:16 +08:00
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
console.log(`onOfferPresenter sending to screenshare server => ${JSON.stringify(message, null, 2)}`);
|
2017-11-06 22:27:12 +08:00
|
|
|
this.sendMessage(message);
|
2018-03-08 05:20:37 +08:00
|
|
|
};
|
2017-06-14 04:18:21 +08:00
|
|
|
|
2018-04-26 00:56:16 +08:00
|
|
|
Kurento.prototype.startScreensharing = function () {
|
2018-03-08 05:20:37 +08:00
|
|
|
if (window.chrome) {
|
2018-04-26 00:56:16 +08:00
|
|
|
if (!this.chromeExtension) {
|
|
|
|
this.logError({
|
2018-03-08 05:20:37 +08:00
|
|
|
status: 'failed',
|
2017-06-14 04:18:21 +08:00
|
|
|
message: 'Missing Chrome Extension key',
|
|
|
|
});
|
2018-04-26 00:56:16 +08:00
|
|
|
this.onFail();
|
2017-06-14 04:18:21 +08:00
|
|
|
return;
|
|
|
|
}
|
2017-07-04 03:13:00 +08:00
|
|
|
}
|
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
const options = {
|
2017-11-06 22:27:12 +08:00
|
|
|
localVideo: document.getElementById(this.renderTag),
|
2018-04-26 00:56:16 +08:00
|
|
|
onicecandidate: (candidate) => {
|
|
|
|
this.onIceCandidate(candidate, SEND_ROLE);
|
|
|
|
},
|
2018-03-08 05:20:37 +08:00
|
|
|
sendSource: 'desktop',
|
2017-07-04 03:13:00 +08:00
|
|
|
};
|
2017-06-14 04:18:21 +08:00
|
|
|
|
2018-07-11 03:59:05 +08:00
|
|
|
this.addIceServers((configuration) => {
|
|
|
|
if (configuration) {
|
|
|
|
options.configuration = configuration;
|
|
|
|
}
|
2017-06-14 04:18:21 +08:00
|
|
|
|
2018-07-11 03:59:05 +08:00
|
|
|
console.log(` Peer options => ${JSON.stringify(options, null, 2)}`);
|
2018-05-10 07:38:20 +08:00
|
|
|
|
2018-07-11 03:59:05 +08:00
|
|
|
let resolution;
|
|
|
|
console.debug("Screenshare screen dimensions are", this.width, "x", this.height);
|
|
|
|
if (this.width > this.vid_max_width || this.height > this.vid_max_height) {
|
|
|
|
resolution = this.downscaleResolution(this.width, this.height);
|
|
|
|
this.width = resolution.width;
|
|
|
|
this.height = resolution.height;
|
|
|
|
console.debug("Screenshare track dimensions have been resized to", this.width, "x", this.height);
|
2017-07-04 03:13:00 +08:00
|
|
|
}
|
2017-07-18 03:30:58 +08:00
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
|
2018-07-11 03:59:05 +08:00
|
|
|
this.webRtcPeer = kurentoUtils.WebRtcPeer.WebRtcPeerSendonly(options, (error) => {
|
|
|
|
if (error) {
|
|
|
|
console.log(`WebRtcPeerSendonly constructor error ${JSON.stringify(error, null, 2)}`);
|
2018-07-25 04:45:08 +08:00
|
|
|
console.log({error});
|
|
|
|
this.onFail(error);
|
2018-07-11 03:59:05 +08:00
|
|
|
return kurentoManager.exitScreenShare();
|
|
|
|
}
|
2018-03-08 05:20:37 +08:00
|
|
|
|
2018-07-25 04:45:08 +08:00
|
|
|
this.onSuccess();
|
|
|
|
|
2018-07-11 03:59:05 +08:00
|
|
|
this.webRtcPeer.generateOffer(this.onOfferPresenter.bind(this));
|
|
|
|
console.log(`Generated peer offer w/ options ${JSON.stringify(options)}`);
|
|
|
|
|
|
|
|
const localStream = this.webRtcPeer.peerConnection.getLocalStreams()[0];
|
|
|
|
localStream.getVideoTracks()[0].onended = function () {
|
|
|
|
return kurentoManager.exitScreenShare();
|
|
|
|
};
|
|
|
|
|
|
|
|
localStream.getVideoTracks()[0].oninactive = function () {
|
|
|
|
return kurentoManager.exitScreenShare();
|
|
|
|
};
|
|
|
|
});
|
2017-07-04 03:13:00 +08:00
|
|
|
});
|
2018-03-08 05:20:37 +08:00
|
|
|
};
|
2017-06-14 04:18:21 +08:00
|
|
|
|
2018-04-26 00:56:16 +08:00
|
|
|
Kurento.prototype.onIceCandidate = function (candidate, role) {
|
2018-03-08 05:20:37 +08:00
|
|
|
const self = this;
|
|
|
|
console.log(`Local candidate${JSON.stringify(candidate)}`);
|
2017-06-14 04:18:21 +08:00
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
const message = {
|
2018-04-26 00:56:16 +08:00
|
|
|
id: ON_ICE_CANDIDATE_MSG,
|
|
|
|
role: role,
|
|
|
|
type: SFU_APP,
|
2017-11-06 22:27:12 +08:00
|
|
|
voiceBridge: self.voiceBridge,
|
2018-03-08 05:20:37 +08:00
|
|
|
candidate,
|
2018-06-29 02:50:56 +08:00
|
|
|
callerName: self.userId,
|
2018-03-08 05:20:37 +08:00
|
|
|
};
|
2018-04-26 00:56:16 +08:00
|
|
|
|
2017-11-06 22:27:12 +08:00
|
|
|
this.sendMessage(message);
|
2018-03-08 05:20:37 +08:00
|
|
|
};
|
2017-09-09 01:00:00 +08:00
|
|
|
|
2017-07-04 03:13:00 +08:00
|
|
|
Kurento.prototype.setWatchVideo = function (tag) {
|
|
|
|
this.useVideo = true;
|
|
|
|
this.useCamera = 'none';
|
|
|
|
this.useMic = 'none';
|
|
|
|
this.mediaCallback = this.viewer;
|
|
|
|
this.create(tag);
|
|
|
|
};
|
|
|
|
|
|
|
|
Kurento.prototype.viewer = function () {
|
2018-03-08 05:20:37 +08:00
|
|
|
const self = this;
|
2017-07-04 03:13:00 +08:00
|
|
|
if (!this.webRtcPeer) {
|
2018-03-08 05:20:37 +08:00
|
|
|
const options = {
|
2018-04-13 02:25:51 +08:00
|
|
|
mediaConstraints: {
|
|
|
|
audio: false
|
|
|
|
},
|
2017-09-09 01:00:00 +08:00
|
|
|
remoteVideo: document.getElementById(this.renderTag),
|
2018-04-26 00:56:16 +08:00
|
|
|
onicecandidate: (candidate) => {
|
|
|
|
this.onIceCandidate(candidate, RECV_ROLE);
|
|
|
|
}
|
|
|
|
}
|
2017-07-04 03:13:00 +08:00
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
self.webRtcPeer = kurentoUtils.WebRtcPeer.WebRtcPeerRecvonly(options, function (error) {
|
|
|
|
if (error) {
|
2017-11-06 22:27:12 +08:00
|
|
|
return self.onFail(error);
|
2017-07-18 03:30:58 +08:00
|
|
|
}
|
2017-07-04 03:13:00 +08:00
|
|
|
|
2017-11-06 22:27:12 +08:00
|
|
|
this.generateOffer(self.onOfferViewer.bind(self));
|
2017-07-04 03:13:00 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Kurento.prototype.onOfferViewer = function (error, offerSdp) {
|
2018-03-08 05:20:37 +08:00
|
|
|
const self = this;
|
|
|
|
if (error) {
|
|
|
|
console.log(`Kurento.prototype.onOfferViewer Error ${error}`);
|
2017-11-06 22:27:12 +08:00
|
|
|
return this.onFail();
|
2017-07-04 03:13:00 +08:00
|
|
|
}
|
2018-03-08 05:20:37 +08:00
|
|
|
const message = {
|
2018-04-26 00:56:16 +08:00
|
|
|
id: 'start',
|
|
|
|
type: SFU_APP,
|
|
|
|
role: RECV_ROLE,
|
2017-11-06 22:27:12 +08:00
|
|
|
internalMeetingId: self.internalMeetingId,
|
|
|
|
voiceBridge: self.voiceBridge,
|
2018-06-29 02:50:56 +08:00
|
|
|
callerName: self.userId,
|
2018-03-08 05:20:37 +08:00
|
|
|
sdpOffer: offerSdp,
|
2017-07-04 03:13:00 +08:00
|
|
|
};
|
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
console.log(`onOfferViewer sending to screenshare server => ${JSON.stringify(message, null, 2)}`);
|
2017-11-06 22:27:12 +08:00
|
|
|
this.sendMessage(message);
|
2017-07-04 03:13:00 +08:00
|
|
|
};
|
|
|
|
|
2018-05-08 01:44:18 +08:00
|
|
|
KurentoManager.prototype.joinAudio = function (tag) {
|
|
|
|
this.exitAudio();
|
|
|
|
var obj = Object.create(Kurento.prototype);
|
|
|
|
Kurento.apply(obj, arguments);
|
|
|
|
this.kurentoAudio= obj;
|
|
|
|
this.kurentoAudio.setAudio(tag);
|
|
|
|
};
|
|
|
|
|
|
|
|
Kurento.prototype.setAudio = function (tag) {
|
|
|
|
this.mediaCallback = this.listenOnly.bind(this);
|
|
|
|
this.create(tag);
|
|
|
|
};
|
|
|
|
|
|
|
|
Kurento.prototype.listenOnly = function () {
|
|
|
|
var self = this;
|
|
|
|
if (!this.webRtcPeer) {
|
2018-07-11 03:59:05 +08:00
|
|
|
this.addIceServers((configuration) => {
|
|
|
|
let options = {
|
|
|
|
remoteVideo: document.getElementById(this.renderTag),
|
|
|
|
onicecandidate : this.onListenOnlyIceCandidate.bind(this),
|
|
|
|
mediaConstraints: {
|
|
|
|
audio:true,
|
|
|
|
video:false
|
|
|
|
}
|
2018-05-08 01:44:18 +08:00
|
|
|
}
|
|
|
|
|
2018-07-11 03:59:05 +08:00
|
|
|
if (configuration) {
|
|
|
|
options.configuration = configuration;
|
2018-05-08 01:44:18 +08:00
|
|
|
}
|
|
|
|
|
2018-07-11 03:59:05 +08:00
|
|
|
self.webRtcPeer = kurentoUtils.WebRtcPeer.WebRtcPeerRecvonly(options, function(error) {
|
|
|
|
if(error) {
|
|
|
|
return self.onFail(PEER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.generateOffer(self.onOfferListenOnly.bind(self));
|
|
|
|
});
|
2018-05-08 01:44:18 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Kurento.prototype.onListenOnlyIceCandidate = function (candidate) {
|
|
|
|
let self = this;
|
|
|
|
console.debug("[onListenOnlyIceCandidate]", JSON.stringify(candidate));
|
|
|
|
|
|
|
|
var message = {
|
|
|
|
id : 'iceCandidate',
|
|
|
|
type: 'audio',
|
2018-06-29 02:50:56 +08:00
|
|
|
role: 'viewer',
|
2018-05-08 01:44:18 +08:00
|
|
|
voiceBridge: self.voiceBridge,
|
|
|
|
candidate : candidate,
|
|
|
|
}
|
|
|
|
this.sendMessage(message);
|
|
|
|
};
|
|
|
|
|
|
|
|
Kurento.prototype.onOfferListenOnly = function (error, offerSdp) {
|
|
|
|
let self = this;
|
|
|
|
if(error) {
|
|
|
|
console.error("[onOfferListenOnly]", error);
|
|
|
|
return this.onFail(SDP_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
let message = {
|
|
|
|
id : 'start',
|
|
|
|
type: 'audio',
|
|
|
|
role: 'viewer',
|
|
|
|
voiceBridge: self.voiceBridge,
|
2018-06-29 02:50:56 +08:00
|
|
|
caleeName: self.caleeName,
|
2018-05-08 01:44:18 +08:00
|
|
|
sdpOffer : offerSdp,
|
|
|
|
userId: self.userId,
|
|
|
|
userName: self.userName,
|
|
|
|
internalMeetingId: self.internalMeetingId
|
|
|
|
};
|
|
|
|
|
|
|
|
console.debug("[onOfferListenOnly]", JSON.stringify(message, null, 2));
|
|
|
|
this.sendMessage(message);
|
|
|
|
};
|
|
|
|
|
2018-04-26 00:56:16 +08:00
|
|
|
Kurento.prototype.pauseTrack = function (message) {
|
|
|
|
const localStream = this.webRtcPeer.peerConnection.getLocalStreams()[0];
|
|
|
|
const track = localStream.getVideoTracks()[0];
|
|
|
|
|
|
|
|
if (track) {
|
|
|
|
track.enabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Kurento.prototype.resumeTrack = function (message) {
|
|
|
|
const localStream = this.webRtcPeer.peerConnection.getLocalStreams()[0];
|
|
|
|
const track = localStream.getVideoTracks()[0];
|
|
|
|
|
|
|
|
if (track) {
|
|
|
|
track.enabled = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
Kurento.prototype.stop = function () {
|
|
|
|
// if (this.webRtcPeer) {
|
2017-11-06 22:27:12 +08:00
|
|
|
// var message = {
|
|
|
|
// id : 'stop',
|
|
|
|
// type : 'screenshare',
|
|
|
|
// voiceBridge: kurentoHandler.voiceBridge
|
|
|
|
// }
|
|
|
|
// kurentoHandler.sendMessage(message);
|
|
|
|
// kurentoHandler.disposeScreenShare();
|
2018-03-08 05:20:37 +08:00
|
|
|
// }
|
|
|
|
};
|
2017-06-14 04:18:21 +08:00
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
Kurento.prototype.dispose = function () {
|
2017-06-14 04:18:21 +08:00
|
|
|
if (this.webRtcPeer) {
|
|
|
|
this.webRtcPeer.dispose();
|
|
|
|
this.webRtcPeer = null;
|
|
|
|
}
|
2018-03-08 05:20:37 +08:00
|
|
|
};
|
2017-06-14 04:18:21 +08:00
|
|
|
|
2018-05-08 01:44:18 +08:00
|
|
|
Kurento.prototype.ping = function () {
|
|
|
|
const message = {
|
|
|
|
id: 'ping'
|
|
|
|
};
|
|
|
|
this.sendMessage(message);
|
|
|
|
}
|
2017-06-14 04:18:21 +08:00
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
Kurento.prototype.sendMessage = function (message) {
|
|
|
|
const jsonMessage = JSON.stringify(message);
|
2018-07-11 03:59:05 +08:00
|
|
|
console.debug(`Sending message: ${jsonMessage}`);
|
2017-06-14 04:18:21 +08:00
|
|
|
this.ws.send(jsonMessage);
|
2018-03-08 05:20:37 +08:00
|
|
|
};
|
2017-06-14 04:18:21 +08:00
|
|
|
|
|
|
|
Kurento.prototype.logger = function (obj) {
|
|
|
|
console.log(obj);
|
|
|
|
};
|
|
|
|
|
|
|
|
Kurento.prototype.logError = function (obj) {
|
|
|
|
console.error(obj);
|
|
|
|
};
|
|
|
|
|
2018-07-25 04:45:08 +08:00
|
|
|
Kurento.prototype.logSuccess = function (obj) {
|
|
|
|
console.log(obj);
|
|
|
|
};
|
2017-06-14 04:18:21 +08:00
|
|
|
|
2017-07-18 03:30:58 +08:00
|
|
|
Kurento.normalizeCallback = function (callback) {
|
2018-03-08 05:20:37 +08:00
|
|
|
if (typeof callback === 'function') {
|
2017-07-18 03:30:58 +08:00
|
|
|
return callback;
|
|
|
|
}
|
2018-03-08 05:20:37 +08:00
|
|
|
console.log(document.getElementById('BigBlueButton')[callback]);
|
|
|
|
return function (args) {
|
|
|
|
document.getElementById('BigBlueButton')[callback](args);
|
|
|
|
};
|
2017-07-18 03:30:58 +08:00
|
|
|
};
|
2017-06-14 04:18:21 +08:00
|
|
|
|
|
|
|
/* Global methods */
|
|
|
|
|
2017-07-04 03:13:00 +08:00
|
|
|
// this function explains how to use above methods/objects
|
2018-03-08 05:20:37 +08:00
|
|
|
window.getScreenConstraints = function (sendSource, callback) {
|
2019-01-04 01:08:41 +08:00
|
|
|
let screenConstraints = { video: {}, audio: false };
|
2017-07-04 03:13:00 +08:00
|
|
|
|
2018-02-09 06:53:18 +08:00
|
|
|
// Limiting FPS to a range of 5-10 (5 ideal)
|
2018-03-08 05:20:37 +08:00
|
|
|
screenConstraints.video.frameRate = { ideal: 5, max: 10 };
|
2018-05-10 07:38:20 +08:00
|
|
|
screenConstraints.video.height = { max: kurentoManager.kurentoScreenshare.vid_max_height };
|
|
|
|
screenConstraints.video.width = { max: kurentoManager.kurentoScreenshare.vid_max_width };
|
2018-02-09 06:53:18 +08:00
|
|
|
|
2019-01-04 02:17:13 +08:00
|
|
|
const getDisplayMediaConstraints = function () {
|
|
|
|
// The fine-grained constraints (e.g.: frameRate) are supposed to go into
|
|
|
|
// the MediaStream because getDisplayMedia does not support them,
|
|
|
|
// so they're passed differently
|
|
|
|
kurentoManager.kurentoScreenshare.extensionInstalled = true;
|
|
|
|
optionalConstraints.width = { max: kurentoManager.kurentoScreenshare.vid_max_width };
|
|
|
|
optionalConstraints.height = { max: kurentoManager.kurentoScreenshare.vid_max_height };
|
|
|
|
optionalConstraints.frameRate = { ideal: 5, max: 10 };
|
|
|
|
|
|
|
|
let gDPConstraints = {
|
|
|
|
video: true,
|
|
|
|
optional: optionalConstraints
|
|
|
|
}
|
|
|
|
|
|
|
|
return gDPConstraints;
|
|
|
|
};
|
|
|
|
|
2019-01-04 01:08:41 +08:00
|
|
|
const optionalConstraints = [
|
|
|
|
{ googCpuOveruseDetection: true },
|
|
|
|
{ googCpuOveruseEncodeUsage: true },
|
|
|
|
{ googCpuUnderuseThreshold: 55 },
|
|
|
|
{ googCpuOveruseThreshold: 100 },
|
|
|
|
{ googPayloadPadding: true },
|
|
|
|
{ googScreencastMinBitrate: 600 },
|
|
|
|
{ googHighStartBitrate: true },
|
|
|
|
{ googHighBitrate: true },
|
|
|
|
{ googVeryHighBitrate: true },
|
|
|
|
];
|
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
if (isChrome) {
|
2019-01-04 01:08:41 +08:00
|
|
|
if (!hasDisplayMedia) {
|
|
|
|
getChromeScreenConstraints((constraints) => {
|
|
|
|
if (!constraints) {
|
|
|
|
document.dispatchEvent(new Event('installChromeExtension'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const sourceId = constraints.streamId;
|
2018-02-09 06:53:18 +08:00
|
|
|
|
2019-01-04 01:08:41 +08:00
|
|
|
kurentoManager.kurentoScreenshare.extensionInstalled = true;
|
2017-07-04 03:13:00 +08:00
|
|
|
|
2019-01-04 01:08:41 +08:00
|
|
|
// this statement sets gets 'sourceId" and sets "chromeMediaSourceId"
|
|
|
|
screenConstraints.video.chromeMediaSource = { exact: [sendSource] };
|
|
|
|
screenConstraints.video.chromeMediaSourceId = sourceId;
|
|
|
|
screenConstraints.optional = optionalConstraints;
|
|
|
|
|
|
|
|
console.log('getScreenConstraints for Chrome returns => ', screenConstraints);
|
|
|
|
// now invoking native getUserMedia API
|
|
|
|
callback(null, screenConstraints);
|
|
|
|
}, chromeExtension);
|
|
|
|
} else {
|
2019-01-04 02:17:13 +08:00
|
|
|
return callback(null, getDisplayMediaConstraints());
|
2019-01-04 01:08:41 +08:00
|
|
|
}
|
2018-03-08 05:20:37 +08:00
|
|
|
} else if (isFirefox) {
|
2018-07-11 03:59:05 +08:00
|
|
|
screenConstraints.video.mediaSource = 'window';
|
2017-11-06 22:27:12 +08:00
|
|
|
|
2018-03-10 02:35:37 +08:00
|
|
|
console.log('getScreenConstraints for Firefox returns => ', screenConstraints);
|
2017-11-06 22:27:12 +08:00
|
|
|
// now invoking native getUserMedia API
|
|
|
|
callback(null, screenConstraints);
|
2019-01-04 02:17:13 +08:00
|
|
|
} else if (isSafari && !hasDisplayMedia) {
|
2018-03-08 05:20:37 +08:00
|
|
|
screenConstraints.video.mediaSource = 'screen';
|
2017-07-04 03:13:00 +08:00
|
|
|
|
2018-03-10 02:35:37 +08:00
|
|
|
console.log('getScreenConstraints for Safari returns => ', screenConstraints);
|
2017-07-04 03:13:00 +08:00
|
|
|
// now invoking native getUserMedia API
|
2017-11-06 22:27:12 +08:00
|
|
|
callback(null, screenConstraints);
|
2019-01-04 02:17:13 +08:00
|
|
|
} else if (hasDisplayMedia) {
|
|
|
|
// Falls back to getDisplayMedia if the browser supports it
|
|
|
|
return callback(null, getDisplayMediaConstraints());
|
2017-07-04 03:13:00 +08:00
|
|
|
}
|
2018-03-08 05:20:37 +08:00
|
|
|
};
|
2017-07-04 03:13:00 +08:00
|
|
|
|
|
|
|
window.kurentoInitialize = function () {
|
2018-03-08 05:20:37 +08:00
|
|
|
if (window.kurentoManager == null || window.KurentoManager === undefined) {
|
2017-07-04 03:13:00 +08:00
|
|
|
window.kurentoManager = new KurentoManager();
|
|
|
|
}
|
2017-06-14 04:18:21 +08:00
|
|
|
};
|
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
window.kurentoShareScreen = function () {
|
2017-07-04 03:13:00 +08:00
|
|
|
window.kurentoInitialize();
|
|
|
|
window.kurentoManager.shareScreen.apply(window.kurentoManager, arguments);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-06-14 04:18:21 +08:00
|
|
|
window.kurentoExitScreenShare = function () {
|
|
|
|
window.kurentoInitialize();
|
|
|
|
window.kurentoManager.exitScreenShare();
|
|
|
|
};
|
|
|
|
|
2017-07-04 03:13:00 +08:00
|
|
|
window.kurentoWatchVideo = function () {
|
|
|
|
window.kurentoInitialize();
|
|
|
|
window.kurentoManager.joinWatchVideo.apply(window.kurentoManager, arguments);
|
|
|
|
};
|
2017-09-09 01:00:00 +08:00
|
|
|
|
|
|
|
window.kurentoExitVideo = function () {
|
2017-11-06 22:27:12 +08:00
|
|
|
window.kurentoInitialize();
|
|
|
|
window.kurentoManager.exitVideo();
|
2018-03-08 05:20:37 +08:00
|
|
|
};
|
|
|
|
|
2018-05-08 01:44:18 +08:00
|
|
|
window.kurentoJoinAudio = function () {
|
|
|
|
window.kurentoInitialize();
|
|
|
|
window.kurentoManager.joinAudio.apply(window.kurentoManager, arguments);
|
|
|
|
};
|
|
|
|
|
|
|
|
window.kurentoExitAudio = function () {
|
|
|
|
window.kurentoInitialize();
|
|
|
|
window.kurentoManager.exitAudio();
|
|
|
|
};
|
|
|
|
|
2018-03-08 05:20:37 +08:00
|
|
|
window.getChromeScreenConstraints = function (callback, extensionId) {
|
|
|
|
chrome.runtime.sendMessage(
|
|
|
|
extensionId, {
|
|
|
|
getStream: true,
|
|
|
|
sources: [
|
|
|
|
'screen',
|
2018-07-11 03:59:05 +08:00
|
|
|
'window',
|
2018-03-08 05:20:37 +08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
(response) => {
|
2017-11-06 22:27:12 +08:00
|
|
|
console.log(response);
|
|
|
|
callback(response);
|
2018-03-08 05:20:37 +08:00
|
|
|
},
|
|
|
|
);
|
|
|
|
};
|
2018-04-20 05:45:22 +08:00
|
|
|
|
|
|
|
// a function to check whether the browser (Chrome only) is in an isIncognito
|
|
|
|
// session. Requires 1 mandatory callback that only gets called if the browser
|
|
|
|
// session is incognito. The callback for not being incognito is optional.
|
|
|
|
// Attempts to retrieve the chrome filesystem API.
|
|
|
|
window.checkIfIncognito = function(isIncognito, isNotIncognito = function () {}) {
|
|
|
|
isIncognito = Kurento.normalizeCallback(isIncognito);
|
|
|
|
isNotIncognito = Kurento.normalizeCallback(isNotIncognito);
|
|
|
|
|
|
|
|
var fs = window.RequestFileSystem || window.webkitRequestFileSystem;
|
|
|
|
if (!fs) {
|
|
|
|
isNotIncognito();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fs(window.TEMPORARY, 100, function(){isNotIncognito()}, function(){isIncognito()});
|
|
|
|
};
|
|
|
|
|
|
|
|
window.checkChromeExtInstalled = function (callback, chromeExtensionId) {
|
|
|
|
callback = Kurento.normalizeCallback(callback);
|
|
|
|
|
2019-01-04 01:08:41 +08:00
|
|
|
if (hasDisplayMedia) {
|
|
|
|
return callback(true);
|
|
|
|
}
|
|
|
|
|
2018-04-20 05:45:22 +08:00
|
|
|
if (typeof chrome === "undefined" || !chrome || !chrome.runtime) {
|
|
|
|
// No API, so no extension for sure
|
|
|
|
callback(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
chrome.runtime.sendMessage(
|
|
|
|
chromeExtensionId,
|
|
|
|
{ getVersion: true },
|
|
|
|
function (response) {
|
|
|
|
if (!response || !response.version) {
|
|
|
|
// Communication failure - assume that no endpoint exists
|
|
|
|
callback(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
callback(true);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|