-
-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep getting readonly TypeError when trying to set up a RTCPeerConnection #123
Comments
Which iOS version? iOS >= 9 is required (not sure if iOS 8 works)... |
We are using the plugin successfully on 8.1.x. |
Version 9.2 |
Are there any obvious readonly properties that I might be trying to write over? |
@gitlaura Can you provide the code causing the issue + a stacktrace w/ line numbers? |
I'm building an ios app for uProxy with cordova. I don't have the code up yet and it's a but complicated to build but will try to get it up soon. The main problem with using iosrtc plugin is that I can't registerGlobals() until the device is ready, but I have a script that loads that uses RTCPeerConnection, RTCIceCandidate, and RTCSessionDescription before 'deviceready' fires. I have been trying to set window.RTCPeerConnection (and the other two functions) = cordova.plugins.iosrtc.RTCPeerConnection in a separate script before 'deviceready' is fired. I'm pretty sure this is causing the TypeError. Have you seen anyone successfully set these functions before 'deviceready' fires? |
@gitlaura I actually wrote something for this (for the temasys webrtc plugin) - it mocks the RTC objects while they are loading, then replays the actions on the real ones when they are ready. https://github.com/contra/rtc-everywhere/blob/master/lib/temasys/MockRTC.js You can modify that pretty easily to work with this plugin |
@gitlaura may you please confirm if the error you experience happens here?: |
This is how Cordova works, nothing to do here. Your JS app needs to be adapted to the Cordova design. A very hard hack is the following (assuming <script type="text/javascript">
window.addEventListener('load', function()
{
console.log('DOM loaded');
document.addEventListener('deviceready', function()
{
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'libs/somewebrtcsignalinglib.js';
script.async = false; // IMPORTANT
document.getElementsByTagName('head')[0].appendChild(script);
});
});
</script> This |
Okay, thanks for your help. Working on waiting to load the scripts until after 'deviceready'. |
@gitlaura that should work (I mean: it works for me) |
After more debugging, I discovered that I'm getting 'TypeError: Attempted to assign to readonly property' due to line 3343 in cordova-plugin-iosrtc.js:
This appears to be a readonly property that can't be changed after the event is initialized. Has anyone else run into this problem? I can only get my application to work after commenting this line out. |
@gitlaura it seems to be an issue in the yaeti module (which implementes the DOM Will fix it and release a new version of the plugin with an updated version of the |
Thank you! |
I keep getting this error logged to the console when trying to set up a RTCPeerConnection: "Error in Success callbackId: iosrtcPlugin1441625638 : TypeError: Attempted to assign to readonly property"
Do you have any ideas what could be causing this error? Would greatly appreciate help!
The text was updated successfully, but these errors were encountered: