]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11286: Add onRemoteStream callback to Verto dialogs
authorChad Phillips <chad@apartmentlines.com>
Thu, 26 Jul 2018 20:34:53 +0000 (15:34 -0500)
committerChad Phillips <chad@apartmentlines.com>
Thu, 26 Jul 2018 20:34:53 +0000 (15:34 -0500)
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
html5/verto/js/src/jquery.verto.js

index c2ea803d0bc232478cc884ddf5eb0560a20714ba..d9105f26200ffc14d5130358349799178d09eee7 100644 (file)
         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);
        
         //self.options.useAudio.play();
         self.remoteStream = stream;
+        onRemoteStreamSuccess(self, stream);
     }
 
     function onOfferSDP(self, sdp) {
index c913ca41404ed45275a15b18f2f97e0e22fd99ed..3d13f918476e0b753c1a151698635d22d6fadfa1 100644 (file)
             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'){