Describe the bug
What I'm expecting
The library should import successfully and handle environments where RTCPeerConnection.prototype.addEventListener is read-only or non-configurable. The library should check if properties are writable before attempting to modify them, or use an alternative approach.
What happens instead
The library fails to import/load with the following error:
TypeError: Cannot assign to read only property 'addEventListener' of object '#<RTCPeerConnection>'
The error occurs during module initialization when importing the library:
import { Room } from 'livekit-client'; // Fails here
Reproduction
Reproduction
- Embed the livekit-client library in an environment where RTCPeerConnection APIs are frozen/read-only (e.g., Wix website)
- Attempt to import the library:
import { Room } from 'livekit-client';
- The import fails immediately with the TypeError
Note: This occurs in environments like Wix where WebRTC APIs are frozen for security reasons. The error happens during module initialization, before any API calls are made.
Logs
TypeError: Cannot assign to read only property 'addEventListener' of object '#<RTCPeerConnection>'
at [livekit-client module initialization code]
at async import('livekit-client')
The error occurs synchronously during the module import, preventing the library from loading at all.
System Info
- **OS**: Any (issue is environment-specific, not OS-specific)
- **Browser**: Any modern browser (Chrome, Firefox, Safari, Edge)
- **Environment**: Wix embedded widget environment (RTCPeerConnection APIs are frozen)
- **livekit-client version**: 2.17.0
**Note**: This issue is not browser-specific but environment-specific. It occurs in any environment where `RTCPeerConnection.prototype.addEventListener` is read-only or non-configurable.
Severity
blocking all usage of LiveKit
Additional Information
This issue prevents the library from being used in:
- Wix websites (embedded widgets)
- Security-restricted environments where WebRTC APIs are frozen
- Some enterprise browser configurations
The library attempts to modify RTCPeerConnection.prototype.addEventListener during module initialization, which fails when the property is read-only or non-configurable. The library should handle this gracefully by checking property descriptors before modification or using an alternative approach that doesn't require modifying the prototype.
Describe the bug
What I'm expecting
The library should import successfully and handle environments where
RTCPeerConnection.prototype.addEventListeneris read-only or non-configurable. The library should check if properties are writable before attempting to modify them, or use an alternative approach.What happens instead
The library fails to import/load with the following error:
The error occurs during module initialization when importing the library:
Reproduction
Reproduction
Note: This occurs in environments like Wix where WebRTC APIs are frozen for security reasons. The error happens during module initialization, before any API calls are made.
Logs
System Info
Severity
blocking all usage of LiveKit
Additional Information
This issue prevents the library from being used in:
The library attempts to modify
RTCPeerConnection.prototype.addEventListenerduring module initialization, which fails when the property is read-only or non-configurable. The library should handle this gracefully by checking property descriptors before modification or using an alternative approach that doesn't require modifying the prototype.