mediasoup-client: DOMException: Failed to execute 'structuredClone' on 'Window': #
Hello everyone, how are you? I have an issue; I am using the transport.produce function, trying to pass a track to it. However, when doing so, it returns the error shown in the title. I am using Linux, and thus, I use Chromium. But if I switch to Firefox or Google Chrome, I encounter this error: ‘DOMException: Proxy object could not be cloned.’
This is the line of my code that triggers the error.
const producer = await transport.produce({ track });
I pass a track, and I believe there should not be any issues since I am passing a MediaStreamTrack. Nevertheless, I encounter the error. Additionally, I would like to mention that the last version I used was 3.6.89, and it worked fine. However, after updating to version 3.7.2, I am experiencing this problem.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 21 (10 by maintainers)
If anyone has the same problem using Vue, don’t use ref with mediasoup-client as it will use proxies for every property of a class (ex new Device()). Instead prefer using computed values if you need to keep reactivity.
I was using mediasoup client in a class and storing this class in a ref.
Hi, came here looking for a solution for this same problem but ended up finding one on my one. If you want to keep reactivity but to avoid this structuredClone problem you can always use shallowRef in vue: It will keep the object reactive (thus triggering UI changes) without making proxies out of internal properties of that object.
I cannot ignore it because you shown a log in which close() is being called with a track.
I found my problem. The following error
Was due to storing the RoomClient.ts instance in vue ref
const roomClient = ref<RoomClient | null>(null)Now when I am storing it like this
let roomClient: RoomClientthe error gone.The error is gone, but I loose vue reactivity.