2016-06-09 04:07:43 +08:00
|
|
|
Verto = function (
|
2016-06-18 04:36:45 +08:00
|
|
|
tag,
|
2016-06-09 04:07:43 +08:00
|
|
|
voiceBridge,
|
|
|
|
conferenceUsername,
|
|
|
|
conferenceIdNumber,
|
|
|
|
userCallback,
|
2016-06-17 23:43:03 +08:00
|
|
|
credentials,
|
2016-06-18 04:36:45 +08:00
|
|
|
onFail = null,
|
|
|
|
chromeExtension = null) {
|
2016-06-09 04:07:43 +08:00
|
|
|
|
2016-07-30 00:16:55 +08:00
|
|
|
voiceBridge += "-DESKSHARE";
|
2016-06-09 04:07:43 +08:00
|
|
|
this.cur_call = null;
|
|
|
|
this.share_call = null;
|
|
|
|
this.vertoHandle;
|
|
|
|
|
|
|
|
this.vid_width = 1920;
|
|
|
|
this.vid_height = 1080;
|
|
|
|
|
|
|
|
this.local_vid_width = 320;
|
|
|
|
this.local_vid_height = 180;
|
|
|
|
this.outgoingBandwidth;
|
|
|
|
this.incomingBandwidth;
|
|
|
|
this.sessid = null;
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
this.renderTag = 'remote-media';
|
2016-06-09 04:07:43 +08:00
|
|
|
|
|
|
|
this.destination_number = voiceBridge;
|
|
|
|
this.caller_id_name = conferenceUsername;
|
|
|
|
this.caller_id_number = conferenceIdNumber;
|
|
|
|
|
|
|
|
this.vertoPort = credentials.vertoPort;
|
|
|
|
this.hostName = credentials.hostName;
|
2016-06-20 23:59:48 +08:00
|
|
|
this.socketUrl = 'wss://' + this.hostName + ':' + this.vertoPort;
|
2016-06-09 04:07:43 +08:00
|
|
|
this.login = credentials.login;
|
|
|
|
this.password = credentials.password;
|
2016-06-20 23:59:48 +08:00
|
|
|
this.minWidth = '640';
|
|
|
|
this.minHeight = '480';
|
|
|
|
this.maxWidth = '1920';
|
|
|
|
this.maxHeight = '1080';
|
2016-06-09 04:07:43 +08:00
|
|
|
|
|
|
|
this.useVideo = false;
|
|
|
|
this.useCamera = false;
|
|
|
|
this.useMic = false;
|
|
|
|
|
|
|
|
this.callWasSuccessful = false;
|
|
|
|
|
|
|
|
this.iceServers = null;
|
|
|
|
|
|
|
|
this.userCallback = userCallback;
|
2016-06-17 23:43:03 +08:00
|
|
|
|
|
|
|
if (chromeExtension != null) {
|
|
|
|
this.chromeExtension = chromeExtension;
|
|
|
|
}
|
2016-06-18 04:36:45 +08:00
|
|
|
|
|
|
|
if (onFail != null) {
|
2016-06-29 01:15:36 +08:00
|
|
|
this.onFail = Verto.normalizeCallback(onFail);
|
2016-06-21 03:39:20 +08:00
|
|
|
} else {
|
|
|
|
var _this = this;
|
|
|
|
this.onFail = function () {
|
|
|
|
_this.logError('Default error handler');
|
|
|
|
};
|
2016-06-18 04:36:45 +08:00
|
|
|
}
|
2016-06-09 04:07:43 +08:00
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
Verto.prototype.logger = function (obj) {
|
2016-06-09 04:07:43 +08:00
|
|
|
console.log(obj);
|
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
Verto.prototype.logError = function (obj) {
|
2016-06-09 04:07:43 +08:00
|
|
|
console.error(obj);
|
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
Verto.prototype.setRenderTag = function (tag) {
|
2016-06-09 04:07:43 +08:00
|
|
|
this.renderTag = tag;
|
|
|
|
};
|
2015-07-10 23:13:13 +08:00
|
|
|
|
2016-02-24 07:16:39 +08:00
|
|
|
// receives either a string variable holding the name of an actionscript
|
|
|
|
// registered callback, or a javascript function object.
|
|
|
|
// The function will return either the function if it is a javascript Function
|
|
|
|
// or if it is an actionscript string it will return a javascript Function
|
|
|
|
// that when invokved will invoke the actionscript registered callback
|
|
|
|
// and passes along parameters
|
2016-06-29 01:15:36 +08:00
|
|
|
Verto.normalizeCallback = function (callback) {
|
2016-06-20 23:59:48 +08:00
|
|
|
if (typeof callback == 'function') {
|
2016-06-09 04:07:43 +08:00
|
|
|
return callback;
|
|
|
|
} else {
|
2016-06-20 23:59:48 +08:00
|
|
|
return function (args) {
|
|
|
|
document.getElementById('BigBlueButton')[callback](args);
|
2016-06-09 04:07:43 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
Verto.prototype.onWSLogin = function (v, success) {
|
2016-06-09 04:07:43 +08:00
|
|
|
this.cur_call = null;
|
|
|
|
if (success) {
|
|
|
|
this.callWasSuccessful = true;
|
2016-06-15 00:11:04 +08:00
|
|
|
this.mediaCallback();
|
2016-06-18 04:36:45 +08:00
|
|
|
return;
|
2016-06-09 04:07:43 +08:00
|
|
|
} else {
|
2016-06-21 03:39:20 +08:00
|
|
|
// error logging verto into freeswitch
|
2016-06-20 23:59:48 +08:00
|
|
|
this.logError({ status: 'failed', errorcode: '10XX' });
|
2016-06-18 04:36:45 +08:00
|
|
|
this.callWasSuccessful = false;
|
|
|
|
this.onFail();
|
|
|
|
return;
|
2016-06-09 04:07:43 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-06-15 00:11:04 +08:00
|
|
|
Verto.prototype.registerCallbacks = function () {
|
2016-06-09 04:07:43 +08:00
|
|
|
var callbacks = {
|
2016-06-20 23:59:48 +08:00
|
|
|
onMessage: function () {},
|
|
|
|
|
|
|
|
onDialogState: function (d) {},
|
|
|
|
|
2016-06-09 04:07:43 +08:00
|
|
|
onWSLogin: this.onWSLogin.bind(this),
|
2016-06-20 23:59:48 +08:00
|
|
|
|
|
|
|
onWSClose: function (v, success) {
|
2016-06-09 04:07:43 +08:00
|
|
|
cur_call = null;
|
|
|
|
if (this.callWasSuccessful) {
|
|
|
|
// the connection was dropped in an already established call
|
|
|
|
this.logError('websocket disconnected');
|
2016-06-20 23:59:48 +08:00
|
|
|
|
2016-06-09 04:07:43 +08:00
|
|
|
// WebSocket disconnected
|
2016-06-20 23:59:48 +08:00
|
|
|
this.logError({ status: 'failed', errorcode: 1001 });
|
2016-06-09 04:07:43 +08:00
|
|
|
toDisplayDisconnectCallback = false;
|
|
|
|
} else {
|
|
|
|
// this callback was triggered and a call was never successfully established
|
2016-06-20 23:59:48 +08:00
|
|
|
this.logError('websocket connection could not be established');
|
|
|
|
|
2016-06-09 04:07:43 +08:00
|
|
|
// Could not make a WebSocket connection
|
2016-06-20 23:59:48 +08:00
|
|
|
this.logError({ status: 'failed', errorcode: 1002 });
|
2016-06-18 04:36:45 +08:00
|
|
|
this.onFail();
|
|
|
|
return;
|
2016-06-09 04:07:43 +08:00
|
|
|
}
|
|
|
|
}.bind(this),
|
|
|
|
};
|
|
|
|
this.callbacks = callbacks;
|
|
|
|
};
|
|
|
|
|
|
|
|
Verto.prototype.hold = function () {
|
|
|
|
this.cur_call.toggleHold();
|
|
|
|
};
|
|
|
|
|
|
|
|
Verto.prototype.hangup = function () {
|
|
|
|
if (this.cur_call) {
|
|
|
|
// the duration of the call
|
|
|
|
this.logger('call ended ' + this.cur_call.audioStream.currentTime);
|
2016-06-29 01:15:36 +08:00
|
|
|
this.cur_call.hangup();
|
|
|
|
this.cur_call = null;
|
2016-06-09 04:07:43 +08:00
|
|
|
}
|
|
|
|
|
2016-06-15 00:11:04 +08:00
|
|
|
if (this.share_call) {
|
|
|
|
// the duration of the call
|
|
|
|
this.logger('call ended ' + this.share_call.audioStream.currentTime);
|
2016-06-29 01:15:36 +08:00
|
|
|
this.share_call.hangup();
|
|
|
|
this.share_call = null;
|
2016-06-15 00:11:04 +08:00
|
|
|
}
|
|
|
|
|
2016-06-09 04:07:43 +08:00
|
|
|
// the user ended the call themself
|
|
|
|
// if (callPurposefullyEnded === true) {
|
|
|
|
if (true) {
|
2016-06-20 23:59:48 +08:00
|
|
|
this.logger({ status: 'ended' });
|
2016-06-09 04:07:43 +08:00
|
|
|
} else {
|
|
|
|
// Call ended unexpectedly
|
2016-06-20 23:59:48 +08:00
|
|
|
this.logError({ status: 'failed', errorcode: 1005 });
|
2016-06-09 04:07:43 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Verto.prototype.mute = function () {
|
2016-06-20 23:59:48 +08:00
|
|
|
this.cur_call.dtmf('0');
|
2016-06-09 04:07:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
Verto.prototype.localmute = function () {
|
2016-06-20 23:59:48 +08:00
|
|
|
// var muted = cur_call.setMute('toggle');
|
2016-06-09 04:07:43 +08:00
|
|
|
// if (muted) {
|
2016-06-20 23:59:48 +08:00
|
|
|
// display('Talking to: ' + cur_call.cidString() + ' [LOCALLY MUTED]');
|
2016-06-09 04:07:43 +08:00
|
|
|
// } else {
|
2016-06-20 23:59:48 +08:00
|
|
|
// display('Talking to: ' + cur_call.cidString());
|
2016-06-09 04:07:43 +08:00
|
|
|
// }
|
|
|
|
};
|
|
|
|
|
|
|
|
Verto.prototype.localvidmute = function () {
|
2016-06-20 23:59:48 +08:00
|
|
|
// var muted = cur_call.setVideoMute('toggle');
|
2016-06-09 04:07:43 +08:00
|
|
|
// if (muted) {
|
2016-06-20 23:59:48 +08:00
|
|
|
// display('Talking to: ' + cur_call.cidString() + ' [VIDEO LOCALLY MUTED]');
|
2016-06-09 04:07:43 +08:00
|
|
|
// } else {
|
2016-06-20 23:59:48 +08:00
|
|
|
// display('Talking to: ' + cur_call.cidString());
|
2016-06-09 04:07:43 +08:00
|
|
|
// }
|
|
|
|
};
|
|
|
|
|
|
|
|
Verto.prototype.vmute = function () {
|
2016-06-20 23:59:48 +08:00
|
|
|
this.cur_call.dtmf('*0');
|
2016-06-09 04:07:43 +08:00
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
Verto.prototype.setWatchVideo = function (tag) {
|
2016-06-15 00:11:04 +08:00
|
|
|
this.mediaCallback = this.docall;
|
2016-06-09 04:07:43 +08:00
|
|
|
this.useVideo = true;
|
|
|
|
this.useCamera = 'none';
|
|
|
|
this.useMic = 'none';
|
|
|
|
this.create(tag);
|
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
Verto.prototype.setListenOnly = function (tag) {
|
2016-06-15 00:11:04 +08:00
|
|
|
this.mediaCallback = this.docall;
|
2016-06-09 04:07:43 +08:00
|
|
|
this.useVideo = false;
|
|
|
|
this.useCamera = 'none';
|
|
|
|
this.useMic = 'none';
|
|
|
|
this.create(tag);
|
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
Verto.prototype.setMicrophone = function (tag) {
|
2016-06-15 00:11:04 +08:00
|
|
|
this.mediaCallback = this.docall;
|
2016-06-09 04:07:43 +08:00
|
|
|
this.useVideo = false;
|
|
|
|
this.useCamera = 'none';
|
|
|
|
this.useMic = 'any';
|
|
|
|
this.create(tag);
|
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
Verto.prototype.setScreenShare = function (tag) {
|
2016-06-17 23:43:03 +08:00
|
|
|
this.mediaCallback = this.makeShare;
|
2016-06-15 00:11:04 +08:00
|
|
|
this.create(tag);
|
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
Verto.prototype.create = function (tag) {
|
2016-06-09 04:07:43 +08:00
|
|
|
this.setRenderTag(tag);
|
|
|
|
this.registerCallbacks();
|
2016-06-21 03:39:20 +08:00
|
|
|
this.configStuns(this.init);
|
2016-06-09 04:07:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
Verto.prototype.docall = function () {
|
|
|
|
if (this.cur_call) {
|
2016-06-20 23:59:48 +08:00
|
|
|
this.logger('Quitting: Call already in progress');
|
2016-06-09 04:07:43 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-06-20 23:05:39 +08:00
|
|
|
this.cur_call = window.vertoHandle.newCall({
|
2016-06-09 04:07:43 +08:00
|
|
|
destination_number: this.destination_number,
|
|
|
|
caller_id_name: this.caller_id_name,
|
|
|
|
caller_id_number: this.caller_id_number,
|
|
|
|
outgoingBandwidth: this.outgoingBandwidth,
|
|
|
|
incomingBandwidth: this.incomingBandwidth,
|
|
|
|
useVideo: this.useVideo,
|
|
|
|
useStereo: true,
|
|
|
|
useCamera: this.useCamera,
|
|
|
|
useMic: this.useMic,
|
|
|
|
useSpeak: 'any',
|
|
|
|
dedEnc: true,
|
2016-06-20 23:05:39 +08:00
|
|
|
tag: this.renderTag,
|
2016-06-09 04:07:43 +08:00
|
|
|
});
|
|
|
|
this.logger(this.cur_call);
|
|
|
|
};
|
|
|
|
|
2016-06-17 23:43:03 +08:00
|
|
|
Verto.prototype.makeShare = function () {
|
|
|
|
if (this.share_call) {
|
2016-06-20 23:59:48 +08:00
|
|
|
this.logError('Quitting: Call already in progress');
|
2016-06-17 23:43:03 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var screenInfo = null;
|
|
|
|
if (!!navigator.mozGetUserMedia) {
|
|
|
|
screenInfo = {
|
|
|
|
video: {
|
2016-06-20 23:59:48 +08:00
|
|
|
mozMediaSource: 'window',
|
|
|
|
mediaSource: 'window',
|
|
|
|
},
|
2016-06-17 23:43:03 +08:00
|
|
|
};
|
|
|
|
this.doShare(screenInfo.video);
|
|
|
|
} else if (!!window.chrome) {
|
|
|
|
var _this = this;
|
2016-06-18 04:36:45 +08:00
|
|
|
if (!_this.chromeExtension) {
|
|
|
|
_this.logError({
|
2016-06-20 23:59:48 +08:00
|
|
|
status: 'failed',
|
|
|
|
message: 'Missing Chrome Extension key',
|
2016-06-17 23:43:03 +08:00
|
|
|
});
|
2016-06-18 04:36:45 +08:00
|
|
|
_this.onFail();
|
|
|
|
return;
|
2016-06-17 23:43:03 +08:00
|
|
|
}
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
getChromeExtensionStatus(this.chromeExtension, function (status) {
|
|
|
|
if (status != 'installed-enabled') {
|
|
|
|
_this.logError('No chrome Extension');
|
2016-06-18 04:36:45 +08:00
|
|
|
_this.onFail();
|
2016-06-17 23:43:03 +08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// bring up Chrome screen picker
|
2016-06-20 23:59:48 +08:00
|
|
|
getScreenConstraints(function (error, screenConstraints) {
|
2016-06-17 23:43:03 +08:00
|
|
|
if (error) {
|
2016-06-18 04:36:45 +08:00
|
|
|
_this.onFail();
|
|
|
|
return _this.logError(error);
|
2016-06-17 23:43:03 +08:00
|
|
|
}
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
screenInfo = screenConstraints.mandatory;
|
2016-06-17 23:43:03 +08:00
|
|
|
|
2016-06-18 04:36:45 +08:00
|
|
|
_this.logger(screenInfo);
|
2016-06-17 23:43:03 +08:00
|
|
|
_this.doShare(screenInfo);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
Verto.prototype.doShare = function (screenConstraints) {
|
2016-06-20 23:05:39 +08:00
|
|
|
this.share_call = window.vertoHandle.newCall({
|
2016-06-17 23:43:03 +08:00
|
|
|
destination_number: this.destination_number,
|
|
|
|
caller_id_name: this.caller_id_name,
|
|
|
|
caller_id_number: this.caller_id_number,
|
|
|
|
outgoingBandwidth: this.outgoingBandwidth,
|
|
|
|
incomingBandwidth: this.incomingBandwidth,
|
2016-06-20 23:59:48 +08:00
|
|
|
videoParams: screenConstraints,
|
2016-06-17 23:43:03 +08:00
|
|
|
useVideo: true,
|
|
|
|
screenShare: true,
|
|
|
|
dedEnc: true,
|
|
|
|
mirrorInput: false,
|
2016-06-20 23:05:39 +08:00
|
|
|
tag: this.renderTag,
|
2016-06-17 23:43:03 +08:00
|
|
|
});
|
2016-06-09 04:07:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
Verto.prototype.init = function () {
|
|
|
|
this.cur_call = null;
|
|
|
|
|
2016-06-20 23:05:39 +08:00
|
|
|
if (!window.vertoHandle) {
|
|
|
|
window.vertoHandle = new $.verto({
|
|
|
|
login: this.login,
|
|
|
|
passwd: this.password,
|
|
|
|
socketUrl: this.socketUrl,
|
|
|
|
tag: this.renderTag,
|
2016-06-20 23:59:48 +08:00
|
|
|
ringFile: 'sounds/bell_ring2.wav',
|
2016-06-20 23:05:39 +08:00
|
|
|
sessid: this.sessid,
|
|
|
|
videoParams: {
|
2016-06-20 23:59:48 +08:00
|
|
|
minWidth: this.vid_width,
|
|
|
|
minHeight: this.vid_height,
|
|
|
|
maxWidth: this.vid_width,
|
|
|
|
maxHeight: this.vid_height,
|
|
|
|
minFrameRate: 15,
|
|
|
|
vertoBestFrameRate: 30,
|
2016-06-20 23:05:39 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
deviceParams: {
|
|
|
|
useCamera: false,
|
|
|
|
useMic: false,
|
|
|
|
useSpeak: 'none',
|
|
|
|
},
|
|
|
|
|
|
|
|
audioParams: {
|
|
|
|
googAutoGainControl: false,
|
|
|
|
googNoiseSuppression: false,
|
|
|
|
googHighpassFilter: false,
|
|
|
|
},
|
|
|
|
|
|
|
|
iceServers: this.iceServers,
|
|
|
|
}, this.callbacks);
|
|
|
|
} else {
|
|
|
|
this.mediaCallback();
|
|
|
|
return;
|
|
|
|
}
|
2016-06-09 04:07:43 +08:00
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
Verto.prototype.configStuns = function (callback) {
|
|
|
|
this.logger('Fetching STUN/TURN server info for Verto initialization');
|
2016-06-09 04:07:43 +08:00
|
|
|
var _this = this;
|
|
|
|
var stunsConfig = {};
|
|
|
|
$.ajax({
|
|
|
|
dataType: 'json',
|
2016-06-20 23:59:48 +08:00
|
|
|
url: '/bigbluebutton/api/stuns/',
|
|
|
|
}).done(function (data) {
|
|
|
|
_this.logger('ajax request done');
|
2016-06-09 04:07:43 +08:00
|
|
|
_this.logger(data);
|
2016-06-20 23:59:48 +08:00
|
|
|
if (data.response && data.response.returncode == 'FAILED') {
|
|
|
|
_this.logError(data.response.message, { error: true });
|
|
|
|
_this.logError({ status: 'failed', errorcode: data.response.message });
|
2016-06-09 04:07:43 +08:00
|
|
|
return;
|
|
|
|
}
|
2016-06-20 23:59:48 +08:00
|
|
|
|
|
|
|
stunsConfig.stunServers = (data.stunServers ? data.stunServers.map(function (data) {
|
|
|
|
return { url: data.url };
|
|
|
|
}) : []);
|
|
|
|
|
|
|
|
stunsConfig.turnServers = (data.turnServers ? data.turnServers.map(function (data) {
|
2016-06-09 04:07:43 +08:00
|
|
|
return {
|
2016-06-20 23:59:48 +08:00
|
|
|
urls: data.url,
|
|
|
|
username: data.username,
|
|
|
|
credential: data.password,
|
2016-06-09 04:07:43 +08:00
|
|
|
};
|
2016-06-20 23:59:48 +08:00
|
|
|
}) : []);
|
|
|
|
|
|
|
|
stunsConfig = stunsConfig.stunServers.concat(stunsConfig.turnServers);
|
|
|
|
_this.logger('success got stun data, making verto');
|
2016-06-09 04:07:43 +08:00
|
|
|
_this.iceServers = stunsConfig;
|
|
|
|
callback.apply(_this);
|
2016-06-20 23:59:48 +08:00
|
|
|
}).fail(function (data, textStatus, errorThrown) {
|
|
|
|
_this.logError({ status: 'failed', errorcode: 1009 });
|
2016-06-18 04:36:45 +08:00
|
|
|
_this.onFail();
|
2016-06-09 04:07:43 +08:00
|
|
|
return;
|
|
|
|
});
|
|
|
|
};
|
2015-07-10 23:13:13 +08:00
|
|
|
|
|
|
|
// checks whether Google Chrome or Firefox have the WebRTCPeerConnection object
|
2016-06-09 04:07:43 +08:00
|
|
|
Verto.prototype.isWebRTCAvailable = function () {
|
2016-06-20 23:59:48 +08:00
|
|
|
return (typeof window.webkitRTCPeerConnection !== 'undefined' ||
|
|
|
|
typeof window.mozRTCPeerConnection !== 'undefined');
|
2016-06-09 04:07:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
this.VertoManager = function () {
|
|
|
|
this.vertoAudio = null;
|
|
|
|
this.vertoVideo = null;
|
2016-06-15 00:11:04 +08:00
|
|
|
this.vertoScreenShare = null;
|
2016-06-20 23:05:39 +08:00
|
|
|
window.vertoHandle = null;
|
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
Verto.prototype.logout = function () {
|
2016-06-20 23:05:39 +08:00
|
|
|
this.exitAudio();
|
|
|
|
this.exitVideo();
|
|
|
|
this.exitScreenShare();
|
|
|
|
window.vertoHandle.logout();
|
2016-06-09 04:07:43 +08:00
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
VertoManager.prototype.exitAudio = function () {
|
2016-06-09 04:07:43 +08:00
|
|
|
if (this.vertoAudio != null) {
|
2016-06-29 01:15:36 +08:00
|
|
|
console.log('Hanging up vertoAudio');
|
2016-06-09 04:07:43 +08:00
|
|
|
this.vertoAudio.hangup();
|
|
|
|
this.vertoAudio = null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
VertoManager.prototype.exitVideo = function () {
|
2016-06-09 04:07:43 +08:00
|
|
|
if (this.vertoVideo != null) {
|
2016-06-29 01:15:36 +08:00
|
|
|
console.log('Hanging up vertoVideo');
|
2016-06-09 04:07:43 +08:00
|
|
|
this.vertoVideo.hangup();
|
|
|
|
this.vertoVideo = null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-06-20 23:59:48 +08:00
|
|
|
VertoManager.prototype.exitScreenShare = function () {
|
2016-06-15 00:11:04 +08:00
|
|
|
if (this.vertoScreenShare != null) {
|
2016-06-29 01:15:36 +08:00
|
|
|
console.log('Hanging up vertoScreenShare');
|
2016-06-15 00:11:04 +08:00
|
|
|
this.vertoScreenShare.hangup();
|
|
|
|
this.vertoScreenShare = null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-06-18 04:36:45 +08:00
|
|
|
VertoManager.prototype.joinListenOnly = function (tag) {
|
2016-06-09 04:07:43 +08:00
|
|
|
this.exitAudio();
|
2016-06-18 04:36:45 +08:00
|
|
|
var obj = Object.create(Verto.prototype);
|
|
|
|
Verto.apply(obj, arguments);
|
|
|
|
this.vertoAudio = obj;
|
2016-06-09 04:07:43 +08:00
|
|
|
this.vertoAudio.setListenOnly(tag);
|
|
|
|
};
|
|
|
|
|
2016-06-18 04:36:45 +08:00
|
|
|
VertoManager.prototype.joinMicrophone = function (tag) {
|
2016-06-20 23:59:48 +08:00
|
|
|
this.exitAudio();
|
|
|
|
var obj = Object.create(Verto.prototype);
|
|
|
|
Verto.apply(obj, arguments);
|
|
|
|
this.vertoAudio = obj;
|
|
|
|
this.vertoAudio.setMicrophone(tag);
|
2016-06-09 04:07:43 +08:00
|
|
|
};
|
|
|
|
|
2016-06-18 04:36:45 +08:00
|
|
|
VertoManager.prototype.joinWatchVideo = function (tag) {
|
2016-06-20 23:59:48 +08:00
|
|
|
this.exitVideo();
|
|
|
|
var obj = Object.create(Verto.prototype);
|
|
|
|
Verto.apply(obj, arguments);
|
|
|
|
this.vertoVideo = obj;
|
|
|
|
this.vertoVideo.setWatchVideo(tag);
|
2015-07-10 23:13:13 +08:00
|
|
|
};
|
2016-06-15 00:11:04 +08:00
|
|
|
|
2016-06-18 04:36:45 +08:00
|
|
|
VertoManager.prototype.shareScreen = function (tag) {
|
2016-06-20 23:59:48 +08:00
|
|
|
this.exitScreenShare();
|
|
|
|
var obj = Object.create(Verto.prototype);
|
|
|
|
Verto.apply(obj, arguments);
|
|
|
|
this.vertoScreenShare = obj;
|
|
|
|
this.vertoScreenShare.setScreenShare(tag);
|
2016-06-15 00:11:04 +08:00
|
|
|
};
|
2016-06-18 01:47:24 +08:00
|
|
|
|
2016-06-18 01:50:04 +08:00
|
|
|
window.vertoInitialize = function () {
|
|
|
|
if (window.vertoManager == null || window.vertoManager == undefined) {
|
2016-06-18 01:47:24 +08:00
|
|
|
window.vertoManager = new VertoManager();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-06-18 01:50:04 +08:00
|
|
|
window.vertoExitAudio = function () {
|
|
|
|
window.vertoInitialize();
|
|
|
|
window.vertoManager.exitAudio();
|
|
|
|
};
|
|
|
|
|
|
|
|
window.vertoExitScreenShare = function () {
|
|
|
|
window.vertoInitialize();
|
|
|
|
window.vertoManager.exitScreenShare();
|
|
|
|
};
|
|
|
|
|
2016-06-18 04:36:45 +08:00
|
|
|
window.vertoJoinListenOnly = function () {
|
2016-06-18 01:50:04 +08:00
|
|
|
window.vertoInitialize();
|
2016-06-18 04:36:45 +08:00
|
|
|
window.vertoManager.joinListenOnly.apply(window.vertoManager, arguments);
|
2016-06-18 01:47:24 +08:00
|
|
|
};
|
|
|
|
|
2016-06-18 04:36:45 +08:00
|
|
|
window.vertoJoinMicrophone = function () {
|
2016-06-18 01:50:04 +08:00
|
|
|
window.vertoInitialize();
|
2016-06-18 04:36:45 +08:00
|
|
|
window.vertoManager.joinMicrophone.apply(window.vertoManager, arguments);
|
2016-06-18 01:47:24 +08:00
|
|
|
};
|
|
|
|
|
2016-06-18 04:36:45 +08:00
|
|
|
window.vertoWatchVideo = function () {
|
2016-06-18 01:50:04 +08:00
|
|
|
window.vertoInitialize();
|
2016-06-18 04:36:45 +08:00
|
|
|
window.vertoManager.joinWatchVideo.apply(window.vertoManager, arguments);
|
2016-06-18 01:47:24 +08:00
|
|
|
};
|
2016-06-18 01:50:04 +08:00
|
|
|
|
2016-06-18 04:36:45 +08:00
|
|
|
window.vertoShareScreen = function () {
|
2016-06-18 01:50:04 +08:00
|
|
|
window.vertoInitialize();
|
2016-06-18 04:36:45 +08:00
|
|
|
window.vertoManager.shareScreen.apply(window.vertoManager, arguments);
|
2016-06-18 01:50:04 +08:00
|
|
|
};
|
2016-06-29 01:15:36 +08:00
|
|
|
|
|
|
|
window.vertoExtensionGetChromeExtensionStatus = function (extensionid, callback) {
|
|
|
|
callback = Verto.normalizeCallback(callback);
|
|
|
|
getChromeExtensionStatus(extensionid, callback);
|
|
|
|
};
|
2016-07-30 00:16:55 +08:00
|
|
|
|
|
|
|
|