FS-11286: Add onRemoteStream callback to Verto dialogs

This patch adds an onRemoteStream callback, which can be specified on the Verto
instance, or per dialog. The callback is fired when the remote stream from a
call is received, and receives two arguments, the first is the remote stream,
the second is the Verto dialog object.
This commit is contained in:
Chad Phillips 2018-07-26 15:34:53 -05:00
parent d5af929660
commit 61cdf63617
2 changed files with 13 additions and 0 deletions

View File

@ -189,6 +189,11 @@
doCallback(self, "onStream", stream);
}
function onRemoteStreamSuccess(self, stream) {
console.log("Remote Stream Success");
doCallback(self, "onRemoteStream", stream);
}
function onICE(self, candidate) {
self.mediaData.candidate = candidate;
self.mediaData.candidateList.push(self.mediaData.candidate);
@ -259,6 +264,7 @@
//self.options.useAudio.play();
self.remoteStream = stream;
onRemoteStreamSuccess(self, stream);
}
function onOfferSDP(self, sdp) {

View File

@ -2060,6 +2060,13 @@
console.log("stream started");
};
RTCcallbacks.onRemoteStream = function(rtc, stream) {
if (typeof dialog.callbacks.onRemoteStream === 'function') {
dialog.callbacks.onRemoteStream(stream, dialog);
}
console.log("remote stream started");
};
RTCcallbacks.onError = function(e) {
if (dialog.verto.options.permissionCallback &&
typeof dialog.verto.options.permissionCallback.onDenied === 'function'){