question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to create a DefaultVideoTransformDevice: TypeError: Converting circular structure to JSON

See original GitHub issue

What are you trying to do?

I am trying to implement the feature of background blur and background replacement referencing the demo meeting app

https://github.com/aws-samples/amazon-chime-sdk/tree/main/apps/meeting#readme---react-meeting-demo

How can the documentation be improved to help your use case?

The app i am trying to incorporate the feature is in javascript. I am facing the error create a DefaultVideoTransformDevice: TypeError: Converting circular structure to JSON while selecting the background blur or replacement option from the option dropdown. image

After trying a lot i found one work around to solve the issue. In index.esm.js file when we pass the 2nd argument a replacer function in JSON.stringify it works. Please refer the below code (createBackgroundBlurDevice function) for clear understanding

current code:  1.console.log("Calling createBackgroundBlurDevice with device: " + JSON.stringify(selectedDevice));
                      2. console.log("Created video transform device " + JSON.stringify(chosenVideoTransformDevice, null, 2));
                      
Replaced with : 1.  console.log("Calling createBackgroundBlurDevice with device: " + JSON.stringify(selectedDevice,replacerFunc()));
                          2.console.log("Created video transform device " + JSON.stringify(chosenVideoTransformDevice, replacerFunc()));

replacer functuion adding after base spacing function:

var replacerFunc = function() {
    const visited = new WeakSet();
    return (key, value) => {
      if (typeof value === "object" && value !== null) {
        if (visited.has(value)) {
          return;
        }
        visited.add(value);
      }
      return value;
    };
  };

Also same things changed in createBackgroundReplacementDevice function do the work for background replacement

What documentation have you looked at so far?

Amazon Chime SDK React Components Library GitHub React SDK meeting demo Amazon Chime SDK React Components Library GitHub issues

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tarak-bitcommented, Mar 29, 2022

@ltrung Thanks for the confirmation.

I can see that update is only merged in github but not updated in NPM package amazon-chime-sdk-component-library-react. could you please help me by releasing the same update in NPM package also.

1reaction
samchienGGcommented, Mar 28, 2022

I have the same problem🙈

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is TypeError: Converting circular structure to JSON?
TypeError : Converting circular structure to JSON occurs when you try to reference your variable name within the JSON object.
Read more >
TypeError: Converting circular structure to JSON - Stack ...
It means that the object you pass in the request (I guess it is pagedoc ) has a circular reference, something like: var...
Read more >
"TypeError: Converting circular structure to JSON" unhandled ...
"TypeError: Converting circular structure to JSON" unhandled promise error when emitWarning is issued from Webpack and HMR tries to send it to the...
Read more >
TypeError: Converting circular structure to JSON in JS
The "Converting circular structure to JSON" error occurs when we pass an object or array that contains circular references to the `JSON.stringify()` method....
Read more >
[SOLVED] Keep getting Converting circular structure to JSON ...
Hello everyone, first of all I have to admit that I have just started with coding and this is my first dAPP, so...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found