Unexpected token 'o', "[object Blob]" is not valid JSON

Viewed 47

So I am trying a video chat code that I've found on youtube but when I try to establish I call I end up with this error .it's been n a few days now and I don't know where is the issue

here is the code


  private localStream: MediaStream;

  inCall = false;
  localVideoActive = false;


  constructor(private dataService: DataService) { }

  async call(): Promise<void> {
    this.createPeerConnection();


    // Add the tracks from the local stream to the RTCPeerConnection
    this.localStream.getTracks().forEach(
      track => this.peerConnection.addTrack(track, this.localStream)
    );

    try {
      const offer: RTCSessionDescriptionInit = await this.peerConnection.createOffer(offerOptions);
      // Establish the offer as the local peer's current description.
      await this.peerConnection.setLocalDescription(offer);

      this.inCall = true;

      this.dataService.sendMessage({type: 'offer', data: offer});
    } catch (err:any) {
      this.handleGetUserMediaError(err);
    }```
0 Answers
Related