-
Notifications
You must be signed in to change notification settings - Fork 16
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
is RTCLocalSessionDescriptionInit needed? #178
Comments
for more context, please see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createOffer myPeerConnection
.createOffer()
.then((offer) => myPeerConnection.setLocalDescription(offer)) This Dart equivalent of this js won't work because in Dart |
Current implementation and links: extension type RTCSessionDescriptionInit._(JSObject _) implements JSObject {
external factory RTCSessionDescriptionInit({
required RTCSdpType type,
String sdp,
}); extension type RTCLocalSessionDescriptionInit._(JSObject _) implements JSObject {
external factory RTCLocalSessionDescriptionInit({
RTCSdpType type,
String sdp,
}); |
Opened a ticket on the webref repo w3c/webref#1155 |
I'd be SO HAPPY if our efforts here help validate and improve the "source of truth" in this space. Thanks for being a good and proactive web citizen. 🤘 |
Looks like the change needs to be made in the webrtc spec. I opened w3c/webrtc-pc#2940 there. If you could help me articulate need for issue there, I'd appreciate it @kevmoo |
@kevmoo did you see response in webrtc repo and do you have any thoughts. For context, the MDN example async function handleNegotiationNeededEvent() {
try {
const offer = await pc.createOffer(); // <= offer is (not "local") RTCSessionDescriptionInit
pc.setLocalDescription(offer); // In Dart, offer can't be used for setLocalDecription
signalRemotePeer({ description: pc.localDescription });
} catch (err) {
reportError(err);
}
} |
@jarrodcolburn – can you include a link to the response here? I didn't see it |
Found it! - w3c/webrtc-pc#2940 (comment) |
He outlines the specific case for RTCLocalSessionDescriptionInit, then clarifies... about the IDL...
about member-compatibility...
and ultimately, about ingesting those IDL members...
|
@srujzs @sigmundch – thoughts here? |
I think their point is that APIs that expect one dictionary is also compatible with another dictionary that contains the necessary members, essentially defining dictionaries by their shape rather than their name. While true, this restricts how we can represent these types in Dart. The closest feature to that description is records, but there's still a limitation because records with more parameters are not a subtype of records with fewer parameters e.g. Ultimately, since the object does contain the necessary members, you can just cast to the right type here ( |
I agree that...
...fixes my use case. But is this workaround an isolated in the As a dev, I kinda expect to be able to follow the MDN examples and implement them with little modification in Dart. Since the irony is that I'm not a JavaScript pro, or fan for that matter. And I'm trying to get out of JavaScript, and it's nuances, and back to my beloved Dart as soon as possible. But I get where I don't know if my code is failing because of my fondness of writing buggy code, or if I'm getting stuck on some weird JavaScript oddity (like |
Problem:
RTCLocalSessionDescriptionInit
class for "local" seems unneeded. I thinkRTCSessionDescriptionInit
would suffice. Please see the screenshot where inconsistent between local and remote is highlightedRecommendation A. Get rid of `RTCLocalSessionDescriptionInit`
Recommendation B (less good)... If
RTCLocalSessionDescriptionInit
is needed... it (and possible a new "remote" classRTCRemoteSessionDescriptionInit
) should extendRTCSessionDescriptionInit
.The text was updated successfully, but these errors were encountered: