Create android & web plugins (#15)
* create android & web plugins * apply `flutter format .`
This commit is contained in:
@@ -19,7 +19,8 @@ enum AudioTrackState {
|
||||
localAndRemote,
|
||||
}
|
||||
|
||||
typedef ConfigureNativeAudioFunc = Future<NativeAudioConfiguration> Function(AudioTrackState state);
|
||||
typedef ConfigureNativeAudioFunc = Future<NativeAudioConfiguration> Function(
|
||||
AudioTrackState state);
|
||||
|
||||
class AudioTrack extends Track {
|
||||
// it's possible to set custom function here to customize audio session configuration
|
||||
@@ -102,11 +103,13 @@ class AudioTrack extends Track {
|
||||
NativeAudioConfiguration? config;
|
||||
if (!kIsWeb && Platform.isIOS) {
|
||||
// Only iOS for now...
|
||||
config = await nativeAudioConfigurationForAudioTrackState.call(audioTrackState);
|
||||
config = await nativeAudioConfigurationForAudioTrackState
|
||||
.call(audioTrackState);
|
||||
}
|
||||
|
||||
if (config != null) {
|
||||
logger.fine('[$runtimeType] configuring for ${audioTrackState} using ${config}...');
|
||||
logger.fine(
|
||||
'[$runtimeType] configuring for ${audioTrackState} using ${config}...');
|
||||
try {
|
||||
await configureNativeAudio(config);
|
||||
} catch (error) {
|
||||
@@ -129,7 +132,8 @@ class AudioTrack extends Track {
|
||||
}
|
||||
}
|
||||
|
||||
Future<NativeAudioConfiguration> defaultNativeAudioConfigurationFunc(AudioTrackState state) async {
|
||||
Future<NativeAudioConfiguration> defaultNativeAudioConfigurationFunc(
|
||||
AudioTrackState state) async {
|
||||
//
|
||||
if (state == AudioTrackState.remoteOnly) {
|
||||
return NativeAudioConfiguration(
|
||||
|
||||
@@ -14,9 +14,11 @@ class LocalAudioTrack extends AudioTrack {
|
||||
) : super(name, track, stream);
|
||||
|
||||
/// Creates a new audio track from the default audio input device.
|
||||
static Future<LocalAudioTrack> create([LocalAudioTrackOptions? options]) async {
|
||||
static Future<LocalAudioTrack> create(
|
||||
[LocalAudioTrackOptions? options]) async {
|
||||
// TODO: have back up incase the options fail
|
||||
final stream = await rtc.navigator.mediaDevices.getUserMedia(<String, dynamic>{
|
||||
final stream =
|
||||
await rtc.navigator.mediaDevices.getUserMedia(<String, dynamic>{
|
||||
// 'audio': <String, dynamic>{
|
||||
// 'echoCancellation': true,
|
||||
// 'noiseSuppression': true,
|
||||
|
||||
@@ -28,7 +28,8 @@ class CameraTrackOptions extends LocalVideoTrackOptions {
|
||||
@override
|
||||
Map<String, dynamic> toMediaConstraintsMap() => <String, dynamic>{
|
||||
...super.toMediaConstraintsMap(),
|
||||
'facingMode': cameraPosition == CameraPosition.front ? 'user' : 'environment',
|
||||
'facingMode':
|
||||
cameraPosition == CameraPosition.front ? 'user' : 'environment',
|
||||
};
|
||||
|
||||
// Returns new options with updated properties
|
||||
@@ -70,7 +71,8 @@ class VideoEncoding {
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() => '${runtimeType}(maxFramerate: ${maxFramerate}, maxBitrate: ${maxBitrate})';
|
||||
String toString() =>
|
||||
'${runtimeType}(maxFramerate: ${maxFramerate}, maxBitrate: ${maxBitrate})';
|
||||
}
|
||||
|
||||
extension VideoEncodingExt on VideoEncoding {
|
||||
|
||||
@@ -33,7 +33,8 @@ abstract class Track extends DisposableChangeNotifier {
|
||||
this.mediaStreamTrack,
|
||||
);
|
||||
|
||||
bool get muted => mediaStreamTrack.muted == null ? false : mediaStreamTrack.muted!;
|
||||
bool get muted =>
|
||||
mediaStreamTrack.muted == null ? false : mediaStreamTrack.muted!;
|
||||
|
||||
rtc.RTCRtpMediaType get mediaType {
|
||||
switch (kind) {
|
||||
|
||||
@@ -29,7 +29,8 @@ abstract class TrackPublication extends Disposable {
|
||||
}
|
||||
|
||||
/// True when the track is published with name [Track.screenShareName].
|
||||
bool get isScreenShare => kind == lk_models.TrackType.VIDEO && name == Track.screenShareName;
|
||||
bool get isScreenShare =>
|
||||
kind == lk_models.TrackType.VIDEO && name == Track.screenShareName;
|
||||
|
||||
void updateFromInfo(lk_models.TrackInfo info) {
|
||||
muted = info.muted;
|
||||
@@ -45,5 +46,6 @@ abstract class TrackPublication extends Disposable {
|
||||
int get hashCode => sid.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => other is TrackPublication && sid == other.sid;
|
||||
bool operator ==(Object other) =>
|
||||
other is TrackPublication && sid == other.sid;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user