more docs
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc;
|
||||
import '../track/local/video.dart';
|
||||
import '../track/local/audio.dart';
|
||||
|
||||
enum LocalVideoTrackType {
|
||||
camera,
|
||||
display,
|
||||
}
|
||||
|
||||
/// A type that represents front or back of the camera.
|
||||
enum CameraPosition {
|
||||
front,
|
||||
back,
|
||||
}
|
||||
|
||||
/// Convenience extension for [CameraPosition].
|
||||
extension CameraPositionExt on CameraPosition {
|
||||
/// Return a [CameraPosition] which front and back is switched.
|
||||
CameraPosition swap() => {
|
||||
CameraPosition switched() => {
|
||||
CameraPosition.front: CameraPosition.back,
|
||||
CameraPosition.back: CameraPosition.front,
|
||||
}[this]!;
|
||||
}
|
||||
|
||||
/// Options used when creating a [LocalVideoTrack] that captures the camera.
|
||||
class CameraTrackOptions extends LocalVideoTrackOptions {
|
||||
final CameraPosition cameraPosition;
|
||||
|
||||
@@ -44,6 +44,7 @@ class CameraTrackOptions extends LocalVideoTrackOptions {
|
||||
);
|
||||
}
|
||||
|
||||
/// Options used when creating a [LocalVideoTrack] that captures the screen.
|
||||
class ScreenShareTrackOptions extends LocalVideoTrackOptions {
|
||||
const ScreenShareTrackOptions();
|
||||
}
|
||||
@@ -55,7 +56,7 @@ abstract class LocalTrackOptions {
|
||||
Map<String, dynamic> toMediaConstraintsMap();
|
||||
}
|
||||
|
||||
/// Options when creating a LocalVideoTrack.
|
||||
/// Base class for options when creating a [LocalVideoTrack].
|
||||
abstract class LocalVideoTrackOptions extends LocalTrackOptions {
|
||||
// final LocalVideoTrackType type;
|
||||
final VideoParameters params;
|
||||
@@ -69,6 +70,7 @@ abstract class LocalVideoTrackOptions extends LocalTrackOptions {
|
||||
params.toMediaConstraintsMap();
|
||||
}
|
||||
|
||||
/// A type that represents video encoding information.
|
||||
class VideoEncoding {
|
||||
final int maxFramerate;
|
||||
final int maxBitrate;
|
||||
@@ -83,6 +85,7 @@ class VideoEncoding {
|
||||
'${runtimeType}(maxFramerate: ${maxFramerate}, maxBitrate: ${maxBitrate})';
|
||||
}
|
||||
|
||||
/// Convenience extension for [VideoEncoding].
|
||||
extension VideoEncodingExt on VideoEncoding {
|
||||
rtc.RTCRtpEncoding toRTCRtpEncoding({
|
||||
String? rid,
|
||||
@@ -242,12 +245,29 @@ class VideoParameters {
|
||||
};
|
||||
}
|
||||
|
||||
/// Options when creating an LocalAudioTrack. Placeholder for now.
|
||||
/// Options used when creating a [LocalAudioTrack].
|
||||
class LocalAudioTrackOptions extends LocalTrackOptions {
|
||||
/// Attempt to use noiseSuppression option (if supported by the platform)
|
||||
/// See https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings/noiseSuppression
|
||||
/// Defaults to true.
|
||||
final bool noiseSuppression;
|
||||
|
||||
/// Attempt to use echoCancellation option (if supported by the platform)
|
||||
/// See https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings/echoCancellation
|
||||
/// Defaults to true.
|
||||
final bool echoCancellation;
|
||||
|
||||
/// Attempt to use autoGainControl option (if supported by the platform)
|
||||
/// See https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/autoGainControl
|
||||
/// Defaults to true.
|
||||
final bool autoGainControl;
|
||||
|
||||
/// Attempt to use highPassFilter options (if supported by the platform)
|
||||
/// Defaults to false.
|
||||
final bool highPassFilter;
|
||||
|
||||
/// Attempt to use typingNoiseDetection option (if supported by the platform)
|
||||
/// Defaults to true.
|
||||
final bool typingNoiseDetection;
|
||||
|
||||
const LocalAudioTrackOptions({
|
||||
|
||||
Reference in New Issue
Block a user