You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

strophe.jingle.sessionbase.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * Base class for ColibriFocus and JingleSession.
  3. * @param connection Strophe connection object
  4. * @constructor
  5. */
  6. function SessionBase(connection){
  7. this.connection = connection;
  8. this.peerconnection
  9. = new TraceablePeerConnection(
  10. connection.jingle.ice_config,
  11. connection.jingle.pc_constraints);
  12. }
  13. SessionBase.prototype.modifySources = function() {
  14. var self = this;
  15. this.peerconnection.modifySources(function(){
  16. $(document).trigger('setLocalDescription.jingle', [self.sid]);
  17. });
  18. };
  19. SessionBase.prototype.addSource = function (elem) {
  20. this.peerconnection.addSource(elem);
  21. this.modifySources();
  22. };
  23. SessionBase.prototype.removeSource = function (elem) {
  24. this.peerconnection.removeSource(elem);
  25. this.modifySources();
  26. };
  27. // SDP-based mute by going recvonly/sendrecv
  28. // FIXME: should probably black out the screen as well
  29. SessionBase.prototype.hardMuteVideo = function (muted) {
  30. this.peerconnection.hardMuteVideo(muted);
  31. this.connection.jingle.localVideo.getVideoTracks().forEach(function (track) {
  32. track.enabled = !muted;
  33. });
  34. };