Skip to content

Commit

Permalink
fix dc parse.
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc committed Apr 23, 2024
1 parent 571298f commit bb6416b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/src/rtc_data_channel_impl.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:js_interop';
import 'package:js/js_util.dart' as jsutil;
import 'package:web/web.dart' as web;
import 'package:webrtc_interface/webrtc_interface.dart';

Expand Down Expand Up @@ -71,8 +72,11 @@ class RTCDataChannelWeb extends RTCDataChannel {
dynamic arrayBuffer;
if (data is JSArrayBuffer) {
arrayBuffer = data.toDart;
} else if (data is web.Blob) {
arrayBuffer = await jsutil
.promiseToFuture(jsutil.callMethod(data, 'arrayBuffer', []));
} else {
arrayBuffer = data.toString();
arrayBuffer = data.toDart;
}
return RTCDataChannelMessage.fromBinary(arrayBuffer.asUint8List());
}
Expand Down

0 comments on commit bb6416b

Please sign in to comment.