File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 11import 'dart:html' as html;
22
33import '../dart_webrtc.dart' ;
4- import 'media_stream_impl.dart' ;
54
65class RTCVideoElement {
76 RTCVideoElement () {
@@ -61,4 +60,6 @@ class RTCVideoElement {
6160 void load () => _html.load ();
6261
6362 void removeAttribute (String name) => _html.removeAttribute (name);
63+
64+ Future <void > setSinkId (String sinkId) => _html.setSinkId (sinkId);
6465}
Original file line number Diff line number Diff line change @@ -37,12 +37,15 @@ void loopBackTest() async {
3737 list.forEach ((e) {
3838 print ('${e .runtimeType }: ${e .label }, type => ${e .kind }' );
3939 });
40-
41- await navigator.mediaDevices.selectAudioOutput (AudioOutputOptions (
42- deviceId: list
43- .where ((element) => element.kind == 'audiooutput' )
44- .last
45- .deviceId));
40+ var sinkId =
41+ list.where ((element) => element.kind == 'audiooutput' ).last.deviceId;
42+ try {
43+ await navigator.mediaDevices
44+ .selectAudioOutput (AudioOutputOptions (deviceId: sinkId));
45+ } catch (e) {
46+ print ('selectAudioOutput error: ${e .toString ()}' );
47+ await localVideo.setSinkId (sinkId);
48+ }
4649
4750 var pc = await createPeerConnection ({});
4851 pc.onAddStream = (MediaStream stream) {};
You can’t perform that action at this time.
0 commit comments