Skip to content

Commit

Permalink
Merge pull request #50 from jezell/main
Browse files Browse the repository at this point in the history
Update to package web 1.0.0
  • Loading branch information
cloudwebrtc authored Aug 19, 2024
2 parents 15a94af + 2e25499 commit 4c601f0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 27 deletions.
2 changes: 1 addition & 1 deletion lib/src/frame_cryptor_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class KeyProviderImpl implements KeyProvider {

class FrameCryptorFactoryImpl implements FrameCryptorFactory {
FrameCryptorFactoryImpl._internal() {
worker = web.Worker('e2ee.worker.dart.js');
worker = web.Worker('e2ee.worker.dart.js'.toJS);
worker.addEventListener(
'message',
(web.MessageEvent msg) {
Expand Down
33 changes: 8 additions & 25 deletions lib/src/mediadevices_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,12 @@ class MediaDevicesWeb extends MediaDevices {

return MediaStreamWeb(jsStream, 'local');
} else {
final streamCompleter = Completer<web.MediaStream>();

web.window.navigator.getUserMedia(
web.MediaStreamConstraints(
final jsStream = await web.window.navigator.mediaDevices
.getUserMedia(web.MediaStreamConstraints(
audio: mediaConstraints['audio'],
video: mediaConstraints['video'],
),
(web.MediaStream stream) {
streamCompleter.complete(stream);
}.toJS,
(JSAny err) {
streamCompleter.completeError(err);
}.toJS);

final jsStream = await streamCompleter.future;
))
.toDart;
return MediaStreamWeb(jsStream, 'local');
}
} catch (e) {
Expand All @@ -93,19 +84,11 @@ class MediaDevicesWeb extends MediaDevices {
jsutil.callMethod(mediaDevices, 'getDisplayMedia', [arg]));
return MediaStreamWeb(jsStream, 'local');
} else {
final streamCompleter = Completer<web.MediaStream>();

web.window.navigator.getUserMedia(
web.MediaStreamConstraints(
final jsStream = await web.window.navigator.mediaDevices
.getUserMedia(web.MediaStreamConstraints(
video: jsutil.jsify({'mediaSource': 'screen'}),
audio: mediaConstraints['audio'] ?? false),
(web.MediaStream stream) {
streamCompleter.complete(stream);
}.toJS,
(JSAny err) {
streamCompleter.completeError(err);
}.toJS);
final jsStream = await streamCompleter.future;
audio: mediaConstraints['audio'] ?? false))
.toDart;
return MediaStreamWeb(jsStream, 'local');
}
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
meta: ^1.8.0
platform_detect: ^2.0.7
synchronized: ^3.0.0+3
web: ^0.5.1
web: ^1.0.0
webrtc_interface: ^1.2.0

dev_dependencies:
Expand Down

0 comments on commit 4c601f0

Please sign in to comment.