renegotiate(oldStream, newStream) {
    Log.d('PeerConnection~renegotiate');
    if ((Object.getOwnPropertyDescriptor(RTCPeerConnection.prototype, 'getSenders'))
      && ('RTCRtpSender' in window)
      && Object.getOwnPropertyDescriptor(RTCRtpSender.prototype, 'replaceTrack')) {
      // mozRTCPeerConnection implementation
      this.pc.getSenders().forEach((sender) => {
        let newTracks;
        switch (sender.track.kind) {
          case 'audio':
            newTracks = newStream.getAudioTracks();
            break;
          case 'video':
            newTracks = newStream.getVideoTracks();
            break;
          default:
            newTracks = [];
        }
        if (newTracks.length) {
          sender.replaceTrack(newTracks[0]);
        }
      });
      this._sendOffer()
        .catch((e) => {
          Log.d('PeerConnection~renegotiate', e);
        });
    } else {
      this._alterStream(oldStream, 'remove');
      this._alterStream(newStream, 'add');
    }
  }
/**
   * Restart SDP negotiation following a MediaStream change
   * @access protected
   * @param {MediaStream} oldStream
   * @param {MediaStream} newStream
   */
Restart SDP negotiation following a MediaStream change
@access protected
@param {MediaStream} oldStream
@param {MediaStream} newStream
Restart SDP negotiation following a MediaStream change @access protected @param { MediaStream } oldStream @param { MediaStream } newStream
renegotiate(oldStream, newStream) {
    Log.d('PeerConnection~renegotiate');
    if ((Object.getOwnPropertyDescriptor(RTCPeerConnection.prototype, 'getSenders'))
      && ('RTCRtpSender' in window)
      && Object.getOwnPropertyDescriptor(RTCRtpSender.prototype, 'replaceTrack')) {
      this.pc.getSenders().forEach((sender) => {
        let newTracks;
        switch (sender.track.kind) {
          case 'audio':
            newTracks = newStream.getAudioTracks();
            break;
          case 'video':
            newTracks = newStream.getVideoTracks();
            break;
          default:
            newTracks = [];
        }
        if (newTracks.length) {
          sender.replaceTrack(newTracks[0]);
        }
      });
      this._sendOffer()
        .catch((e) => {
          Log.d('PeerConnection~renegotiate', e);
        });
    } else {
      this._alterStream(oldStream, 'remove');
      this._alterStream(newStream, 'add');
    }
  }
renegotiate ( oldStream , newStream ) { Log . d ( 'PeerConnection~renegotiate' ) ; if ( ( Object . getOwnPropertyDescriptor ( RTCPeerConnection . prototype , 'getSenders' ) ) && ( 'RTCRtpSender' in window ) && Object . getOwnPropertyDescriptor ( RTCRtpSender . prototype , 'replaceTrack' ) ) { this . pc . getSenders ( ) . forEach ( ( sender ) => { let newTracks ; switch ( sender . track . kind ) { case 'audio' : newTracks = newStream . getAudioTracks ( ) ; break ; case 'video' : newTracks = newStream . getVideoTracks ( ) ; break ; default : newTracks = [ ] ; } if ( newTracks . length ) { sender . replaceTrack ( newTracks [ 0 ] ) ; } } ) ; this . _sendOffer ( ) . catch ( ( e ) => { Log . d ( 'PeerConnection~renegotiate' , e ) ; } ) ; } else { this . _alterStream ( oldStream , 'remove' ) ; this . _alterStream ( newStream , 'add' ) ; } }
Restart SDP negotiation following a MediaStream change
 @access protected
 @param {MediaStream} oldStream
 @param {MediaStream} newStream
Restart SDP negotiation following a MediaStream change @access protected @param { MediaStream } oldStream @param { MediaStream } newStream
// mozRTCPeerConnection implementation