diff --git a/lib/src/events.dart b/lib/src/events.dart index 9d3047c..802fb6a 100644 --- a/lib/src/events.dart +++ b/lib/src/events.dart @@ -210,30 +210,36 @@ class TrackUnsubscribedEvent with RoomEvent, ParticipantEvent { /// Emitted by [RemoteParticipant] and [LocalParticipant]. class TrackMutedEvent with RoomEvent, ParticipantEvent { final Participant participant; - final TrackPublication track; + final TrackPublication publication; const TrackMutedEvent({ required this.participant, - required this.track, + required this.publication, }); @override String toString() => '${runtimeType}' - '(participant: ${participant}, publication: ${track})'; + '(participant: ${participant}, publication: ${publication})'; + + @Deprecated('Use publication instead') + TrackPublication get track => publication; } /// This participant has unmuted one of their tracks /// Emitted by [RemoteParticipant] and [LocalParticipant]. class TrackUnmutedEvent with RoomEvent, ParticipantEvent { final Participant participant; - final TrackPublication track; + final TrackPublication publication; const TrackUnmutedEvent({ required this.participant, - required this.track, + required this.publication, }); @override String toString() => '${runtimeType}' - '(participant: ${participant}, publication: ${track})'; + '(participant: ${participant}, publication: ${publication})'; + + @Deprecated('Use publication instead') + TrackPublication get track => publication; } /// The [StreamState] on the [RemoteTrackPublication] has updated by the server. @@ -241,18 +247,21 @@ class TrackUnmutedEvent with RoomEvent, ParticipantEvent { /// Emitted by [Room] and [RemoteParticipant]. class TrackStreamStateUpdatedEvent with RoomEvent, ParticipantEvent { final RemoteParticipant participant; - final RemoteTrackPublication trackPublication; + final RemoteTrackPublication publication; final StreamState streamState; const TrackStreamStateUpdatedEvent({ required this.participant, - required this.trackPublication, + required this.publication, required this.streamState, }); @override String toString() => '${runtimeType}' - '(participant: ${participant}, publication: ${trackPublication}, ' + '(participant: ${participant}, publication: ${publication}, ' 'streamState: ${streamState})'; + + @Deprecated('Use publication instead') + RemoteTrackPublication get trackPublication => publication; } /// Participant metadata is a simple way for app-specific state to be pushed to @@ -324,16 +333,16 @@ class SpeakingChangedEvent with ParticipantEvent { /// be emitted. class TrackSubscriptionPermissionChangedEvent with RoomEvent, ParticipantEvent { final Participant participant; - final RemoteTrackPublication trackPublication; + final RemoteTrackPublication publication; final TrackSubscriptionState state; const TrackSubscriptionPermissionChangedEvent({ required this.participant, - required this.trackPublication, + required this.publication, required this.state, }); @override String toString() => '${runtimeType}' - '(participant: ${participant}, publication: ${trackPublication}, ' + '(participant: ${participant}, publication: ${publication}, ' 'state: ${state})'; } diff --git a/lib/src/publication/remote.dart b/lib/src/publication/remote.dart index a30152f..f690c7f 100644 --- a/lib/src/publication/remote.dart +++ b/lib/src/publication/remote.dart @@ -72,7 +72,7 @@ class RemoteTrackPublication participant.room.events, ].emit(TrackStreamStateUpdatedEvent( participant: participant, - trackPublication: this, + publication: this, streamState: streamState, )); } @@ -296,7 +296,7 @@ class RemoteTrackPublication participant.room.events, ].emit(TrackSubscriptionPermissionChangedEvent( participant: participant, - trackPublication: this, + publication: this, state: subscriptionState, )); diff --git a/lib/src/publication/track_publication.dart b/lib/src/publication/track_publication.dart index b5af077..c8354f4 100644 --- a/lib/src/publication/track_publication.dart +++ b/lib/src/publication/track_publication.dart @@ -111,8 +111,8 @@ abstract class TrackPublication extends Disposable { } // emit events final newEvent = event.muted - ? TrackMutedEvent(participant: participant, track: this) - : TrackUnmutedEvent(participant: participant, track: this); + ? TrackMutedEvent(participant: participant, publication: this) + : TrackUnmutedEvent(participant: participant, publication: this); [participant.events, participant.room.events].emit(newEvent); }