fix: add name to AudioPublishOptions. (#302)

* fix: add name to AudioPublishOptions.

* remove name for Track.

* remove name for Track.

* update.

* fix flutter analyzer.

* update.

* add Deprecated declaration for Track.name.

* update.
This commit is contained in:
CloudWebRTC
2023-06-14 15:31:21 +08:00
committed by GitHub
parent 4a6694cc3b
commit 193f89806f
13 changed files with 44 additions and 51 deletions
+5 -2
View File
@@ -57,7 +57,7 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
final trackInfo = await room.engine.addTrack(
cid: track.getCid(),
name: track.name,
name: publishOptions.name ?? AudioPublishOptions.defaultMicrophoneName,
kind: track.kind,
source: track.source.toPBType(),
dtx: publishOptions.dtx,
@@ -159,7 +159,10 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
final trackInfo = await room.engine.addTrack(
cid: track.getCid(),
name: track.name,
name: publishOptions.name ??
(track.source == TrackSource.screenShareVideo
? VideoPublishOptions.defaultScreenShareName
: VideoPublishOptions.defaultCameraName),
kind: track.kind,
source: track.source.toPBType(),
dimensions: dimensions,
+3 -7
View File
@@ -10,7 +10,6 @@ import '../managers/event.dart';
import '../proto/livekit_models.pb.dart' as lk_models;
import '../publication/track_publication.dart';
import '../support/disposable.dart';
import '../track/track.dart';
import '../types/other.dart';
import '../types/participant_permissions.dart';
@@ -248,14 +247,11 @@ abstract class Participant<T extends TrackPublication>
(source == TrackSource.microphone &&
e.kind == lk_models.TrackType.AUDIO) ||
(source == TrackSource.camera &&
e.kind == lk_models.TrackType.VIDEO &&
e.name != Track.screenShareName) ||
e.kind == lk_models.TrackType.VIDEO) ||
(source == TrackSource.screenShareVideo &&
e.kind == lk_models.TrackType.VIDEO &&
e.name == Track.screenShareName) ||
e.kind == lk_models.TrackType.VIDEO) ||
(source == TrackSource.screenShareAudio &&
e.kind == lk_models.TrackType.AUDIO &&
e.name == Track.screenShareName));
e.kind == lk_models.TrackType.AUDIO));
}
/// (Equality operator) [Participant.hashCode] is same as [sid.hashCode].
+4 -4
View File
@@ -116,12 +116,12 @@ class RemoteParticipant extends Participant<RemoteTrackPublication> {
final RemoteTrack track;
if (pub.kind == lk_models.TrackType.VIDEO) {
// video track
track = RemoteVideoTrack(pub.name, pub.source, stream, mediaTrack,
receiver: receiver);
track =
RemoteVideoTrack(pub.source, stream, mediaTrack, receiver: receiver);
} else if (pub.kind == lk_models.TrackType.AUDIO) {
// audio track
track = RemoteAudioTrack(pub.name, pub.source, stream, mediaTrack,
receiver: receiver);
track =
RemoteAudioTrack(pub.source, stream, mediaTrack, receiver: receiver);
var listener = track.createListener();
listener.on<AudioPlaybackStarted>((event) {