flutter - flutter_ion 1.0.0:错误:需要一个“SessionDescription”类型的值,但得到一个“IdentityMap”类型的值' 代码中没有这样的映射
问题描述
这个 Flutter 应用程序的目的是在 2 个用户之间打开一个流,我使用ion-sfu作为服务器,在前端使用 flutter-ion:^0.5.4,当我运行 Web 时它运行良好,但是当我将颤振离子从 ^0.5.4 更新到 ^1.0.0它给了我下面的错误。PS:我需要将 Flutter-ion 更新为 ^1.0.0,因为当我使用 flutter-ion:^0.5.4 时,我的应用程序无法在 Windows 桌面上正确运行,有什么帮助吗?
void pubSub() async {
// setState(() {
// plist.clear();
// });
log("serverurl " + ServerURL);
//if (_client == null) {
// create new client
_client =
await ion.Client.create(sid: "test room", uid: _uuid, signal: _signal);
// peer ontrack
_client?.ontrack = (track, ion.RemoteStream remoteStream) async {
if (track.kind == 'video') {
print('ontrack: remote stream: ${remoteStream.stream}');
var renderer = RTCVideoRenderer();
await renderer.initialize();
renderer.srcObject = remoteStream.stream;
setState(() {
plist.add(Participant('RemoteStream', renderer, remoteStream.stream));
});
}
};
_localStream = await ion.LocalStream.getUserMedia(constraints: stts);
//_localStream2 = await ion.LocalStream.getUserMedia(constraints: stts);
// publish the stream
await _client?.publish(_localStream!);
var renderer = RTCVideoRenderer();
await renderer.initialize();
renderer.srcObject = _localStream?.stream;
setState(() {
qlist.add(Participant("LocalStream", renderer, _localStream?.stream));
});
}
Error: Expected a value of type 'SessionDescription', but got one of type 'IdentityMap<String, String?>'
at Object.throw_ [as throw] (http://localhost:54173/dart_sdk.js:5083:11)
at Object.castError (http://localhost:54173/dart_sdk.js:5042:15)
at Object.cast [as as] (http://localhost:54173/dart_sdk.js:5367:17)
at Function.as_C [as as] (http://localhost:54173/dart_sdk.js:4988:19)
at http://localhost:54173/packages/flutter_ion/src/signal/signal_grpc_impl.dart.lib.js:178:56
at http://localhost:54173/packages/flutter_ion/src/signal/signal_grpc_impl.dart.lib.js:182:11
at signal_grpc_impl.GRPCWebSignal.new.join (http://localhost:54173/packages/flutter_ion/src/signal/signal_grpc_impl.dart.lib.js:184:9)
at client$.Client.new.<anonymous> (http://localhost:54173/packages/flutter_ion/src/stream.dart.lib.js:1035:49)
at Generator.next (<anonymous>)
at http://localhost:54173/dart_sdk.js:40108:33
at _RootZone.runUnary (http://localhost:54173/dart_sdk.js:39979:59)
at _FutureListener.thenAwait.handleValue (http://localhost:54173/dart_sdk.js:34926:29)
at handleValueCallback (http://localhost:54173/dart_sdk.js:35493:49)
at Function._propagateToListeners (http://localhost:54173/dart_sdk.js:35531:17)
at _Future.new.[_completeWithValue] (http://localhost:54173/dart_sdk.js:35379:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:54173/dart_sdk.js:35400:35)
at Object._microtaskLoop (http://localhost:54173/dart_sdk.js:40246:13)
at _startMicrotaskLoop (http://localhost:54173/dart_sdk.js:40252:13)
at http://localhost:54173/dart_sdk.js:35751:9
解决方案
推荐阅读
- python - 在 Python 中对子集运行 for 循环
- google-apps-script - DriveApp 错误:“很抱歉,发生服务器错误。请稍候,然后重试。”
- sql-server - 如何返回每个部门名称和每个部门的员工人数
- javascript - 在 JavaScript 中拆分字符串并移动到换行符
- java - 如何将 GregorianCalendar 转换为 Python / Jython 日期时间?
- javascript - 将相同的数组对象分配给多个变量?
- bash - 有没有办法在 bash 命令中显示函数输出
- jestjs - Jest Babel 错误:测试套件无法运行
- swift - 多次更改 UILabel 属性字符串颜色
- javascript - 避免气泡图中的碰撞