Line data Source code
1 : import 'package:matrix/matrix.dart';
2 :
3 : /// UNSTABLE API WARNING
4 : /// The class herirachy is currently experimental and could have breaking changes
5 : /// often.
6 : sealed class MatrixRTCCallEvent {}
7 :
8 : /// Event type for participants change
9 : sealed class ParticipantsChangeEvent implements MatrixRTCCallEvent {}
10 :
11 : final class ParticipantsJoinEvent implements ParticipantsChangeEvent {
12 : /// The participants who joined the call
13 : final List<CallParticipant> participants;
14 :
15 6 : ParticipantsJoinEvent({required this.participants});
16 : }
17 :
18 : final class ParticipantsLeftEvent implements ParticipantsChangeEvent {
19 : /// The participants who left the call
20 : final List<CallParticipant> participants;
21 :
22 2 : ParticipantsLeftEvent({required this.participants});
23 : }
24 :
25 : sealed class CallReactionEvent implements MatrixRTCCallEvent {}
26 :
27 : final class CallReactionAddedEvent implements CallReactionEvent {
28 : final CallParticipant participant;
29 : final String reactionKey;
30 : final String membershipEventId;
31 : final String reactionEventId;
32 : final bool isEphemeral;
33 :
34 2 : CallReactionAddedEvent({
35 : required this.participant,
36 : required this.reactionKey,
37 : required this.membershipEventId,
38 : required this.reactionEventId,
39 : required this.isEphemeral,
40 : });
41 : }
42 :
43 : final class CallReactionRemovedEvent implements CallReactionEvent {
44 : final CallParticipant participant;
45 : final String redactedEventId;
46 :
47 2 : CallReactionRemovedEvent({
48 : required this.participant,
49 : required this.redactedEventId,
50 : });
51 : }
52 :
53 : /// Group call active speaker changed event
54 : final class GroupCallActiveSpeakerChanged implements MatrixRTCCallEvent {
55 : final CallParticipant participant;
56 2 : GroupCallActiveSpeakerChanged(this.participant);
57 : }
58 :
59 : /// Group calls changed event type
60 : sealed class GroupCallChanged implements MatrixRTCCallEvent {}
61 :
62 : /// Group call, call added event
63 : final class CallAddedEvent implements GroupCallChanged {
64 : final CallSession call;
65 4 : CallAddedEvent(this.call);
66 : }
67 :
68 : /// Group call, call removed event
69 : final class CallRemovedEvent implements GroupCallChanged {
70 : final CallSession call;
71 2 : CallRemovedEvent(this.call);
72 : }
73 :
74 : /// Group call, call replaced event
75 : final class CallReplacedEvent extends GroupCallChanged {
76 : final CallSession existingCall, replacementCall;
77 2 : CallReplacedEvent(this.existingCall, this.replacementCall);
78 : }
79 :
80 : enum GroupCallStreamType {
81 : userMedia,
82 : screenshare,
83 : }
84 :
85 : /// Group call stream added event
86 : final class GroupCallStreamAdded implements MatrixRTCCallEvent {
87 : final GroupCallStreamType type;
88 4 : GroupCallStreamAdded(this.type);
89 : }
90 :
91 : /// Group call stream removed event
92 : final class GroupCallStreamRemoved implements MatrixRTCCallEvent {
93 : final GroupCallStreamType type;
94 2 : GroupCallStreamRemoved(this.type);
95 : }
96 :
97 : /// Group call stream replaced event
98 : final class GroupCallStreamReplaced implements MatrixRTCCallEvent {
99 : final GroupCallStreamType type;
100 0 : GroupCallStreamReplaced(this.type);
101 : }
102 :
103 : /// Group call local screenshare state changed event
104 : final class GroupCallLocalScreenshareStateChanged
105 : implements MatrixRTCCallEvent {
106 : final bool screensharing;
107 2 : GroupCallLocalScreenshareStateChanged(this.screensharing);
108 : }
109 :
110 : /// Group call local muted changed event
111 : final class GroupCallLocalMutedChanged implements MatrixRTCCallEvent {
112 : final bool muted;
113 : final MediaInputKind kind;
114 2 : GroupCallLocalMutedChanged(this.muted, this.kind);
115 : }
116 :
117 : enum GroupCallState {
118 : localCallFeedUninitialized,
119 : initializingLocalCallFeed,
120 : localCallFeedInitialized,
121 : entering,
122 : entered,
123 : ended
124 : }
125 :
126 : /// Group call state changed event
127 : final class GroupCallStateChanged implements MatrixRTCCallEvent {
128 : final GroupCallState state;
129 4 : GroupCallStateChanged(this.state);
130 : }
131 :
132 : /// Group call error event
133 : final class GroupCallStateError implements MatrixRTCCallEvent {
134 : final String msg;
135 : final dynamic err;
136 0 : GroupCallStateError(this.msg, this.err);
137 : }
|