forked from AgoraIO/API-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAgoraExtension.swift
More file actions
273 lines (255 loc) · 9.78 KB
/
AgoraExtension.swift
File metadata and controls
273 lines (255 loc) · 9.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
//
// AgoraCode.swift
// OpenLive
//
// Created by CavanSu on 2019/9/16.
// Copyright © 2019 Agora. All rights reserved.
//
import AgoraRtcKit
extension String {
var localized: String { NSLocalizedString(self, comment: "") }
}
extension AgoraErrorCode {
var description: String {
var text: String
switch self {
case .joinChannelRejected: text = "join channel rejected"
case .leaveChannelRejected: text = "leave channel rejected"
case .invalidAppId: text = "invalid app id"
case .invalidToken: text = "invalid token"
case .invalidChannelId: text = "invalid channel id"
default: text = "\(self.rawValue)"
}
return text
}
}
extension AgoraWarningCode {
var description: String {
var text: String
switch self {
case .invalidView: text = "invalid view"
default: text = "\(self.rawValue)"
}
return text
}
}
extension AgoraNetworkQuality {
func description() -> String {
switch self {
case .excellent: return "excellent"
case .good: return "good"
case .poor: return "poor"
case .bad: return "bad"
case .vBad: return "very bad"
case .down: return "down"
case .unknown: return "unknown"
case .unsupported: return "unsupported"
case .detecting: return "detecting"
default: return "unknown"
}
}
}
extension AgoraAudioProfile {
func description() -> String {
switch self {
case .default: return "Default".localized
case .musicStandard: return "Music Standard".localized
case .musicStandardStereo: return "Music Standard Stereo".localized
case .musicHighQuality: return "Music High Quality".localized
case .musicHighQualityStereo: return "Music High Quality Stereo".localized
case .speechStandard: return "Speech Standard".localized
default:
return "\(self.rawValue)"
}
}
static func allValues() -> [AgoraAudioProfile] {
return [.default, .speechStandard, .musicStandard, .musicStandardStereo, .musicHighQuality, .musicHighQualityStereo]
}
}
extension AgoraClientRole {
func description() -> String {
switch self {
case .broadcaster: return "Broadcaster".localized
case .audience: return "Audience".localized
default:
return "\(self.rawValue)"
}
}
static func allValues() -> [AgoraClientRole] {
return [.broadcaster, .audience]
}
}
extension AgoraVirtualBackgroundSourceType {
func description() -> String {
switch self {
case .color: return "Colored Background".localized
case .img: return "Image Background".localized
case .blur: return "Blur Background".localized
default:
return "\(self.rawValue)"
}
}
static func allValues() -> [AgoraVirtualBackgroundSourceType] {
return [.color, .img, .blur]
}
}
extension AgoraAudioScenario {
func description() -> String {
switch self {
case .default: return "Default".localized
case .chatRoomGaming: return "Chat Room Gaming".localized
case .education: return "Education".localized
case .gameStreaming: return "Game Streaming".localized
case .chatRoomEntertainment: return "Chat Room Entertainment".localized
case .showRoom: return "Show Room".localized
default:
return "\(self.rawValue)"
}
}
static func allValues() -> [AgoraAudioScenario] {
return [.default, .chatRoomGaming, .education, .gameStreaming, .chatRoomEntertainment, .showRoom]
}
}
extension AgoraEncryptionMode {
func description() -> String {
switch self {
case .AES128GCM2: return "AES128GCM2"
case .AES256GCM2: return "AES256GCM2"
default:
return "\(self.rawValue)"
}
}
static func allValues() -> [AgoraEncryptionMode] {
return [.AES128GCM2, .AES256GCM2]
}
}
extension AgoraAudioVoiceChanger {
func description() -> String {
switch self {
case .voiceChangerOff:return "Off".localized
case .generalBeautyVoiceFemaleFresh:return "FemaleFresh".localized
case .generalBeautyVoiceFemaleVitality:return "FemaleVitality".localized
case .generalBeautyVoiceMaleMagnetic:return "MaleMagnetic".localized
case .voiceBeautyVigorous:return "Vigorous".localized
case .voiceBeautyDeep:return "Deep".localized
case .voiceBeautyMellow:return "Mellow".localized
case .voiceBeautyFalsetto:return "Falsetto".localized
case .voiceBeautyFull:return "Full".localized
case .voiceBeautyClear:return "Clear".localized
case .voiceBeautyResounding:return "Resounding".localized
case .voiceBeautyRinging:return "Ringing".localized
case .voiceBeautySpacial:return "Spacial".localized
case .voiceChangerEthereal:return "Ethereal".localized
case .voiceChangerOldMan:return "Old Man".localized
case .voiceChangerBabyBoy:return "Baby Boy".localized
case .voiceChangerBabyGirl:return "Baby Girl".localized
case .voiceChangerZhuBaJie:return "ZhuBaJie".localized
case .voiceChangerHulk:return "Hulk".localized
default:
return "\(self.rawValue)"
}
}
}
extension AgoraVoiceBeautifierPreset{
func description() -> String {
switch self {
case .voiceBeautifierOff:return "Off".localized
case .chatBeautifierFresh:return "FemaleFresh".localized
case .chatBeautifierMagnetic:return "MaleMagnetic".localized
case .chatBeautifierVitality:return "FemaleVitality".localized
case .timbreTransformationVigorous:return "Vigorous".localized
case .timbreTransformationDeep:return "Deep".localized
case .timbreTransformationMellow:return "Mellow".localized
case .timbreTransformationFalsetto:return "Falsetto".localized
case .timbreTransformationFull:return "Full".localized
case .timbreTransformationClear:return "Clear".localized
case .timbreTransformationResounding:return "Resounding".localized
case .timbreTransformationRinging:return "Ringing".localized
default:
return "\(self.rawValue)"
}
}
}
extension AgoraAudioEffectPreset {
func description() -> String {
switch self {
case .audioEffectOff:return "Off".localized
case .voiceChangerEffectUncle:return "FxUncle".localized
case .voiceChangerEffectOldMan:return "Old Man".localized
case .voiceChangerEffectBoy:return "Baby Boy".localized
case .voiceChangerEffectSister:return "FxSister".localized
case .voiceChangerEffectGirl:return "Baby Girl".localized
case .voiceChangerEffectPigKing:return "ZhuBaJie".localized
case .voiceChangerEffectHulk:return "Hulk".localized
case .styleTransformationRnB:return "R&B".localized
case .styleTransformationPopular:return "Pop".localized
case .roomAcousticsKTV:return "KTV".localized
case .roomAcousticsVocalConcert:return "Vocal Concert".localized
case .roomAcousticsStudio:return "Studio".localized
case .roomAcousticsPhonograph:return "Phonograph".localized
case .roomAcousticsVirtualStereo:return "Virtual Stereo".localized
case .roomAcousticsSpacial:return "Spacial".localized
case .roomAcousticsEthereal:return "Ethereal".localized
case .roomAcoustics3DVoice:return "3D Voice".localized
case .pitchCorrection:return "Pitch Correction".localized
default:
return "\(self.rawValue)"
}
}
}
extension AgoraAudioReverbPreset {
func description() -> String {
switch self {
case .off:return "Off".localized
case .fxUncle:return "FxUncle".localized
case .fxSister:return "FxSister".localized
case .fxPopular:return "Pop".localized
case .popular:return "Pop(Old Version)".localized
case .fxRNB:return "R&B".localized
case .rnB:return "R&B(Old Version)".localized
case .rock:return "Rock".localized
case .hipHop:return "HipHop".localized
case .fxVocalConcert:return "Vocal Concert".localized
case .vocalConcert:return "Vocal Concert(Old Version)".localized
case .fxKTV:return "KTV".localized
case .KTV:return "KTV(Old Version)".localized
case .fxStudio:return "Studio".localized
case .studio:return "Studio(Old Version)".localized
case .fxPhonograph:return "Phonograph".localized
case .virtualStereo:return "Virtual Stereo".localized
default:
return "\(self.rawValue)"
}
}
}
extension AgoraAudioEqualizationBandFrequency {
func description() -> String {
switch self {
case .band31: return "31Hz"
case .band62: return "62Hz"
case .band125: return "125Hz"
case .band250: return "250Hz"
case .band500: return "500Hz"
case .band1K: return "1kHz"
case .band2K: return "2kHz"
case .band4K: return "4kHz"
case .band8K: return "8kHz"
case .band16K: return "16kHz"
@unknown default:
return "\(self.rawValue)"
}
}
}
extension AgoraAudioReverbType {
func description() -> String {
switch self {
case .dryLevel: return "Dry Level".localized
case .wetLevel: return "Wet Level".localized
case .roomSize: return "Room Size".localized
case .wetDelay: return "Wet Delay".localized
case .strength: return "Strength".localized
@unknown default:
return "\(self.rawValue)"
}
}
}