more docs

This commit is contained in:
Hiroshi Horie
2021-12-12 19:09:38 +07:00
parent 8041f45def
commit b91c822fba
5 changed files with 63 additions and 24 deletions
+4 -2
View File
@@ -85,7 +85,8 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
return pub;
}
/// Publish a video track to the room
/// Publish a [LocalVideoTrack] to the [Room].
/// For most cases, using [setCameraEnabled] would be simpler and recommended.
Future<LocalTrackPublication<LocalVideoTrack>> publishVideoTrack(
LocalVideoTrack track, {
VideoPublishOptions? publishOptions,
@@ -174,7 +175,7 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
return pub;
}
/// Unpublish a track that's already published
/// Unpublish a [LocalTrackPublication] that's already published by this [LocalParticipant].
@override
Future<void> unpublishTrack(String trackSid, {bool notify = true}) async {
logger.finer('Unpublish track sid: $trackSid, notify: $notify');
@@ -279,6 +280,7 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
}
/// A convenience method to publish a track for a specific [TrackSource].
/// This is the recommended method to publish tracks.
Future<LocalTrackPublication?> setSourceEnabled(
TrackSource source, bool enabled) async {
logger.fine('setSourceEnabled(source: $source, enabled: $enabled)');
+12 -8
View File
@@ -10,8 +10,10 @@ import '../publication/track_publication.dart';
import '../room.dart';
import '../support/disposable.dart';
import '../track/track.dart';
import '../track/local.dart';
import '../types.dart';
import 'remote_participant.dart';
import 'local_participant.dart';
/// Represents a Participant in the room, notifies changes via delegates as
/// well as ChangeNotifier/providers.
@@ -63,27 +65,29 @@ abstract class Participant<T extends TrackPublication>
return DateTime.now();
}
/// if participant is currently speaking
/// if [Participant] is currently speaking.
bool get isSpeaking => _isSpeaking;
/// true if participant is publishing an audio track and is muted
/// true if [Participant] is publishing an [AudioTrack] and is muted.
bool get isMuted => audioTracks.firstOrNull?.muted ?? true;
/// true if this [Participant] has more than 1 [AudioTrack].
bool get hasAudio => audioTracks.isNotEmpty;
/// true if this [Participant] has more than 1 [VideoTrack].
bool get hasVideo => videoTracks.isNotEmpty;
/// Connection quality of the participant
/// Connection quality between the [Participant] and the Server.
ConnectionQuality get connectionQuality => _connectionQuality;
/// tracks that are subscribed to
/// [Track]s that this [Participant] is subscribed to.
List<T> get subscribedTracks =>
trackPublications.values.where((e) => e.subscribed).toList();
// Must be implemented by child class
// Must be implemented by child class.
List<T> get videoTracks;
// Must be implemented by child class
// Must be implemented by child class.
List<T> get audioTracks;
/// for internal use
@@ -220,11 +224,11 @@ abstract class Participant<T extends TrackPublication>
e.name == Track.screenShareName));
}
// Equality operators
// Object is considered equal when sid is equal
/// (Equality operator) [Participant.hashCode] is same as [sid.hashCode].
@override
int get hashCode => sid.hashCode;
/// (Equality operator) [Participant] is considered equal when [sid]'s are equal.
@override
bool operator ==(Object other) => other is Participant && sid == other.sid;
}