feat: audio output select for web. (#247)

* feat: audio output select for web.

* chore: Add comments for VideoTrackRenderer.

* update.
This commit is contained in:
CloudWebRTC
2023-03-06 10:53:45 +08:00
committed by GitHub
parent e3f78c2b4c
commit 70e6589981
7 changed files with 119 additions and 44 deletions
-3
View File
@@ -1,7 +1,5 @@
import 'dart:io';
import 'package:meta/meta.dart';
import 'platform/io.dart' if (dart.library.html) 'platform/web.dart';
// Returns the current platform which works for both web and devices.
@@ -9,7 +7,6 @@ PlatformType lkPlatform() => lkPlatformImplementation();
bool lkPlatformIs(PlatformType type) => lkPlatform() == type;
@internal
bool lkPlatformIsTest() => Platform.environment.containsKey('FLUTTER_TEST');
enum PlatformType {
+4
View File
@@ -43,4 +43,8 @@ class RemoteAudioTrack extends RemoteTrack
}
return didStop;
}
Future<void> setAudioOutput(String deviceId) async {
audio.setAudioOutput(getCid(), deviceId);
}
}
+4
View File
@@ -7,3 +7,7 @@ void startAudio(String id, rtc.MediaStreamTrack stream) {
void stopAudio(String id) {
// do nothing
}
void setAudioOutput(String id, String deviceId) {
// do nothing
}
+7
View File
@@ -51,3 +51,10 @@ html.DivElement findOrCreateAudioContainer() {
html.document.body?.append(div);
return div as html.DivElement;
}
void setAudioOutput(String id, String deviceId) {
final audioElement = html.document.getElementById(audioPrefix + id);
if (audioElement is html.AudioElement) {
audioElement.setSinkId(deviceId);
}
}