Default capture options (#51)
* default capture options * separate camera & screen share capture options
This commit is contained in:
@@ -11,7 +11,7 @@ import '../options.dart';
|
||||
class LocalAudioTrack extends LocalTrack with AudioTrack, AudioManagementMixin {
|
||||
// Options used for this track
|
||||
@override
|
||||
covariant LocalAudioTrackOptions currentOptions;
|
||||
covariant AudioCaptureOptions currentOptions;
|
||||
|
||||
// private constructor
|
||||
LocalAudioTrack._(
|
||||
@@ -30,9 +30,9 @@ class LocalAudioTrack extends LocalTrack with AudioTrack, AudioManagementMixin {
|
||||
|
||||
/// Creates a new audio track from the default audio input device.
|
||||
static Future<LocalAudioTrack> create([
|
||||
LocalAudioTrackOptions? options,
|
||||
AudioCaptureOptions? options,
|
||||
]) async {
|
||||
options ??= const LocalAudioTrackOptions();
|
||||
options ??= const AudioCaptureOptions();
|
||||
final stream = await LocalTrack.createStream(options);
|
||||
|
||||
return LocalAudioTrack._(
|
||||
|
||||
@@ -12,7 +12,7 @@ import '../track.dart';
|
||||
class LocalVideoTrack extends LocalTrack with VideoTrack {
|
||||
// Options used for this track
|
||||
@override
|
||||
covariant LocalVideoTrackOptions currentOptions;
|
||||
covariant VideoCaptureOptions currentOptions;
|
||||
|
||||
// Private constructor
|
||||
LocalVideoTrack._(
|
||||
@@ -31,9 +31,10 @@ class LocalVideoTrack extends LocalTrack with VideoTrack {
|
||||
|
||||
/// Creates a LocalVideoTrack from camera input.
|
||||
static Future<LocalVideoTrack> createCameraTrack([
|
||||
CameraTrackOptions? options,
|
||||
CameraCaptureOptions? options,
|
||||
]) async {
|
||||
options ??= const CameraTrackOptions();
|
||||
options ??= const CameraCaptureOptions();
|
||||
|
||||
final stream = await LocalTrack.createStream(options);
|
||||
return LocalVideoTrack._(
|
||||
Track.cameraName,
|
||||
@@ -49,9 +50,10 @@ class LocalVideoTrack extends LocalTrack with VideoTrack {
|
||||
/// Note: Android requires a foreground service to be started prior to
|
||||
/// creating a screen track. Refer to the example app for an implementation.
|
||||
static Future<LocalVideoTrack> createScreenShareTrack([
|
||||
ScreenShareTrackOptions? options,
|
||||
ScreenShareCaptureOptions? options,
|
||||
]) async {
|
||||
options ??= const ScreenShareTrackOptions();
|
||||
options ??= const ScreenShareCaptureOptions();
|
||||
|
||||
final stream = await LocalTrack.createStream(options);
|
||||
return LocalVideoTrack._(
|
||||
Track.screenShareName,
|
||||
@@ -70,7 +72,7 @@ extension LocalVideoTrackExt on LocalVideoTrack {
|
||||
// Calls restartTrack under the hood
|
||||
Future<void> setCameraPosition(CameraPosition position) async {
|
||||
final options = currentOptions;
|
||||
if (options is! CameraTrackOptions) {
|
||||
if (options is! CameraCaptureOptions) {
|
||||
logger.warning('Not a camera track');
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user