Documentation

This commit is contained in:
David Zhao
2021-08-30 15:31:12 -07:00
parent 583e08c5b1
commit d011bc7d3d
19 changed files with 383 additions and 16 deletions
+5
View File
@@ -4,12 +4,15 @@ import '../errors.dart';
import 'options.dart';
import 'video_track.dart';
/// A video track from the local device. Use static methods in this class to create
/// video tracks.
class LocalVideoTrack extends VideoTrack {
RTCRtpSender? get sender => transceiver?.sender;
LocalVideoTrack(String name, MediaStreamTrack mediaTrack, MediaStream stream)
: super(name, mediaTrack, stream);
/// Creates a LocalVideoTrack from camera input.
static Future<LocalVideoTrack> createCameraTrack(
[LocalVideoTrackOptions? options]) async {
if (options == null) {
@@ -24,6 +27,8 @@ class LocalVideoTrack extends VideoTrack {
}
}
/// Restarts the track with new options. This is useful when switching between
/// front and back cameras.
Future<void> restartTrack([LocalVideoTrackOptions? options]) async {
if (sender == null) {
return Future.error(TrackCreateError('could not restart track'));