From 61cdf6361739f0ecaef8d2766aa0bd5bb45ed731 Mon Sep 17 00:00:00 2001 From: Chad Phillips Date: Thu, 26 Jul 2018 15:34:53 -0500 Subject: [PATCH] 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. --- html5/verto/js/src/jquery.FSRTC.js | 6 ++++++ html5/verto/js/src/jquery.verto.js | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/html5/verto/js/src/jquery.FSRTC.js b/html5/verto/js/src/jquery.FSRTC.js index c2ea803d0b..d9105f2620 100644 --- a/html5/verto/js/src/jquery.FSRTC.js +++ b/html5/verto/js/src/jquery.FSRTC.js @@ -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) { diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js index c913ca4140..3d13f91847 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -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'){