-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
add success and error callbacks to setLocalDescription and setRemoteDesc... #74
Conversation
I see what you meant before about reusing functions - I suggest adding some sort of webrtc.noop() and webrtc.error() (which calls console.error, at least for now) functions to adapter.js that we can use to simplify this code. |
I just moved the errors two adapter.js -- setRemoteDescriptionFailure and setLocalDescriptionFailure. (style) question about the success callbacks, e.g. Arguably, errors are very unlikely when two peerconnection objects on the same page talk to each outher. |
…instead of anonymous functions
moved the success callbacks to adapter.js as well. |
I don't like the idea of dumping functions called setRDFailure/setLDFailure into the global namespace, as they might collide with other real names in application code. It also isn't clear what these functions do from their names - hence I prefer the simpler and more explicit webrtc.noop and webrtc.error suggested above. |
mh... but dumping a global webrtc object into adapter.js isn't ideal either. |
I hate to make a new file for just these little nibs of code. Are you worried about a webrtc object stomping on apps' webrtc objects? We could just pick a different name. |
Right, it doesn't make sense for these little nibs of code. We could bold and see if anyone complains about this webrtc object :-) |
ping. Apparently FF32 has a regression (https://bugzil.la/1063971) which causes it not to work for at least the data channel example (https://groups.google.com/forum/#!topic/discuss-webrtc/u5NHYR-4rpc) when the mandatory callbacks are missing. |
@@ -197,3 +197,11 @@ if (navigator.mozGetUserMedia) { | |||
} else { | |||
console.log("Browser does not appear to be WebRTC-capable"); | |||
} | |||
|
|||
var webrtc = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment about that this does
@@ -157,12 +157,24 @@ function createPeerConnection() { | |||
}; | |||
localPeerConnection.createOffer(function (desc) { | |||
console.log('localPeerConnection offering'); | |||
localPeerConnection.setLocalDescription(desc); | |||
remotePeerConnection.setRemoteDescription(desc); | |||
localPeerConnection.setLocalDescription(desc, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would prefer to keep these args on the same line, as long line is < 80 chars (here and below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hitting 82 chars in some places... reduce it to a single line where possible and two lines elsewhere or two lines (putting webrtc.noop and webrtc.error on the second) everywhere?
(no preference, anything that makes jshint happy is fine with me :-)
too many merge conflicts... and it looks this has been taken care of already in the meantime. |
as discussed in issue #73.