Create android & web plugins (#15)

* create android & web plugins

* apply `flutter format .`
This commit is contained in:
Hiroshi Horie
2021-10-02 15:20:41 +09:00
committed by GitHub
parent 1a87bcf860
commit 48e03b84cb
43 changed files with 1200 additions and 356 deletions
+2 -1
View File
@@ -22,7 +22,8 @@ mixin _Disposer {
logger.fine('[${objectId}] dispose()');
_isDisposed = true;
if (_disposeFuncs.isNotEmpty) {
logger.fine('[$objectId] running ${_disposeFuncs.length} dispose funcs...');
logger.fine(
'[$objectId] running ${_disposeFuncs.length} dispose funcs...');
// call dispose funcs in reverse order
for (final _func in _disposeFuncs.reversed) {
await _func();
+8 -4
View File
@@ -87,11 +87,13 @@ class NativeAudioConfiguration {
});
Map<String, dynamic> toMap() => <String, dynamic>{
if (appleAudioCategory != null) 'appleAudioCategory': appleAudioCategory!.toStringValue(),
if (appleAudioCategory != null)
'appleAudioCategory': appleAudioCategory!.toStringValue(),
if (appleAudioCategoryOptions != null)
'appleAudioCategoryOptions':
appleAudioCategoryOptions!.map((e) => e.toStringValue()).toList(),
if (appleAudioMode != null) 'appleAudioMode': appleAudioMode!.toStringValue(),
if (appleAudioMode != null)
'appleAudioMode': appleAudioMode!.toStringValue(),
};
NativeAudioConfiguration copyWith({
@@ -101,14 +103,16 @@ class NativeAudioConfiguration {
}) =>
NativeAudioConfiguration(
appleAudioCategory: appleAudioCategory ?? this.appleAudioCategory,
appleAudioCategoryOptions: appleAudioCategoryOptions ?? this.appleAudioCategoryOptions,
appleAudioCategoryOptions:
appleAudioCategoryOptions ?? this.appleAudioCategoryOptions,
appleAudioMode: appleAudioMode ?? this.appleAudioMode,
);
}
const _lkMethodChannel = MethodChannel('livekit_client');
Future<bool> configureNativeAudio(NativeAudioConfiguration configuration) async {
Future<bool> configureNativeAudio(
NativeAudioConfiguration configuration) async {
try {
final result = await _lkMethodChannel.invokeMethod<bool>(
'configureNativeAudio',
+2 -1
View File
@@ -37,7 +37,8 @@ class LiveKitWebSocketIO implements LiveKitWebSocket {
void send(List<int> data) {
// 0 CONNECTING, 1 OPEN, 2 CLOSING, 3 CLOSED
if (_ws.readyState != 1) {
logger.fine('[$objectId] Tried to send data (readyState: ${_ws.readyState})');
logger.fine(
'[$objectId] Tried to send data (readyState: ${_ws.readyState})');
return;
}
+4 -2
View File
@@ -47,8 +47,10 @@ class LiveKitWebSocketWeb implements LiveKitWebSocket {
]) async {
final completer = Completer<LiveKitWebSocketWeb>();
final ws = html.WebSocket(uri.toString());
ws.onOpen.listen((_) => completer.complete(LiveKitWebSocketWeb._(ws, options)));
ws.onError.listen((_) => completer.completeError(WebSocketException.connect()));
ws.onOpen
.listen((_) => completer.complete(LiveKitWebSocketWeb._(ws, options)));
ws.onError
.listen((_) => completer.completeError(WebSocketException.connect()));
return completer.future;
}
}