]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FSRTC - calling localStream.stop when it's available or localStream.active = false...
authorItalo Rossi <italorossib@gmail.com>
Fri, 25 Sep 2015 13:30:35 +0000 (10:30 -0300)
committerBrian West <brian@freeswitch.org>
Fri, 25 Sep 2015 14:05:08 +0000 (09:05 -0500)
html5/verto/js/src/jquery.FSRTC.js

index c6296f36a8ead0f86a25d939ccffc4dee4570d17..b06951e3121216e985c84aa855007a876cd847d0 100644 (file)
         }
 
         if (self.localStream) {
-            self.localStream.stop();
+            if(typeof self.localStream.stop == 'function') {
+                self.localStream.stop();
+            } else {
+                self.localStream.active = false;
+            }
             self.localStream = null;
         }
 
         }
 
        if (self.options.localVideoStream) {
-           self.options.localVideoStream.stop();
+            if(typeof self.options.localVideoStream.stop == 'function') {
+               self.options.localVideoStream.stop();
+            } else {
+                self.options.localVideoStream.active = false;
+            }
         }
 
         if (self.peer) {
             stop: function() {
                 peer.close();
                 if (options.attachStream) {
+                  if(typeof options.attachStream.stop == 'function') {
                     options.attachStream.stop();
+                  } else {
+                    options.attachStream.active = false;
+                  }
                 }
             }
 
                 audio: ttl++ == 0,
                 video: video       
            },
-           onsuccess: function(e) {e.stop(); console.info(w + "x" + h + " supported."); $.FSRTC.validRes.push([w, h]); checkRes(cam, func);},
+           onsuccess: function(e) {
+              if(typeof e.stop == 'function') {
+                e.stop(); 
+              } else {
+                e.active = false;
+              }
+              console.info(w + "x" + h + " supported."); $.FSRTC.validRes.push([w, h]); checkRes(cam, func);},
            onerror: function(e) {console.error( w + "x" + h + " not supported."); checkRes(cam, func);}
         });
     }
                audio: check_audio,
                video: check_video,
            },
-           onsuccess: function(e) {e.stop(); console.info("media perm init complete"); if (runtime) {setTimeout(runtime, 100, true)}},
+           onsuccess: function(e) {
+              if(typeof e.stop == 'function') {
+                e.stop(); 
+              } else {
+                e.active = false;
+              }
+              console.info("media perm init complete"); 
+              if (runtime) {
+                setTimeout(runtime, 100, true);
+              }
+            },
            onerror: function(e) {
                if (check_video && check_audio) {
                    console.error("error, retesting with audio params only");