Line data Source code
1 : // ignore_for_file: constant_identifier_names
2 :
3 : enum EncryptionKeyTypes { remote, local }
4 :
5 : // Call state
6 : enum CallState {
7 : /// The call is inilalized but not yet started
8 : kFledgling,
9 :
10 : /// The first time an invite is sent, the local has createdOffer
11 : kInviteSent,
12 :
13 : /// getUserMedia or getDisplayMedia has been called,
14 : /// but MediaStream has not yet been returned
15 : kWaitLocalMedia,
16 :
17 : /// The local has createdOffer
18 : kCreateOffer,
19 :
20 : /// Received a remote offer message and created a local Answer
21 : kCreateAnswer,
22 :
23 : /// Answer sdp is set, but ice is not connected
24 : kConnecting,
25 :
26 : /// WebRTC media stream is connected
27 : kConnected,
28 :
29 : /// The call was received, but no processing has been done yet.
30 : kRinging,
31 :
32 : /// Ending a call
33 : kEnding,
34 :
35 : /// End of call
36 : kEnded,
37 : }
38 :
39 : enum CallErrorCode {
40 : /// The user chose to end the call
41 : userHangup('user_hangup'),
42 :
43 : /// An error code when creating peer connection object fails locally.
44 : createPeerConnectionFailed('create_peer_connection_failed'),
45 :
46 : /// An error code when the local client failed to create an offer.
47 : localOfferFailed('local_offer_failed'),
48 :
49 : /// An error code when there is no local mic/camera to use. This may be because
50 : /// the hardware isn't plugged in, or the user has explicitly denied access.
51 : userMediaFailed('user_media_failed'),
52 :
53 : /// Error code used when a call event failed to send
54 : /// because unknown devices were present in the room
55 : unknownDevice('unknown_device'),
56 :
57 : /// An answer could not be created
58 : createAnswer('create_answer'),
59 :
60 : /// The session description from the other side could not be set
61 :
62 : setRemoteDescription('set_remote_description'),
63 :
64 : /// The session description from this side could not be set
65 : setLocalDescription('set_local_description'),
66 :
67 : /// A different device answered the call
68 : answeredElsewhere('answered_elsewhere'),
69 :
70 : /// No media connection could be established to the other party
71 : iceFailed('ice_failed'),
72 :
73 : /// The invite timed out whilst waiting for an answer
74 : inviteTimeout('invite_timeout'),
75 :
76 : /// The call was replaced by another call
77 : replaced('replaced'),
78 :
79 : /// Signalling for the call could not be sent (other than the initial invite)
80 : iceTimeout('ice_timeout'),
81 :
82 : /// The remote party is busy
83 : userBusy('user_busy'),
84 :
85 : /// We transferred the call off to somewhere else
86 : transferred('transferred'),
87 :
88 : /// Some other failure occurred that meant the client was unable to continue
89 : /// the call rather than the user choosing to end it.
90 : unknownError('unknown_error');
91 :
92 : final String reason;
93 :
94 : const CallErrorCode(this.reason);
95 : }
96 :
97 : class CallError extends Error {
98 : final CallErrorCode code;
99 : final String msg;
100 : final dynamic err;
101 0 : CallError(this.code, this.msg, this.err);
102 :
103 0 : @override
104 : String toString() {
105 0 : return '[$code] $msg, err: ${err.toString()}';
106 : }
107 : }
108 :
109 : enum CallStateChange {
110 : /// The call was hangup by the local|remote user.
111 : kHangup,
112 :
113 : /// The call state has changed
114 : kState,
115 :
116 : /// The call got some error.
117 : kError,
118 :
119 : /// Call transfer
120 : kReplaced,
121 :
122 : /// The value of isLocalOnHold() has changed
123 : kLocalHoldUnhold,
124 :
125 : /// The value of isRemoteOnHold() has changed
126 : kRemoteHoldUnhold,
127 :
128 : /// Feeds have changed
129 : kFeedsChanged,
130 :
131 : /// For sip calls. support in the future.
132 : kAssertedIdentityChanged,
133 : }
134 :
135 : enum CallType { kVoice, kVideo }
136 :
137 : enum CallDirection { kIncoming, kOutgoing }
138 :
139 : enum CallParty { kLocal, kRemote }
140 :
141 : enum MediaInputKind { videoinput, audioinput }
142 :
143 : enum MediaKind { video, audio }
144 :
145 : enum GroupCallErrorCode {
146 : /// An error code when there is no local mic/camera to use. This may be because
147 : /// the hardware isn't plugged in, or the user has explicitly denied access.
148 : userMediaFailed('user_media_failed'),
149 :
150 : /// Some other failure occurred that meant the client was unable to continue
151 : /// the call rather than the user choosing to end it.
152 : unknownError('unknownError');
153 :
154 : final String reason;
155 :
156 : const GroupCallErrorCode(this.reason);
157 : }
158 :
159 : class GroupCallError extends Error {
160 : final GroupCallErrorCode code;
161 : final String msg;
162 : final dynamic err;
163 0 : GroupCallError(this.code, this.msg, this.err);
164 :
165 0 : @override
166 : String toString() {
167 0 : return 'Group Call Error: [$code] $msg, err: ${err.toString()}';
168 : }
169 : }
170 :
171 : enum GroupCallStateChange {
172 : groupCallStateChanged,
173 : activeSpeakerChanged,
174 : callsChanged,
175 : userMediaStreamsChanged,
176 : screenshareStreamsChanged,
177 : localScreenshareStateChanged,
178 : localMuteStateChanged,
179 : participantsChanged,
180 : error
181 : }
182 :
183 : enum GroupCallState {
184 : localCallFeedUninitialized,
185 : initializingLocalCallFeed,
186 : localCallFeedInitialized,
187 : entering,
188 : entered,
189 : ended
190 : }
|