No Description

AgoraRtcEngineKit.h 51KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376
  1. //
  2. // AgoraRtcEngineKit.h
  3. // AgoraRtcEngineKit
  4. //
  5. // Created by Sting Feng on 2015-8-11.
  6. // Copyright (c) 2015 Agora. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #if TARGET_OS_IPHONE
  10. #import <UIKit/UIKit.h>
  11. typedef UIView VIEW_CLASS;
  12. #elif TARGET_OS_MAC
  13. #import <AppKit/AppKit.h>
  14. typedef NSView VIEW_CLASS;
  15. #endif
  16. typedef NS_ENUM(NSInteger, AgoraRtcWarningCode) {
  17. AgoraRtc_Warn_InvalidView = 8,
  18. AgoraRtc_Warn_InitVideo = 16,
  19. AgoraRtc_Warn_Pending = 20,
  20. AgoraRtc_Warn_NoAvailableChannel = 103,
  21. AgoraRtc_Warn_LookupChannelTimeout = 104,
  22. AgoraRtc_Warn_LookupChannelRejected = 105,
  23. AgoraRtc_Warn_OpenChannelTimeout = 106,
  24. AgoraRtc_Warn_OpenChannelRejected = 107,
  25. AgoraRtc_Warn_SwitchLiveVideoTimeout = 111,
  26. // sdk:vos, callmanager, peermanager: 100~1000
  27. AgoraRtc_Warn_SetClientRoleTimeout = 118,
  28. AgoraRtc_Warn_SetClientRoleNotAuthorized = 119,
  29. AgoraRtc_Warn_AudioMixingOpenError = 701,
  30. AgoraRtc_Warn_Adm_RuntimePlayoutWarning = 1014,
  31. AgoraRtc_Warn_Adm_RuntimeRecordingWarning = 1016,
  32. AgoraRtc_Warn_Adm_RecordAudioSilence = 1019,
  33. AgoraRtc_Warn_Adm_PlaybackMalfunction = 1020,
  34. AgoraRtc_Warn_Adm_RecordMalfunction = 1021,
  35. AgoraRtc_Warn_Adm_Interruption = 1025,
  36. AgoraRtc_Warn_Adm_RouteChange = 1026,
  37. AgoraRtc_Warn_Apm_Howling = 1051,
  38. };
  39. typedef NS_ENUM(NSInteger, AgoraRtcErrorCode) {
  40. AgoraRtc_Error_NoError = 0,
  41. AgoraRtc_Error_Failed = 1,
  42. AgoraRtc_Error_InvalidArgument = 2,
  43. AgoraRtc_Error_NotReady = 3,
  44. AgoraRtc_Error_NotSupported = 4,
  45. AgoraRtc_Error_Refused = 5,
  46. AgoraRtc_Error_BufferTooSmall = 6,
  47. AgoraRtc_Error_NotInitialized = 7,
  48. AgoraRtc_Error_NoPermission = 9,
  49. AgoraRtc_Error_TimedOut = 10,
  50. AgoraRtc_Error_Canceled = 11,
  51. AgoraRtc_Error_TooOften = 12,
  52. AgoraRtc_Error_BindSocket = 13,
  53. AgoraRtc_Error_NetDown = 14,
  54. AgoraRtc_Error_NoBufs = 15,
  55. AgoraRtc_Error_JoinChannelRejected = 17,
  56. AgoraRtc_Error_LeaveChannelRejected = 18,
  57. AgoraRtc_Error_AlreadyInUse = 19,
  58. AgoraRtc_Error_InvalidAppId = 101,
  59. AgoraRtc_Error_InvalidChannelName = 102,
  60. AgoraRtc_Error_ChannelKeyExpired = 109,
  61. AgoraRtc_Error_InvalidChannelKey = 110,
  62. AgoraRtc_Error_ConnectionInterrupted = 111, // only used in web sdk
  63. AgoraRtc_Error_ConnectionLost = 112, // only used in web sdk
  64. AgoraRtc_Error_NotInChannel = 113,
  65. AgoraRtc_Error_SizeTooLarge = 114,
  66. AgoraRtc_Error_BitrateLimit = 115,
  67. AgoraRtc_Error_TooManyDataStreams = 116,
  68. AgoraRtc_Error_DecryptionFailed = 120,
  69. AgoraRtc_Error_LoadMediaEngine = 1001,
  70. AgoraRtc_Error_StartCall = 1002,
  71. AgoraRtc_Error_StartCamera = 1003,
  72. AgoraRtc_Error_StartVideoRender = 1004,
  73. AgoraRtc_Error_Adm_GeneralError = 1005,
  74. AgoraRtc_Error_Adm_JavaResource = 1006,
  75. AgoraRtc_Error_Adm_SampleRate = 1007,
  76. AgoraRtc_Error_Adm_InitPlayout = 1008,
  77. AgoraRtc_Error_Adm_StartPlayout = 1009,
  78. AgoraRtc_Error_Adm_StopPlayout = 1010,
  79. AgoraRtc_Error_Adm_InitRecording = 1011,
  80. AgoraRtc_Error_Adm_StartRecording = 1012,
  81. AgoraRtc_Error_Adm_StopRecording = 1013,
  82. AgoraRtc_Error_Adm_RuntimePlayoutError = 1015,
  83. AgoraRtc_Error_Adm_RuntimeRecordingError = 1017,
  84. AgoraRtc_Error_Adm_RecordAudioFailed = 1018,
  85. AgoraRtc_Error_Adm_Play_Abnormal_Frequency = 1020,
  86. AgoraRtc_Error_Adm_Record_Abnormal_Frequency = 1021,
  87. AgoraRtc_Error_Adm_Init_Loopback = 1022,
  88. AgoraRtc_Error_Adm_Start_Loopback = 1023,
  89. // 1025, as warning for interruption of adm on ios
  90. // 1026, as warning for route change of adm on ios
  91. // VDM error code starts from 1500
  92. AgoraRtc_Error_Vdm_Camera_Not_Authorized = 1501,
  93. // VCM error code starts from 1600
  94. AgoraRtc_Error_Vcm_Unknown_Error = 1600,
  95. AgoraRtc_Error_Vcm_Encoder_Init_Error = 1601,
  96. AgoraRtc_Error_Vcm_Encoder_Encode_Error = 1602,
  97. AgoraRtc_Error_Vcm_Encoder_Set_Error = 1603,
  98. };
  99. typedef NS_ENUM(NSInteger, AgoraRtcChannelProfile) {
  100. AgoraRtc_ChannelProfile_Communication = 0,
  101. AgoraRtc_ChannelProfile_LiveBroadcasting = 1,
  102. AgoraRtc_ChannelProfile_Game = 2,
  103. };
  104. typedef NS_ENUM(NSInteger, AgoraRtcClientRole) {
  105. AgoraRtc_ClientRole_Broadcaster = 1,
  106. AgoraRtc_ClientRole_Audience = 2,
  107. };
  108. typedef NS_ENUM(NSInteger, AgoraRtcVideoProfile) {
  109. // res fps kbps
  110. AgoraRtc_VideoProfile_Invalid = -1,
  111. AgoraRtc_VideoProfile_120P = 0, // 160x120 15 65
  112. #if TARGET_OS_IPHONE
  113. AgoraRtc_VideoProfile_120P_3 = 2, // 120x120 15 50
  114. AgoraRtc_VideoProfile_180P = 10, // 320x180 15 140
  115. AgoraRtc_VideoProfile_180P_3 = 12, // 180x180 15 100
  116. AgoraRtc_VideoProfile_180P_4 = 13, // 240x180 15 120
  117. #endif
  118. AgoraRtc_VideoProfile_240P = 20, // 320x240 15 200
  119. #if TARGET_OS_IPHONE
  120. AgoraRtc_VideoProfile_240P_3 = 22, // 240x240 15 140
  121. AgoraRtc_VideoProfile_240P_4 = 23, // 424x240 15 220
  122. #endif
  123. AgoraRtc_VideoProfile_360P = 30, // 640x360 15 400
  124. #if TARGET_OS_IPHONE
  125. AgoraRtc_VideoProfile_360P_3 = 32, // 360x360 15 260
  126. #endif
  127. AgoraRtc_VideoProfile_360P_4 = 33, // 640x360 30 600
  128. AgoraRtc_VideoProfile_360P_6 = 35, // 360x360 30 400
  129. AgoraRtc_VideoProfile_360P_7 = 36, // 480x360 15 320
  130. AgoraRtc_VideoProfile_360P_8 = 37, // 480x360 30 490
  131. AgoraRtc_VideoProfile_360P_9 = 38, // 640x360 15 800
  132. AgoraRtc_VideoProfile_360P_10 = 39, // 640x360 24 800
  133. AgoraRtc_VideoProfile_360P_11 = 100, // 640x360 24 1000
  134. AgoraRtc_VideoProfile_480P = 40, // 640x480 15 500
  135. #if TARGET_OS_IPHONE
  136. AgoraRtc_VideoProfile_480P_3 = 42, // 480x480 15 400
  137. #endif
  138. AgoraRtc_VideoProfile_480P_4 = 43, // 640x480 30 750
  139. AgoraRtc_VideoProfile_480P_6 = 45, // 480x480 30 600
  140. AgoraRtc_VideoProfile_480P_8 = 47, // 848x480 15 610
  141. AgoraRtc_VideoProfile_480P_9 = 48, // 848x480 30 930
  142. AgoraRtc_VideoProfile_480P_10 = 49, // 640x480 10 400
  143. AgoraRtc_VideoProfile_720P = 50, // 1280x720 15 1130
  144. AgoraRtc_VideoProfile_720P_3 = 52, // 1280x720 30 1710
  145. AgoraRtc_VideoProfile_720P_5 = 54, // 960x720 15 910
  146. AgoraRtc_VideoProfile_720P_6 = 55, // 960x720 30 1380
  147. AgoraRtc_VideoProfile_1080P = 60, // 1920x1080 15 2080
  148. AgoraRtc_VideoProfile_1080P_3 = 62, // 1920x1080 30 3150
  149. AgoraRtc_VideoProfile_1080P_5 = 64, // 1920x1080 60 4780
  150. AgoraRtc_VideoProfile_1440P = 66, // 2560x1440 30 4850
  151. AgoraRtc_VideoProfile_1440P_2 = 67, // 2560x1440 60 7350
  152. AgoraRtc_VideoProfile_4K = 70, // 3840x2160 30 8190
  153. AgoraRtc_VideoProfile_4K_3 = 72, // 3840x2160 60 13500
  154. AgoraRtc_VideoProfile_DEFAULT = AgoraRtc_VideoProfile_360P,
  155. };
  156. typedef NS_ENUM(NSUInteger, AgoraRtcQuality) {
  157. AgoraRtc_Quality_Unknown = 0,
  158. AgoraRtc_Quality_Excellent = 1,
  159. AgoraRtc_Quality_Good = 2,
  160. AgoraRtc_Quality_Poor = 3,
  161. AgoraRtc_Quality_Bad = 4,
  162. AgoraRtc_Quality_VBad = 5,
  163. AgoraRtc_Quality_Down = 6,
  164. };
  165. typedef NS_ENUM(NSUInteger, AgoraRtcUserOfflineReason) {
  166. AgoraRtc_UserOffline_Quit = 0,
  167. AgoraRtc_UserOffline_Dropped = 1,
  168. AgoraRtc_UserOffline_BecomeAudience = 2,
  169. };
  170. typedef NS_ENUM(NSInteger, AgoraRtcVideoStreamType) {
  171. AgoraRtc_VideoStream_High = 0,
  172. AgoraRtc_VideoStream_Low = 1,
  173. };
  174. typedef NS_ENUM(NSInteger, AudioOutputRouting)
  175. {
  176. AudioOutputRouting_Default = -1,
  177. AudioOutputRouting_Headset = 0,
  178. AudioOutputRouting_Earpiece = 1,
  179. AudioOutputRouting_HeadsetNoMic = 2,
  180. AudioOutputRouting_Speakerphone = 3,
  181. AudioOutputRouting_Loudspeaker = 4,
  182. AudioOutputRouting_HeadsetBluetooth = 5
  183. };
  184. typedef NS_ENUM(NSUInteger, AgoraRtcLogFilter) {
  185. AgoraRtc_LogFilter_Off = 0,
  186. AgoraRtc_LogFilter_Debug = 0x080f,
  187. AgoraRtc_LogFilter_Info = 0x000f,
  188. AgoraRtc_LogFilter_Warn = 0x000e,
  189. AgoraRtc_LogFilter_Error = 0x000c,
  190. AgoraRtc_LogFilter_Critical = 0x0008,
  191. };
  192. typedef NS_ENUM(NSInteger, AgoraRtmpStreamLifeCycle) {
  193. RtmpStream_LifeCycle_Bind2Channel = 1,
  194. RtmpStream_LifeCycle_Bind2Ownner = 2,
  195. };
  196. typedef NS_ENUM(NSUInteger, AgoraRtcRenderMode) {
  197. /**
  198. Hidden(1): If the video size is different than that of the display window, crops the borders of the video (if the video is bigger) or stretch the video (if the video is smaller) to fit it in the window.
  199. */
  200. AgoraRtc_Render_Hidden = 1,
  201. /**
  202. AgoraRtc_Render_Fit(2): If the video size is different than that of the display window, resizes the video proportionally to fit the window.
  203. */
  204. AgoraRtc_Render_Fit = 2,
  205. /**
  206. AgoraRtc_Render_Adaptive(3):If both callers use the same screen orientation, i.e., both use vertical screens or both use horizontal screens, the AgoraRtc_Render_Hidden mode applies; if they use different screen orientations, i.e., one vertical and one horizontal, the AgoraRtc_Render_Fit mode applies.
  207. */
  208. AgoraRtc_Render_Adaptive = 3,
  209. };
  210. typedef NS_ENUM(NSUInteger, AgoraRtcQualityReportFormat) {
  211. AgoraRtc_QualityReportFormat_Json = 0,
  212. AgoraRtc_QualityReportFormat_Html = 1,
  213. };
  214. typedef NS_ENUM(NSInteger, AgoraRtcRawAudioFrameOpMode) {
  215. AgoraRtc_RawAudioFrame_OpMode_ReadOnly = 0,
  216. AgoraRtc_RawAudioFrame_OpMode_WriteOnly = 1,
  217. AgoraRtc_RawAudioFrame_OpMode_ReadWrite = 2,
  218. };
  219. #if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC))
  220. typedef NS_ENUM(NSInteger, AgoraRtcDeviceType) {
  221. AgoraRtc_DeviceType_Audio_Unknown = -1,
  222. AgoraRtc_DeviceType_Audio_Recording = 0,
  223. AgoraRtc_DeviceType_Audio_Playout = 1,
  224. AgoraRtc_DeviceType_Video_Render = 2,
  225. AgoraRtc_DeviceType_Video_Capture = 3,
  226. };
  227. __attribute__((visibility("default"))) @interface AgoraRtcDeviceInfo : NSObject
  228. @property (assign, nonatomic) int index;
  229. @property (assign, nonatomic) AgoraRtcDeviceType type; // 0: recording, 1: playback, 2: capture
  230. @property (copy, nonatomic) NSString* deviceId; //
  231. @property (copy, nonatomic) NSString* deviceName; //
  232. @end
  233. #endif
  234. __attribute__((visibility("default"))) @interface AgoraRtcVideoCanvas : NSObject
  235. /**
  236. * The video display view. The SDK does not maintain the lifecycle of the view.
  237. The view can be safely released after calling leaveChannel with a returned value.
  238. The SDK keeps a cache of the view value, so 'setupLocalVideo' to set the view value to NULL could be able to clear cache before switching or releasing view.
  239. */
  240. @property (strong, nonatomic) VIEW_CLASS* view;
  241. @property (assign, nonatomic) AgoraRtcRenderMode renderMode; // the render mode of view: hidden, fit and adaptive
  242. @property (assign, nonatomic) NSUInteger uid; // the user id of view
  243. @end
  244. /**
  245. * For AgoraVideoFrame: color format field
  246. */
  247. typedef NS_ENUM(NSUInteger, AgoraVideoFormat) {
  248. AgoraRtc_FrameFormat_texture = 12,
  249. AgoraRtc_FrameFormat_I420 = 1,
  250. AgoraRtc_FrameFormat_RGBA = 4,
  251. AgoraRtc_FrameFormat_IMC2 = 5,
  252. };
  253. __attribute__((visibility("default"))) @interface AgoraVideoFrame : NSObject
  254. @property (assign, nonatomic) NSInteger format; /* 10: android texture (GL_TEXTURE_2D)
  255. 11: android texture (OES, typically from camera)
  256. 12: ios texture (CVPixelBufferRef)
  257. 1: I420
  258. 2: BGRA
  259. 3: NV21
  260. 4: RGBA
  261. 5: IMC2
  262. 6: BGRA (same as 2)
  263. 7: ARGB
  264. 8: NV12
  265. */
  266. @property (assign, nonatomic) long long timeStamp; // time stamp for this frame. in milli-second
  267. @property (assign, nonatomic) int stride; // how many pixels between 2 consecutive rows. Note: in pixel, not byte.
  268. // in case of ios texture, it is not used
  269. @property (assign, nonatomic) int height; // how many rows of pixels, in case of ios texture, it is not used
  270. @property (assign, nonatomic) CVPixelBufferRef textureBuf;
  271. @property (strong, nonatomic) NSData *dataBuf; // raw data buffer. in case of ios texture, it is not used
  272. @property (assign, nonatomic) int cropLeft; // how many pixels to crop on the left boundary
  273. @property (assign, nonatomic) int cropTop; // how many pixels to crop on the top boundary
  274. @property (assign, nonatomic) int cropRight; // how many pixels to crop on the right boundary
  275. @property (assign, nonatomic) int cropBottom; // how many pixels to crop on the bottom boundary
  276. @property (assign, nonatomic) int rotation; // 0, 90, 180, 270. See document for rotation calculation
  277. @end
  278. __attribute__((visibility("default"))) @interface AgoraRtcStats : NSObject
  279. @property (assign, nonatomic) NSUInteger duration;
  280. @property (assign, nonatomic) NSUInteger txBytes;
  281. @property (assign, nonatomic) NSUInteger rxBytes;
  282. @property (assign, nonatomic) NSUInteger txAudioKBitrate;
  283. @property (assign, nonatomic) NSUInteger rxAudioKBitrate;
  284. @property (assign, nonatomic) NSUInteger txVideoKBitrate;
  285. @property (assign, nonatomic) NSUInteger rxVideoKBitrate;
  286. @property (assign, nonatomic) NSUInteger users;
  287. @property (assign, nonatomic) double cpuAppUsage;
  288. @property (assign, nonatomic) double cpuTotalUsage;
  289. @end
  290. __attribute__((visibility("default"))) @interface AgoraRtcLocalVideoStats : NSObject
  291. @property (assign, nonatomic) NSUInteger sentBitrate;
  292. @property (assign, nonatomic) NSUInteger sentFrameRate;
  293. @end
  294. __attribute__((visibility("default"))) @interface AgoraRtcRemoteVideoStats : NSObject
  295. @property (assign, nonatomic) NSUInteger uid;
  296. @property (assign, nonatomic) NSUInteger delay;
  297. @property (assign, nonatomic) NSUInteger width;
  298. @property (assign, nonatomic) NSUInteger height;
  299. @property (assign, nonatomic) NSUInteger receivedBitrate;
  300. @property (assign, nonatomic) NSUInteger receivedFrameRate;
  301. @property (assign, nonatomic) AgoraRtcVideoStreamType rxStreamType;
  302. @end
  303. __attribute__((visibility("default"))) @interface AgoraRtcAudioVolumeInfo : NSObject
  304. @property (assign, nonatomic) NSUInteger uid;
  305. @property (assign, nonatomic) NSUInteger volume;
  306. @end
  307. __attribute__((visibility("default"))) @interface AgoraRtcVideoCompositingRegion : NSObject
  308. @property (assign, nonatomic) NSUInteger uid;
  309. @property (assign, nonatomic) double x;
  310. @property (assign, nonatomic) double y;
  311. @property (assign, nonatomic) double width;
  312. @property (assign, nonatomic) double height;
  313. @property (assign, nonatomic) NSInteger zOrder; //optional, [0, 100] //0 (default): bottom most, 100: top most
  314. @property (assign, nonatomic) double alpha; //optional, [0, 1.0] where 0 denotes throughly transparent, 1.0 opaque
  315. @property (assign, nonatomic) AgoraRtcRenderMode renderMode;
  316. @end
  317. __attribute__((visibility("default"))) @interface AgoraRtcVideoCompositingLayout : NSObject
  318. @property (assign, nonatomic) NSInteger canvasWidth;
  319. @property (assign, nonatomic) NSInteger canvasHeight;
  320. @property (copy, nonatomic) NSString* backgroundColor;//e.g. "#c0c0c0"
  321. @property (retain, nonatomic) NSArray* regions; //array of AgoraRtcVideoCompositingRegion
  322. @property (copy, nonatomic) NSString* appData;//app defined data
  323. @end
  324. __attribute__((visibility("default"))) @interface AgoraPublisherConfiguration : NSObject
  325. @property (assign, nonatomic) BOOL owner;
  326. @property (assign, nonatomic) NSInteger width;
  327. @property (assign, nonatomic) NSInteger height;
  328. @property (assign, nonatomic) NSInteger framerate;
  329. @property (assign, nonatomic) NSInteger bitrate;
  330. @property (assign, nonatomic) NSInteger defaultLayout;
  331. @property (assign, nonatomic) AgoraRtmpStreamLifeCycle lifeCycle;
  332. @property (copy, nonatomic) NSString* publishUrl;
  333. @property (copy, nonatomic) NSString* rawStreamUrl;
  334. @property (copy, nonatomic) NSString* extraInfo;
  335. -(BOOL) validate;
  336. -(NSString *) toJsonString;
  337. @end
  338. __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBuilder : NSObject
  339. - (AgoraPublisherConfigurationBuilder *) setOwner:(BOOL)isOwner;
  340. - (AgoraPublisherConfigurationBuilder *) setWidth:(NSInteger)width height:(NSInteger)height framerate:(NSInteger)framerate bitrate:(NSInteger)bitrate;
  341. - (AgoraPublisherConfigurationBuilder *) setDefaultLayout:(NSInteger)layoutStyle;
  342. - (AgoraPublisherConfigurationBuilder *) setLifeCycle:(AgoraRtmpStreamLifeCycle)lifecycle;
  343. - (AgoraPublisherConfigurationBuilder *) setPublisherUrl:(NSString*)url;
  344. - (AgoraPublisherConfigurationBuilder *) setRawStreamUrl:(NSString*)url;
  345. - (AgoraPublisherConfigurationBuilder *) setExtraInfo:(NSString *)info;
  346. - (AgoraPublisherConfiguration *) build;
  347. @end
  348. @class AgoraRtcEngineKit;
  349. @protocol AgoraRtcEngineDelegate <NSObject>
  350. @optional
  351. /**
  352. * The warning occurred in SDK. The APP could igonre the warning, and the SDK could try to resume automically.
  353. *
  354. * @param engine The engine kit
  355. * @param warningCode The warning code
  356. */
  357. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didOccurWarning:(AgoraRtcWarningCode)warningCode;
  358. /**
  359. * The error occurred in SDK. The SDK couldn't resume to normal state, and the app need to handle it.
  360. *
  361. * @param engine The engine kit
  362. * @param errorCode The error code
  363. */
  364. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didOccurError:(AgoraRtcErrorCode)errorCode;
  365. /**
  366. * The sdk reports the volume of a speaker. The interface is disable by default, and it could be enable by API "enableAudioVolumeIndication"
  367. *
  368. * @param engine The engine kit
  369. * @param speakers AgoraRtcAudioVolumeInfos array
  370. * @param totalVolume The total volume of speakers
  371. */
  372. - (void)rtcEngine:(AgoraRtcEngineKit *)engine reportAudioVolumeIndicationOfSpeakers:(NSArray*)speakers totalVolume:(NSInteger)totalVolume;
  373. /**
  374. * Event of the first local frame starts rendering on the screen.
  375. *
  376. * @param engine The engine kit
  377. * @param size The size of local video stream
  378. * @param elapsed The elapsed time(ms) from the beginning of the session.
  379. */
  380. - (void)rtcEngine:(AgoraRtcEngineKit *)engine firstLocalVideoFrameWithSize:(CGSize)size elapsed:(NSInteger)elapsed;
  381. /**
  382. * Event of the first frame of remote user is decoded successfully.
  383. *
  384. * @param engine The engine kit
  385. * @param uid The remote user id
  386. * @param size The size of video stream
  387. * @param elapsed The elapsed time(ms) from the beginning of the session.
  388. */
  389. - (void)rtcEngine:(AgoraRtcEngineKit *)engine firstRemoteVideoDecodedOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed;
  390. /**
  391. * Event of video size changed for local or remote user
  392. *
  393. * @param engine The engine kit
  394. * @param uid The user id
  395. * @param size The new size of video
  396. * @param rotation The new rotate of video
  397. */
  398. - (void)rtcEngine:(AgoraRtcEngineKit *)engine videoSizeChangedOfUid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation;
  399. /**
  400. * Event of the first frame of remote user is rendering on the screen.
  401. *
  402. * @param engine The engine kit
  403. * @param uid The remote user id
  404. * @param size The size of video stream
  405. * @param elapsed The elapsed time(ms) from the beginning of the session.
  406. */
  407. - (void)rtcEngine:(AgoraRtcEngineKit *)engine firstRemoteVideoFrameOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed;
  408. /**
  409. * Event of remote user joined
  410. *
  411. * @param engine The engine kit
  412. * @param uid The remote user id
  413. * @param elapsed The elapsed time(ms) from the beginning of the session.
  414. */
  415. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didJoinedOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed;
  416. /**
  417. * Event of remote user offlined
  418. *
  419. * @param engine The engine kit
  420. * @param uid The remote user id
  421. * @param reason Reason of user offline, quit, drop or became audience
  422. */
  423. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didOfflineOfUid:(NSUInteger)uid reason:(AgoraRtcUserOfflineReason)reason;
  424. /**
  425. * Event of remote user audio muted or unmuted
  426. *
  427. * @param engine The engine kit
  428. * @param muted Muted or unmuted
  429. * @param uid The remote user id
  430. */
  431. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didAudioMuted:(BOOL)muted byUid:(NSUInteger)uid;
  432. /**
  433. * Event of remote user video muted or unmuted
  434. *
  435. * @param engine The engine kit
  436. * @param muted Muted or unmuted
  437. * @param uid The remote user id
  438. */
  439. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didVideoMuted:(BOOL)muted byUid:(NSUInteger)uid;
  440. /**
  441. * Event of remote user video muted or unmuted
  442. *
  443. * @param engine The engine kit
  444. * @param routing the current audio output routing
  445. */
  446. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didAudioRouteChanged:(AudioOutputRouting)routing;
  447. /**
  448. * Event of remote user video enabled or disabled
  449. *
  450. * @param engine The engine kit
  451. * @param enabled Enabled or disabled
  452. * @param uid The remote user id
  453. */
  454. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didVideoEnabled:(BOOL)enabled byUid:(NSUInteger)uid;
  455. /**
  456. * The statistics of local video stream. Update every two seconds.
  457. *
  458. * @param engine The engine kit
  459. * @param stats The statistics of local video, including sent bitrate, sent framerate
  460. */
  461. - (void)rtcEngine:(AgoraRtcEngineKit *)engine localVideoStats:(AgoraRtcLocalVideoStats*)stats;
  462. /**
  463. * The statistics of remote video stream. Update every two seconds.
  464. *
  465. * @param engine The engine kit
  466. * @param stats The statistics of remote video, including user id, delay, resolution, received bitrate, received framerate, video stream type
  467. */
  468. - (void)rtcEngine:(AgoraRtcEngineKit *)engine remoteVideoStats:(AgoraRtcRemoteVideoStats*)stats;
  469. /**
  470. * Event of load media engine success
  471. *
  472. * @param engine The engine kit
  473. */
  474. - (void)rtcEngineMediaEngineDidLoaded:(AgoraRtcEngineKit *)engine;
  475. /**
  476. * Event of media engine start call success
  477. *
  478. * @param engine The engine kit
  479. */
  480. - (void)rtcEngineMediaEngineDidStartCall:(AgoraRtcEngineKit *)engine;
  481. /**
  482. * Event of meida engine finish audio mixing.
  483. *
  484. * @param engine The engine kit
  485. */
  486. - (void)rtcEngineMediaEngineDidAudioMixingFinish:(AgoraRtcEngineKit *)engine;
  487. /**
  488. * Event of camera opened
  489. *
  490. * @param engine The engine kit
  491. */
  492. - (void)rtcEngineCameraDidReady:(AgoraRtcEngineKit *)engine;
  493. /**
  494. * Event of camera stopped
  495. *
  496. * @param engine The engine kit
  497. */
  498. - (void)rtcEngineVideoDidStop:(AgoraRtcEngineKit *)engine;
  499. /**
  500. * Event of disconnected with server. This event is reported at the moment SDK loses connection with server.
  501. * In the mean time SDK automatically tries to reconnect with the server until APP calls leaveChannel.
  502. *
  503. * @param engine The engine kit
  504. */
  505. - (void)rtcEngineConnectionDidInterrupted:(AgoraRtcEngineKit *)engine;
  506. /**
  507. * Event of loss connection with server. This event is reported after the connection is interrupted and exceed the retry period (10 seconds by default).
  508. * In the mean time SDK automatically tries to reconnect with the server until APP calls leaveChannel.
  509. *
  510. * @param engine The engine kit
  511. */
  512. - (void)rtcEngineConnectionDidLost:(AgoraRtcEngineKit *)engine;
  513. /**
  514. * Event of the user joined the channel.
  515. *
  516. * @param engine The engine kit
  517. * @param channel The channel name
  518. * @param uid The remote user id
  519. * @param elapsed The elapsed time (ms) from session beginning
  520. */
  521. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didJoinChannel:(NSString*)channel withUid:(NSUInteger)uid elapsed:(NSInteger) elapsed;
  522. /**
  523. * Event of the user rejoined the channel
  524. *
  525. * @param engine The engine kit
  526. * @param channel The channel name
  527. * @param uid The user id
  528. * @param elapsed The elapsed time (ms) from session beginning
  529. */
  530. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didRejoinChannel:(NSString*)channel withUid:(NSUInteger)uid elapsed:(NSInteger) elapsed;
  531. /**
  532. * Statistics of rtc engine status. Updated every two seconds.
  533. *
  534. * @param engine The engine kit
  535. * @param stats The statistics of rtc status, including duration, sent bytes and received bytes
  536. */
  537. - (void)rtcEngine:(AgoraRtcEngineKit *)engine reportRtcStats:(AgoraRtcStats*)stats;
  538. /**
  539. * The statistics of the call when leave channel
  540. *
  541. * @param engine The engine kit
  542. * @param stats The statistics of the call, including duration, sent bytes and received bytes
  543. */
  544. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didLeaveChannelWithStats:(AgoraRtcStats*)stats;
  545. /**
  546. * The audio quality of the user. updated every two seconds.
  547. *
  548. * @param engine The engine kit
  549. * @param uid The id of user
  550. * @param quality The audio quality
  551. * @param delay The delay from the remote user
  552. * @param lost The percentage of lost packets
  553. */
  554. - (void)rtcEngine:(AgoraRtcEngineKit *)engine audioQualityOfUid:(NSUInteger)uid quality:(AgoraRtcQuality)quality delay:(NSUInteger)delay lost:(NSUInteger)lost;
  555. /**
  556. * The network quality of local user.
  557. *
  558. * @param engine The engine kit
  559. * @param uid The id of user
  560. * @param txQuality The sending network quality
  561. * @param rxQuality The receiving network quality
  562. */
  563. - (void)rtcEngine:(AgoraRtcEngineKit *)engine networkQuality:(NSUInteger)uid txQuality:(AgoraRtcQuality)txQuality rxQuality:(AgoraRtcQuality)rxQuality;
  564. /**
  565. * The network quality of lastmile test.
  566. *
  567. * @param engine The engine kit
  568. * @param quality The network quality
  569. */
  570. - (void)rtcEngine:(AgoraRtcEngineKit *)engine lastmileQuality:(AgoraRtcQuality)quality;
  571. #if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC))
  572. /**
  573. * the notificaitoin of device added removed
  574. *
  575. * @param engine The engine kit
  576. * @param deviceId the identification of device
  577. * @param deviceType type of device: -1: audio unknown; 0: audio recording ; 1: audio playout ; 2: render; 4: capture
  578. * @param state state of device: 0: added; 1: removed
  579. */
  580. - (void)rtcEngine:(AgoraRtcEngineKit *)engine device:(NSString*) deviceId type:(AgoraRtcDeviceType) deviceType stateChanged:(NSInteger) state;
  581. #endif
  582. /**
  583. * Event of API call executed
  584. *
  585. * @param engine The engine kit
  586. * @param api The API description
  587. * @param error The error code
  588. */
  589. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didApiCallExecute:(NSString*)api error:(NSInteger)error;
  590. /**
  591. * This callback returns the status code after executing the refreshRecordingServiceStatus method successfully.
  592. *
  593. * @param engine The engine kit
  594. * @param status 0:Recording is stopped. 1:Recording is ongoing.
  595. */
  596. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didRefreshRecordingServiceStatus:(NSInteger)status;
  597. /**
  598. * receive custom data from remote user
  599. *
  600. * @param engine The engine kit
  601. * @param uid The remote user id
  602. * @param streamId The stream id
  603. * @param data The user defined data
  604. */
  605. - (void)rtcEngine:(AgoraRtcEngineKit *)engine receiveStreamMessageFromUid:(NSUInteger)uid streamId:(NSInteger)streamId data:(NSData*)data;
  606. /**
  607. * the local user has not received the data stream from the other user within 5 seconds.
  608. *
  609. * @param engine The engine kit
  610. * @param uid The remote user id
  611. * @param streamId The stream id
  612. * @param error The error code
  613. * @param missed The number of lost messages
  614. * @param cached The number of incoming cached messages when the data stream is interrupted
  615. */
  616. - (void)rtcEngine:(AgoraRtcEngineKit *)engine didOccurStreamMessageErrorFromUid:(NSUInteger)uid streamId:(NSInteger)streamId error:(NSInteger)error missed:(NSInteger)missed cached:(NSInteger)cached;
  617. /**
  618. * when channel key is enabled, and specified channel key is invalid or expired, this function will be called.
  619. * APP should generate a new channel key and call renewChannelKey() to refresh the key.
  620. * NOTE: to be compatible with previous version, ERR_CHANNEL_KEY_EXPIRED and ERR_INVALID_CHANNEL_KEY are also reported via onError() callback.
  621. * You should move renew of channel key logic into this callback.
  622. * @param engine The engine kit
  623. */
  624. - (void)rtcEngineRequestChannelKey:(AgoraRtcEngineKit *)engine;
  625. /**
  626. * Event of the first audio frame is sent.
  627. *
  628. * @param engine The engine kit
  629. * @param elapsed The elapsed time(ms) from the beginning of the session.
  630. */
  631. - (void)rtcEngine:(AgoraRtcEngineKit *)engine firstLocalAudioFrame:(NSInteger)elapsed;
  632. /**
  633. * Event of the first audio frame from remote user is received.
  634. *
  635. * @param engine The engine kit
  636. * @param uid The remote user id
  637. * @param elapsed The elapsed time(ms) from the beginning of the session.
  638. */
  639. - (void)rtcEngine:(AgoraRtcEngineKit *)engine firstRemoteAudioFrameOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed;
  640. @end
  641. __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject
  642. /**
  643. * Get the version of Agora SDK.
  644. *
  645. * @return string, sdk version
  646. */
  647. + (NSString *)getSdkVersion;
  648. /**
  649. * Get the version of Media Engine
  650. *
  651. * @return string, engine version
  652. */
  653. + (NSString *)getMediaEngineVersion;
  654. /**
  655. * Get the native handler of sdk Engine
  656. */
  657. - (void*)getNativeHandle;
  658. /**
  659. * Initializes the AgoraRtcEngineKit object.
  660. *
  661. * @param appId The appId is issued to the application developers by Agora.
  662. * @param delegate The AgoraRtcEngineDelegate
  663. *
  664. * @return an object of AgoraRtcEngineKit class
  665. */
  666. + (instancetype)sharedEngineWithAppId:(NSString*)appId
  667. delegate:(id<AgoraRtcEngineDelegate>)delegate;
  668. /**
  669. * deprecated
  670. */
  671. + (instancetype)sharedEngineWithAppId:(NSString*)AppId
  672. error:(void(^)(AgoraRtcErrorCode errorCode))errorBlock __deprecated;
  673. + (void)destroy;
  674. /**
  675. * deprecated blocks
  676. */
  677. - (void)audioVolumeIndicationBlock:(void(^)(NSArray *speakers, NSInteger totalVolume))audioVolumeIndicationBlock __deprecated;
  678. - (void)firstLocalVideoFrameBlock:(void(^)(NSInteger width, NSInteger height, NSInteger elapsed))firstLocalVideoFrameBlock __deprecated;
  679. - (void)firstRemoteVideoDecodedBlock:(void(^)(NSUInteger uid, NSInteger width, NSInteger height, NSInteger elapsed))firstRemoteVideoDecodedBlock __deprecated;
  680. - (void)firstRemoteVideoFrameBlock:(void(^)(NSUInteger uid, NSInteger width, NSInteger height, NSInteger elapsed))firstRemoteVideoFrameBlock __deprecated;
  681. - (void)userJoinedBlock:(void(^)(NSUInteger uid, NSInteger elapsed))userJoinedBlock __deprecated;
  682. - (void)userOfflineBlock:(void(^)(NSUInteger uid))userOfflineBlock __deprecated;
  683. - (void)userMuteAudioBlock:(void(^)(NSUInteger uid, BOOL muted))userMuteAudioBlock __deprecated;
  684. - (void)userMuteVideoBlock:(void(^)(NSUInteger uid, BOOL muted))userMuteVideoBlock __deprecated;
  685. - (void)localVideoStatBlock:(void(^)(NSInteger sentBitrate, NSInteger sentFrameRate))localVideoStatBlock __deprecated;
  686. - (void)remoteVideoStatBlock:(void(^)(NSUInteger uid, NSInteger delay, NSInteger receivedBitrate, NSInteger receivedFrameRate))remoteVideoStatBlock __deprecated;
  687. - (void)cameraReadyBlock:(void(^)())cameraReadyBlock __deprecated;
  688. - (void)connectionLostBlock:(void(^)())connectionLostBlock __deprecated;
  689. - (void)rejoinChannelSuccessBlock:(void(^)(NSString* channel, NSUInteger uid, NSInteger elapsed))rejoinChannelSuccessBlock __deprecated;
  690. - (void)rtcStatsBlock:(void(^)(AgoraRtcStats* stat))rtcStatsBlock __deprecated;
  691. - (void)leaveChannelBlock:(void(^)(AgoraRtcStats* stat))leaveChannelBlock __deprecated;
  692. - (void)audioQualityBlock:(void(^)(NSUInteger uid, AgoraRtcQuality quality, NSUInteger delay, NSUInteger lost))audioQualityBlock __deprecated;
  693. - (void)networkQualityBlock:(void(^)(NSUInteger uid, AgoraRtcQuality txQuality, AgoraRtcQuality rxQuality))networkQualityBlock __deprecated;
  694. - (void)lastmileQualityBlock:(void(^)(AgoraRtcQuality quality))lastmileQualityBlock __deprecated;
  695. - (void)mediaEngineEventBlock:(void(^)(NSInteger code))mediaEngineEventBlock __deprecated;
  696. /**
  697. * Enable / Disable dispatching delegate to main queue. if disable, the app should dispatch UI operating to main queue by himself.
  698. *
  699. * @param enabled YES: dispatch delegate method to main queue. NO: not dispatch delegate methods to main queue
  700. *
  701. * @return 0 when executed successfully. return negative value if failed.
  702. */
  703. - (int) enableMainQueueDispatch: (BOOL) enabled;
  704. /** BEGIN OF COMMON METHODS */
  705. /**
  706. * Create an open UDP socket to the AgoraRtcEngineKit cloud service to join a channel.
  707. Users in the same channel can talk to each other with same vendor key.
  708. Users using different vendor keys cannot call each other.
  709. The method is asynchronous.
  710. *
  711. * @param channelKey Channel key generated by APP using sign certificate.
  712. * @param channelName Joining in the same channel indicates those clients have entered in one room.
  713. * @param info Optional, this argument can be whatever the programmer likes personally.
  714. * @param uid Optional, this argument is the unique ID for each member in one channel.
  715. If not specified, or set to 0, the SDK automatically allocates an ID, and the id could be gotten in onJoinChannelSuccess.
  716. * @param joinSuccessBlock This callback indicates that the user has successfully joined the specified channel. Same as rtcEngine:didJoinChannel:withUid:elapsed:. If nil, the callback rtcEngine:didJoinChannel:withUid:elapsed: will works.
  717. *
  718. * @return 0 when executed successfully, and return negative value when failed.
  719. */
  720. - (int)joinChannelByKey:(NSString *)channelKey
  721. channelName:(NSString *)channelName
  722. info:(NSString *)info
  723. uid:(NSUInteger)uid
  724. joinSuccess:(void(^)(NSString* channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock;
  725. /**
  726. * lets the user leave a channel, i.e., hanging up or exiting a call.
  727. After joining a channel, the user must call the leaveChannel method to end the call before joining another one.
  728. It is synchronous, i.e., it only returns until the call ends and all resources are released.
  729. * @param leaveChannelBlock indicate the statistics of this call, from joinChannel to leaveChannel, including duration, tx bytes and rx bytes in the call.
  730. *
  731. * @return 0 if executed successfully, or return negative value if failed.
  732. */
  733. - (int)leaveChannel:(void(^)(AgoraRtcStats* stat))leaveChannelBlock;
  734. /**
  735. * Enables the network quality test. When enabled, the callback 'networkQualityBlock' notifies the application about the user's network connection quality.
  736. Note: Once the network test is enabled, it uses the network bandwidth even when the application is not in a call.
  737. Recommandation: When the application is foreground, enable the network connection test; and when the application is switched to background, disable network test in order to reduce network traffic.
  738. By default, the network test is disabled
  739. *
  740. * @return 0 when executed successfully, and return negative value when failed.
  741. */
  742. - (int)enableLastmileTest;
  743. /**
  744. * Disables the network quality test.
  745. *
  746. * @return 0 when executed successfully, and return negative value when failed.
  747. */
  748. - (int)disableLastmileTest;
  749. /**
  750. * Enables video mode. Switches from audio to video mode.
  751. It could be called during a call and before entering a channel.
  752. *
  753. * @return 0 when this method is called successfully, or negative value when this method failed.
  754. */
  755. - (int)enableVideo;
  756. /**
  757. * Disable video mode. Switch from video to audio mode.
  758. It could be called during a call and before entering a channel.
  759. *
  760. * @return 0 when this method is called successfully, or negative value when this method failed.
  761. */
  762. - (int)disableVideo;
  763. /**
  764. * Enables local video.
  765. *
  766. * @param enabled YES to enabled local video capture and render (by default), NO to disable using local camera device.
  767. * @return 0 when this method is called successfully, or negative value when this method failed.
  768. */
  769. - (int)enableLocalVideo:(BOOL)enabled;
  770. /**
  771. * start local video preview, while not sending data to server
  772. *
  773. * @return 0 when this method is called successfully, or negative value when this method failed.
  774. */
  775. - (int)startPreview;
  776. /**
  777. * stop local video preview
  778. *
  779. * @return 0 when this method is called successfully, or negative value when this method failed.
  780. */
  781. - (int)stopPreview;
  782. /**
  783. * Enables audio function, which is enabled by default.
  784. *
  785. * @return 0 when this method is called successfully, or negative value when this method failed.
  786. */
  787. - (int)enableAudio;
  788. /**
  789. * Disable audio function.
  790. *
  791. * @return 0 when this method is called successfully, or negative value when this method failed.
  792. */
  793. - (int)disableAudio;
  794. /**
  795. * Specify sdk parameters
  796. *
  797. * @param options sdk options in json format.
  798. */
  799. - (int)setParameters:(NSString *)options;
  800. - (NSString*)getParameter:(NSString*)parameter
  801. args:(NSString*)args;
  802. /**
  803. * The call id of current client. The call id could be used in 'rate' and 'complain' method.
  804. *
  805. * @return The current call id.
  806. */
  807. - (NSString*) getCallId;
  808. /**
  809. * Let user rate the call. Often called after the call ends.
  810. *
  811. * @param callId The call ID retrieved from the 'getCallId' method.
  812. * @param rating The rating for the call between 1 (lowest score) to 10 (highest score).
  813. * @param description Optional, decribed by user for the call with a length less than 800 bytes.
  814. *
  815. * @return 0 when executed successfully. return ERR_INVALID_ARGUMENT (-2):The passed argument is invalid, e.g., callId invalid. return ERR_NOT_READY (-3):The SDK status is incorrect, e.g., initialization failed.
  816. */
  817. - (int) rate:(NSString*) callId
  818. rating:(NSInteger) rating
  819. description:(NSString*) description;
  820. /**
  821. * Let user complain the quality of the call. Often called after the call ends.
  822. *
  823. * @param callId The call ID retrieved from the 'getCallId' method.
  824. * @param description Optional, decribed by user for the call with a length less than 800 bytes.
  825. *
  826. * @return 0 when executed successfully. return ERR_INVALID_ARGUMENT (-2):The passed argument is invalid, e.g., callId invalid. return ERR_NOT_READY (-3):The SDK status is incorrect, e.g., initialization failed.
  827. */
  828. - (int) complain:(NSString*) callId
  829. description:(NSString*) description;
  830. /** END OF COMMON METHODS */
  831. /** BEGIN OF AUDIO METHODS */
  832. /**
  833. * Enable / Disable speaker of device
  834. *
  835. * @param enableSpeaker YES: Switches to speakerphone. NO: Switches to headset.
  836. *
  837. * @return 0 when executed successfully. return negative value if failed.
  838. */
  839. - (int)setEnableSpeakerphone:(BOOL)enableSpeaker;
  840. /**
  841. * test if the speakerphone is enabled or not.
  842. *
  843. * @return YES when speakerphone is enabled. NO when speakerphone is not enabled.
  844. */
  845. - (BOOL)isSpeakerphoneEnabled;
  846. /**
  847. * Set default audio route to Speakerphone
  848. *
  849. * @param defaultToSpeaker YES: default to speakerphone. NO: default to earpiece for voice chat, speaker for video chat.
  850. *
  851. * @return 0 when executed successfully. return negative value if failed.
  852. */
  853. - (int)setDefaultAudioRouteToSpeakerphone:(BOOL)defaultToSpeaker;
  854. /**
  855. * Sets the speakerphone volume. The speaker volume could be adjust by MPMusicPlayerController and other iOS API easily.
  856. *
  857. * @param volume between 0 (lowest volume) to 255 (highest volume).
  858. *
  859. * @return 0 when executed successfully. return negative value if failed.
  860. */
  861. - (int)setSpeakerphoneVolume:(NSUInteger)volume __deprecated;
  862. /**
  863. * Enables to report to the application about the volume of the speakers.
  864. *
  865. * @param interval Specifies the time interval between two consecutive volume indications.
  866. <=0: Disables volume indication.
  867. >0 : The volume indication interval in milliseconds. Recommandation: >=200ms.
  868. * @param smooth The smoothing factor. Recommended: 3.
  869. *
  870. * @return 0 when executed successfully. return negative value if failed.
  871. */
  872. - (int)enableAudioVolumeIndication:(NSInteger)interval
  873. smooth:(NSInteger)smooth;
  874. /**
  875. * Start recording conversation to file specified by the file path.
  876. *
  877. * @param filePath file path to save recorded conversation.
  878. *
  879. * @return 0 when executed successfully. return negative value if failed.
  880. */
  881. - (int)startAudioRecording:(NSString*)filePath;
  882. /**
  883. * Stop conversation recording
  884. *
  885. * @return 0 when executed successfully. return negative value if failed.
  886. */
  887. - (int)stopAudioRecording;
  888. - (int)startAudioMixing:(NSString*) filePath
  889. loopback:(BOOL) loopback
  890. replace:(BOOL) replace
  891. cycle:(NSInteger) cycle;
  892. - (int)stopAudioMixing;
  893. - (int)pauseAudioMixing;
  894. - (int)resumeAudioMixing;
  895. - (int)adjustAudioMixingVolume:(NSInteger) volume;
  896. - (int)getAudioMixingDuration;
  897. - (int)getAudioMixingCurrentPosition;
  898. - (int)setAudioMixingPosition:(NSInteger) pos;
  899. /**
  900. * Start screen capture
  901. *
  902. * @return 0 when executed successfully. return negative value if failed.
  903. */
  904. - (int)startScreenCapture:(NSUInteger)windowId;
  905. /**
  906. * Stop screen capture
  907. *
  908. * @return 0 when executed successfully. return negative value if failed.
  909. */
  910. - (int)stopScreenCapture;
  911. - (int)setScreenCaptureId:(NSUInteger)windowId;
  912. /**
  913. * Launches an echo test to test if the audio devices (e.g., headset and speaker) and the network connection work properly. In the test, the user speaks first, and the recording will be played back in 10 seconds. If the user can hear what he said in 10 seconds, it indicates that the audio devices and network connection work properly.
  914. Notes: Must call stopEchoTest to end the test, or won't start new test or join channel.
  915. *
  916. * @param successBlock The callback indicates that the user has successfully joined the specified channel.
  917. *
  918. * @return 0 when executed successfully. return negative value if failed. e.g. ERR_REFUSED (-5):Failed to launch the echo test, e.g., initialization failed.
  919. */
  920. - (int)startEchoTest:(void(^)(NSString* channel, NSUInteger uid, NSInteger elapsed))successBlock;
  921. /**
  922. * Stop echo test.
  923. *
  924. * @return 0 when executed successfully. return negative value if failed. e.g. ERR_REFUSED(-5):Failed to stop the echo test. It could be that the echo test is not running.
  925. */
  926. - (int)stopEchoTest;
  927. /**
  928. * Mutes / Unmutes local audio.
  929. *
  930. * @param mute true: Mutes the local audio. false: Unmutes the local audio.
  931. *
  932. * @return 0 when executed successfully. return negative value if failed.
  933. */
  934. - (int)muteLocalAudioStream:(BOOL)mute;
  935. /**
  936. * Mutes / Unmutes all remote audio.
  937. *
  938. * @param mute true: Mutes all remote received audio. false: Unmutes all remote received audio.
  939. *
  940. * @return 0 when executed successfully. return negative value if failed.
  941. */
  942. - (int)muteAllRemoteAudioStreams:(BOOL)mute;
  943. - (int)muteRemoteAudioStream:(NSUInteger)uid
  944. mute:(BOOL)mute;
  945. /** END OF AUDIO METHODS */
  946. /** BEGIN OF VIDIO METHODS */
  947. /**
  948. * Set up the local video view. The video canvus is initialized with video display setting. And it could be called before entering a channel.
  949. *
  950. * @param local the canvas is composed of view, renderMode and uid. How to initialize 'local'? please take a look at 'AgoraRtcVideoCanvas'
  951. *
  952. * @return 0 when executed successfully. return negative value if failed.
  953. */
  954. - (int)setupLocalVideo:(AgoraRtcVideoCanvas*)local;
  955. /**
  956. * Set up the remote video view. The video canvus is initialized with video display setting. It could be called after receiving the remote video streams to configure the video settings.
  957. *
  958. * @param remote the canvas is composed of view, renderMode and uid. How to initialize 'remote'? please take a look at 'AgoraRtcVideoCanvas'
  959. *
  960. * @return 0 when executed successfully. return negative value if failed.
  961. */
  962. - (int)setupRemoteVideo:(AgoraRtcVideoCanvas*)remote;
  963. /**
  964. * Configure display setting of local view. And it could be called mutiple times during a call.
  965. *
  966. * @param mode There are Hidden(1), Fit(2) and Adaptive(3) mode. Please take a look at definition of enum AgoraRtcRenderMode
  967. *
  968. * @return 0 when executed successfully. return negative value if failed.
  969. */
  970. - (int)setLocalRenderMode:(AgoraRtcRenderMode) mode;
  971. /**
  972. * Configure display setting of remote view. And it could be called mutiple times during a call.
  973. *
  974. * @param uid The user id of remote view.
  975. * @param mode There are Hidden(1), Fit(2) and Adaptive(3) mode. Please take a look at definition of enum AgoraRtcRenderMode
  976. *
  977. * @return 0 when executed successfully. return negative value if failed.
  978. */
  979. - (int)setRemoteRenderMode: (NSUInteger)uid
  980. mode:(AgoraRtcRenderMode) mode;
  981. /**
  982. * API deprecated. Please refer to open source https://github.com/AgoraLab/AgoraDemo, the function "onSwitchRemoteUsers" in demo agora-easycall-ios-oc
  983. * Switches between video display views of two different users.
  984. *
  985. * @param uid1 The user ID of the user whose video is to be switched.
  986. * @param uid2 The user ID of another user whose video is to be switched.
  987. *
  988. * @return 0 when executed successfully. return negative value if failed.
  989. */
  990. - (int)switchView:(NSUInteger)uid1
  991. andAnother:(NSUInteger)uid2 __deprecated;
  992. /**
  993. * Switches between front and back cameras.
  994. *
  995. * @return 0 when executed successfully. return negative value if failed.
  996. */
  997. - (int)switchCamera;
  998. /**
  999. * set video profile, including resolution, fps, kbps
  1000. *
  1001. * @param profile enumeration definition about the video resolution, fps and max kbps
  1002. *
  1003. * @return 0 when executed successfully. return negative value if failed.
  1004. */
  1005. - (int)setVideoProfile:(AgoraRtcVideoProfile)profile
  1006. swapWidthAndHeight:(BOOL)swapWidthAndHeight;
  1007. /**
  1008. * Enable / disable sending local video streams to the network.
  1009. *
  1010. * @param mute YES: stop sending local video stream to the network, NO: start sending local video stream.
  1011. *
  1012. * @return 0 when executed successfully. return negative value if failed.
  1013. */
  1014. - (int)muteLocalVideoStream:(BOOL)mute;
  1015. /**
  1016. * Enables / disables playing all remote callers’ video streams.
  1017. *
  1018. * @param mute YES: stop playing, NO: start playing.
  1019. *
  1020. * @return 0 when executed successfully. return negative value if failed.
  1021. */
  1022. - (int)muteAllRemoteVideoStreams:(BOOL)mute;
  1023. /**
  1024. * Enable / disable a remote user's video stream
  1025. *
  1026. * @param uid The remote user id
  1027. * @param mute YES: discard the video stream from remote user, NO: start receiving remote video stream.
  1028. *
  1029. * @return 0 when executed successfully. return negative value if failed.
  1030. */
  1031. - (int)muteRemoteVideoStream:(NSUInteger)uid
  1032. mute:(BOOL)mute;
  1033. /** END OF VIDIO METHODS */
  1034. /**
  1035. * Specifies the SDK output log file.
  1036. *
  1037. * @param filePath The full file path of the log file.
  1038. *
  1039. * @return 0 when executed successfully. return negative value if failed.
  1040. */
  1041. - (int)setLogFile:(NSString*)filePath;
  1042. /**
  1043. * Specifiy the log level of output
  1044. *
  1045. * @param filter The log level
  1046. *
  1047. * @return 0 when executed successfully. return negative value if failed.
  1048. */
  1049. - (int)setLogFilter:(NSUInteger)filter;
  1050. /**
  1051. * Renew channel key, refresh the new key into agora engine. APP should call this API when SDK reports error ERR_CHANNEL_KEY_EXPIRED.
  1052. *
  1053. * @param channelKey new channel key
  1054. *
  1055. * @return 0 when executed successfully. return negative value if failed.
  1056. */
  1057. - (int)renewChannelKey:(NSString*)channelKey;
  1058. /**
  1059. * Set the channel profile: such as communication, live broadcasting
  1060. *
  1061. * @param profile the channel profile
  1062. *
  1063. * @return 0 when executed successfully. return negative value if failed.
  1064. */
  1065. - (int)setChannelProfile:(AgoraRtcChannelProfile)profile;
  1066. /**
  1067. * Set the role of user: such as broadcaster, audience
  1068. *
  1069. * @param role the role of client
  1070. * @param permissionKey the permission key of role change
  1071. *
  1072. * @return 0 when executed successfully. return negative value if failed.
  1073. */
  1074. - (int)setClientRole:(AgoraRtcClientRole)role withKey: (NSString *)permissionKey;
  1075. - (int)enableDualStreamMode:(BOOL)enabled;
  1076. /**
  1077. * Specify encryption mode of AES encryption algorithm.
  1078. * @param [in] encryptionMode
  1079. * encryption mode of AES algorithm, could be one of the following:
  1080. * "aes-128-xts", "aes-256-xts".
  1081. * The default value is "aes-128-xts". specify NULL value will use default encryption mode.
  1082. * @return return 0 if success or an error code
  1083. */
  1084. - (int)setEncryptionMode:(NSString*)encryptionMode;
  1085. /**
  1086. * Specifying encryption secret enables built-in AES-128 encryption. Leaving channel will clear the secret specified in last channel
  1087. * @param [in] secret
  1088. * secret to enable encryption
  1089. * @return return 0 if success or an error code
  1090. */
  1091. - (int)setEncryptionSecret:(NSString*)secret;
  1092. - (int) setRemoteVideoStream: (NSUInteger) uid
  1093. type: (AgoraRtcVideoStreamType) streamType;
  1094. - (int) startRecordingService:(NSString*)recordingKey;
  1095. - (int) stopRecordingService:(NSString*)recordingKey;
  1096. - (int) refreshRecordingServiceStatus;
  1097. - (int)createDataStream:(NSInteger*)streamId
  1098. reliable:(BOOL)reliable
  1099. ordered:(BOOL)ordered;
  1100. - (int)sendStreamMessage:(NSInteger)streamId
  1101. data:(NSData*)data;
  1102. - (int)setRecordingAudioFrameParametersWithSampleRate:(NSInteger)sampleRate
  1103. channel:(NSInteger)channel
  1104. mode:(AgoraRtcRawAudioFrameOpMode)mode
  1105. samplesPerCall:(NSInteger)samplesPerCall;
  1106. - (int)setPlaybackAudioFrameParametersWithSampleRate:(NSInteger)sampleRate
  1107. channel:(NSInteger)channel
  1108. mode:(AgoraRtcRawAudioFrameOpMode)mode
  1109. samplesPerCall:(NSInteger)samplesPerCall;
  1110. - (int)setMixedAudioFrameParametersWithSampleRate:(NSInteger)sampleRate
  1111. samplesPerCall:(NSInteger)samplesPerCall;
  1112. /**
  1113. * adjust recording signal volume
  1114. *
  1115. * @param [in] volume range from 0 to 400
  1116. *
  1117. * @return return 0 if success or an error code
  1118. */
  1119. - (int)adjustRecordingSignalVolume:(NSInteger)volume;
  1120. /**
  1121. * adjust playback signal volume
  1122. *
  1123. * @param [in] volume range from 0 to 400
  1124. *
  1125. * @return return 0 if success or an error code
  1126. */
  1127. - (int)adjustPlaybackSignalVolume:(NSInteger)volume;
  1128. - (int)setHighQualityAudioParametersWithFullband:(BOOL)fullband
  1129. stereo:(BOOL)stereo
  1130. fullBitrate:(BOOL)fullBitrate;
  1131. - (int)enableInEarMonitoring:(BOOL)enabled;
  1132. - (int)enableWebSdkInteroperability:(BOOL)enabled;
  1133. - (int)setVideoQualityParameters:(BOOL)preferFrameRateOverImageQuality;
  1134. - (int)configPublisher:(AgoraPublisherConfiguration *)config;
  1135. - (int)setVideoCompositingLayout:(AgoraRtcVideoCompositingLayout*)layout;
  1136. - (int)clearVideoCompositingLayout;
  1137. #if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC))
  1138. - (void) monitorDeviceChange: (BOOL)enabled;
  1139. - (NSArray*) enumerateDevices:(AgoraRtcDeviceType)type; // return array of AgoraRtcDeviceInfo
  1140. - (NSString*) getDeviceId:(AgoraRtcDeviceType)type;
  1141. - (int) setDevice:(AgoraRtcDeviceType)type deviceId:(NSString *) deviceId;
  1142. - (int) getDeviceVolume:(AgoraRtcDeviceType)type;
  1143. - (int) setDeviceVolume:(AgoraRtcDeviceType)type volume:(int)volume;
  1144. - (int) startRecordingDeviceTest:(int) indicationInterval;
  1145. - (int) stopRecordingDeviceTest;
  1146. - (int) startPlaybackDeviceTest:(NSString *) audioFileName;
  1147. - (int) stopPlaybackDeviceTest;
  1148. - (int) startCaptureDeviceTest:(NSView *) view;
  1149. - (int) stopCaptureDeviceTest;
  1150. #endif
  1151. - (int) checkAVUrlCompatibility:(NSURL*)url
  1152. completionBlock:(void(^)())checkCompletionBlock;
  1153. //Audio Effects
  1154. - (double) getEffectsVolume;
  1155. - (int) setEffectsVolume:(double) volume;
  1156. - (int) playEffect:(int) soundId
  1157. filePath:(NSString*)filePath
  1158. loop:(BOOL)loop
  1159. pitch:(double) pitch
  1160. pan:(double) pan
  1161. gain:(double) gain;
  1162. - (int) stopEffect:(int) soundId;
  1163. - (int) stopAllEffects;
  1164. - (int) preloadEffect:(int) soundId
  1165. filePath:(NSString*) filePath;
  1166. - (int) unloadEffect:(int) soundId;
  1167. - (int) pauseEffect:(int) soundId;
  1168. - (int) pauseAllEffects;
  1169. - (int) resumeEffect:(int) soundId;
  1170. - (int) resumeAllEffects;
  1171. /**
  1172. * External video source support
  1173. * For new application, uses this interface instead of the one in libvideoprp
  1174. */
  1175. // query whether texture can be supported (always returns YES)
  1176. //+ (BOOL) isTextureEncodeSupported;
  1177. // If external video source is to use, call this API before enableVideo/startPreview
  1178. - (void) setExternalVideoSource:(BOOL) enable useTexture:(BOOL)useTexture pushMode:(BOOL)pushMode;
  1179. // Push a video frame to SDK
  1180. - (BOOL) pushExternalVideoFrame:(AgoraVideoFrame *)frame;
  1181. @end