LocalTrackPublishedEvent LocalTrackUnpublishedEvent
This commit is contained in:
+28
-4
@@ -1,9 +1,11 @@
|
|||||||
import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc;
|
import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc;
|
||||||
|
|
||||||
|
import 'participant/local_participant.dart';
|
||||||
import 'participant/participant.dart';
|
import 'participant/participant.dart';
|
||||||
import 'participant/remote_participant.dart';
|
import 'participant/remote_participant.dart';
|
||||||
import 'proto/livekit_models.pb.dart' as lk_models;
|
import 'proto/livekit_models.pb.dart' as lk_models;
|
||||||
import 'proto/livekit_rtc.pb.dart' as lk_rtc;
|
import 'proto/livekit_rtc.pb.dart' as lk_rtc;
|
||||||
|
import 'track/local_track_publication.dart';
|
||||||
import 'track/remote_track_publication.dart';
|
import 'track/remote_track_publication.dart';
|
||||||
import 'track/track.dart';
|
import 'track/track.dart';
|
||||||
import 'track/track_publication.dart';
|
import 'track/track_publication.dart';
|
||||||
@@ -72,8 +74,8 @@ class ActiveSpeakersChangedEvent with RoomEvent {
|
|||||||
/// joined. It will not fire for tracks that are already published.
|
/// joined. It will not fire for tracks that are already published.
|
||||||
/// Emitted by [Room] and [RemoteParticipant].
|
/// Emitted by [Room] and [RemoteParticipant].
|
||||||
class TrackPublishedEvent with RoomEvent, ParticipantEvent {
|
class TrackPublishedEvent with RoomEvent, ParticipantEvent {
|
||||||
final Participant participant;
|
final RemoteParticipant participant;
|
||||||
final TrackPublication publication;
|
final RemoteTrackPublication publication;
|
||||||
const TrackPublishedEvent({
|
const TrackPublishedEvent({
|
||||||
required this.participant,
|
required this.participant,
|
||||||
required this.publication,
|
required this.publication,
|
||||||
@@ -83,14 +85,36 @@ class TrackPublishedEvent with RoomEvent, ParticipantEvent {
|
|||||||
/// The participant has unpublished one of their [Track].
|
/// The participant has unpublished one of their [Track].
|
||||||
/// Emitted by [Room] and [RemoteParticipant].
|
/// Emitted by [Room] and [RemoteParticipant].
|
||||||
class TrackUnpublishedEvent with RoomEvent, ParticipantEvent {
|
class TrackUnpublishedEvent with RoomEvent, ParticipantEvent {
|
||||||
final Participant participant;
|
final RemoteParticipant participant;
|
||||||
final TrackPublication publication;
|
final RemoteTrackPublication publication;
|
||||||
const TrackUnpublishedEvent({
|
const TrackUnpublishedEvent({
|
||||||
required this.participant,
|
required this.participant,
|
||||||
required this.publication,
|
required this.publication,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// When the local participant publishes a new [Track] to the room.
|
||||||
|
/// Emitted by [Room] and [LocalParticipant].
|
||||||
|
class LocalTrackPublishedEvent with RoomEvent, ParticipantEvent {
|
||||||
|
final LocalParticipant participant;
|
||||||
|
final LocalTrackPublication publication;
|
||||||
|
const LocalTrackPublishedEvent({
|
||||||
|
required this.participant,
|
||||||
|
required this.publication,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The local participant has unpublished one of their [Track].
|
||||||
|
/// Emitted by [Room] and [LocalParticipant].
|
||||||
|
class LocalTrackUnpublishedEvent with RoomEvent, ParticipantEvent {
|
||||||
|
final LocalParticipant participant;
|
||||||
|
final LocalTrackPublication publication;
|
||||||
|
const LocalTrackUnpublishedEvent({
|
||||||
|
required this.participant,
|
||||||
|
required this.publication,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// [LocalParticipant] has subscribed to a new track published by a
|
/// [LocalParticipant] has subscribed to a new track published by a
|
||||||
/// [RemoteParticipant].
|
/// [RemoteParticipant].
|
||||||
/// Emitted by [Room] and [RemoteParticipant].
|
/// Emitted by [Room] and [RemoteParticipant].
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class LocalParticipant extends Participant {
|
|||||||
final pub = LocalTrackPublication(trackInfo, track, this);
|
final pub = LocalTrackPublication(trackInfo, track, this);
|
||||||
addTrackPublication(pub);
|
addTrackPublication(pub);
|
||||||
|
|
||||||
[events, roomEvents].emit(TrackPublishedEvent(
|
[events, roomEvents].emit(LocalTrackPublishedEvent(
|
||||||
participant: this,
|
participant: this,
|
||||||
publication: pub,
|
publication: pub,
|
||||||
));
|
));
|
||||||
@@ -155,7 +155,7 @@ class LocalParticipant extends Participant {
|
|||||||
final pub = LocalTrackPublication(trackInfo, track, this);
|
final pub = LocalTrackPublication(trackInfo, track, this);
|
||||||
addTrackPublication(pub);
|
addTrackPublication(pub);
|
||||||
|
|
||||||
[events, roomEvents].emit(TrackPublishedEvent(
|
[events, roomEvents].emit(LocalTrackPublishedEvent(
|
||||||
participant: this,
|
participant: this,
|
||||||
publication: pub,
|
publication: pub,
|
||||||
));
|
));
|
||||||
@@ -194,7 +194,7 @@ class LocalParticipant extends Participant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (notify) {
|
if (notify) {
|
||||||
[events, roomEvents].emit(TrackUnpublishedEvent(
|
[events, roomEvents].emit(LocalTrackUnpublishedEvent(
|
||||||
participant: this,
|
participant: this,
|
||||||
publication: pub,
|
publication: pub,
|
||||||
));
|
));
|
||||||
|
|||||||
Reference in New Issue
Block a user