Skip to content

Commit

Permalink
Merge pull request #35 from mrcsh/main
Browse files Browse the repository at this point in the history
fix type cast exception in getConstraints()
  • Loading branch information
cloudwebrtc authored May 13, 2024
2 parents fe84e04 + 84a0172 commit 50cab00
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/src/media_stream_track_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class MediaStreamTrackWeb extends MediaStreamTrack {

@override
Map<String, dynamic> getConstraints() {
return jsTrack.getConstraints() as Map<String, dynamic>;
final c = jsTrack.getConstraints();
final jso = (c as JSObject).dartify();
return (jso as Map).cast<String, dynamic>();
}

@override
Expand All @@ -47,7 +49,8 @@ class MediaStreamTrackWeb extends MediaStreamTrack {
final arg = js.jsify(constraints ?? {});

final _val = await js.promiseToFuture<void>(
js.callMethod(jsTrack, 'applyConstraints', [arg]));
js.callMethod(jsTrack, 'applyConstraints', [arg]),
);
return _val;
}

Expand Down

0 comments on commit 50cab00

Please sign in to comment.