How to properly switch camera during call

Hi, I’m trying to switch camera during call but I cannot make it work.
on Chrome calling another client with Chrome it works well but not if I try it when in the call there are Chrome and Mobile app.
In my case Chrome send a event that triggers mobile app and run the switch code for pass from front camera to back one.
I warn you that I’m a little bit noob about WebRTC so it can depends on that.

Here my code:

The pc class

   * Starting the call
   * @param {Boolean} isCaller
   * @param {Object} config - configuration for the call {audio: boolean, video: boolean}
  start(isCaller, config) {
      .on('stream', stream => {
            //addStream and createOffer() to start the call
      .on('switch', streamsObj => {
        const {oldStream, newStream} = streamsObj;
        console.log('switch', streamsObj);

        this.emit('localStream', newStream); //here I only set the stream video to the RTCView component

    return this;

The mediaDevice method:

switch() {
    if ( { => {
      this.numCamera = (this.numCamera + 1) % this.cameras.length;
      console.log('next camera', this.cameras[this.numCamera]);
      const constraints = {
        video: {
          deviceId: this.cameras[this.numCamera].deviceId,
          height: {min: 360, ideal: 720, max: 1080},
        audio: true,

        .then(stream => {
          // = stream;
          stream.getTracks().forEach(track => {
          const oldS = {};
 = stream;
          this.emit('switch', {oldStream: oldS, newStream:});
        .catch(err => console.log(err));
    return this;

When I run this code on the mobile app the cam swap from front to back but on Chrome client the peer video remains black. During last days I tried lot’s of different methods but still remain on the “stop stream - getUserMedia - addStream(new stream) - createOffer” but never worked and sometimes it throws error on Chrome client like " Failed to execute ‘createAnswer’ on ‘RTCPeerConnection’: PeerConnection cannot create an answer in a state other than have-remote-offer or have-local-pranswer. "
I don’t know how to move, even if you say to me that in the mobile app my code works and the problem is on the Chrome side it would be useful !
Thanks <3