Skip to content

Commit

Permalink
update example.
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc committed Aug 4, 2022
1 parent 23570b3 commit 3f67360
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion lib/src/rtc_video_element.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:html' as html;

import '../dart_webrtc.dart';
import 'media_stream_impl.dart';

class RTCVideoElement {
RTCVideoElement() {
Expand Down Expand Up @@ -61,4 +60,6 @@ class RTCVideoElement {
void load() => _html.load();

void removeAttribute(String name) => _html.removeAttribute(name);

Future<void> setSinkId(String sinkId) => _html.setSinkId(sinkId);
}
15 changes: 9 additions & 6 deletions web/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ void loopBackTest() async {
list.forEach((e) {
print('${e.runtimeType}: ${e.label}, type => ${e.kind}');
});

await navigator.mediaDevices.selectAudioOutput(AudioOutputOptions(
deviceId: list
.where((element) => element.kind == 'audiooutput')
.last
.deviceId));
var sinkId =
list.where((element) => element.kind == 'audiooutput').last.deviceId;
try {
await navigator.mediaDevices
.selectAudioOutput(AudioOutputOptions(deviceId: sinkId));
} catch (e) {
print('selectAudioOutput error: ${e.toString()}');
await localVideo.setSinkId(sinkId);
}

var pc = await createPeerConnection({});
pc.onAddStream = (MediaStream stream) {};
Expand Down

0 comments on commit 3f67360

Please sign in to comment.