Capture client info (#71)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
import '../logger.dart';
|
||||
import 'native_audio.dart';
|
||||
|
||||
// Method channel methods to call native code.
|
||||
class Native {
|
||||
@internal
|
||||
static const channel = MethodChannel('livekit_client');
|
||||
|
||||
@internal
|
||||
static Future<bool> configureAudio(
|
||||
NativeAudioConfiguration configuration) async {
|
||||
try {
|
||||
final result = await channel.invokeMethod<bool>(
|
||||
'configureNativeAudio',
|
||||
configuration.toMap(),
|
||||
);
|
||||
return result == true;
|
||||
} catch (error) {
|
||||
logger.warning('configureNativeAudio did throw $error');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns OS's version as a string
|
||||
/// Currently only for iOS, macOS
|
||||
@internal
|
||||
static Future<String?> osVersionString() async {
|
||||
try {
|
||||
return await channel.invokeMethod<String>(
|
||||
'osVersionString',
|
||||
<String, dynamic>{},
|
||||
);
|
||||
} catch (error) {
|
||||
logger.warning('appleOSVersionString did throw error: ${error}');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,4 @@
|
||||
// https://developer.apple.com/documentation/avfaudio/avaudiosession/category
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../logger.dart';
|
||||
|
||||
enum AppleAudioCategory {
|
||||
soloAmbient,
|
||||
playback,
|
||||
@@ -109,19 +104,3 @@ class NativeAudioConfiguration {
|
||||
appleAudioMode: appleAudioMode ?? this.appleAudioMode,
|
||||
);
|
||||
}
|
||||
|
||||
const _lkMethodChannel = MethodChannel('livekit_client');
|
||||
|
||||
Future<bool> configureNativeAudio(
|
||||
NativeAudioConfiguration configuration) async {
|
||||
try {
|
||||
final result = await _lkMethodChannel.invokeMethod<bool>(
|
||||
'configureNativeAudio',
|
||||
configuration.toMap(),
|
||||
);
|
||||
return result == true;
|
||||
} catch (_) {
|
||||
logger.warning('configureAudioSession did throw $_');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,5 +8,6 @@ PlatformType lkPlatformImplementation() {
|
||||
if (Platform.isMacOS) return PlatformType.macOS;
|
||||
if (Platform.isLinux) return PlatformType.linux;
|
||||
if (Platform.isIOS) return PlatformType.iOS;
|
||||
return PlatformType.android;
|
||||
if (Platform.isAndroid) return PlatformType.android;
|
||||
throw UnsupportedError('Unknown Platform');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user