DART中的WebRTC连接:HTML,不完整的API?

发布于 2025-01-17 19:05:25 字数 527 浏览 4 评论 0原文

在以下JavaScript片段中,飞镖的等效是什么?

myPeerConnection.createOffer().then(function(offer) {
  return myPeerConnection.setLocalDescription(offer);
})

直接翻译:

final offer = await myPeerConnection.createOffer();
myPeerConnection.setLocalDescription(offer);

不编译,因为createOffer()最终返回rtcSessionDescription和setlocaldescription仅接受MAP

rtcSessionDescription没有一种很好的方法来转换API中的MAP

我错过了什么吗?谢谢!

What would be the equivalent in dart of the following javascript snippet?

myPeerConnection.createOffer().then(function(offer) {
  return myPeerConnection.setLocalDescription(offer);
})

The straight translation:

final offer = await myPeerConnection.createOffer();
myPeerConnection.setLocalDescription(offer);

does not compile because createOffer() eventually returns a RtcSessionDescription and setLocalDescription accepts only a Map.

And RtcSessionDescription does not have a nice way to convert to a Map in the API.

Am I missing anything? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回梦 2025-01-24 19:05:25

尝试了几件事后,这在我的用例中起作用(至少在Chrome中):

final offer = await myPeerConnection.createOffer();
myPeerConnection.setLocalDescription({"sdp": offer.sdp, "type": offer.type ?? 'offer'});

After trying a few things, this works in my use case (at least in Chrome):

final offer = await myPeerConnection.createOffer();
myPeerConnection.setLocalDescription({"sdp": offer.sdp, "type": offer.type ?? 'offer'});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文