Unable to display audio/video of peers

Hey there,

I am trying to use media soup for a personal project and facing some difficulties to play audio/video from peers.

When a new peer connected I am getting consumers for audio and video with the tracks which I am passing directly to audio and video HTML element but I cannot see or hear anything from peers.

Find the code below

// Getting consumers arrar from peer
const consumerArray: Array<any> = this.peer.consumers.map((id: string) => this.consumerService.getConsumer(id));

// geeting audio and video consumer from consumers arrar 
this.audioConsumer = consumerArray.find((consumer: any) => consumer.track.kind === 'audio');
this.videoConsumer = consumerArray.find((consumer: any) => consumer.track.kind === 'video');

// setting audio and video track
this._setTrack(this.audioConsumer.track, this.videoConsumer.track);

private _setTrack(audioTrack: any, videoTrack: any) {
    if(this._audioTrack === audioTrack && this._videoTrack === videoTrack) {
      return;
    }

    this._audioTrack = audioTrack;
    this._videoTrack = videoTrack;

    if(this._audioTrack) {
      const stream: MediaStream = new MediaStream();
      stream.addTrack(this._audioTrack);
      this.renderer.setProperty(this.audioElement.nativeElement, 'srcObject', stream);
      this.audioElement.nativeElement.play().catch((error) => console.log(error));
      this._runHark(stream);
    } else {
      this.renderer.setProperty(this.audioElement.nativeElement, 'srcObject', null);
    }

    if(this._videoTrack) {
      const stream: MediaStream = new MediaStream();
      stream.addTrack(this._videoTrack);
      this.renderer.setProperty(this.videoElement.nativeElement, 'srcObject', stream);
    } else {
      this.renderer.setProperty(this.videoElement.nativeElement, 'srcObject', null);
    }
  }

The code works fine for producers.

I am kind of stuck here any help would really be appreciated.

PS: I am following mediasoup-demo codebase

If this is about the mediasoup-demo then please use the mediasoup-demo category. Changing it.

Other than that, we cannot do debugging for you, but here things that may help: