index.d.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. /*
  2. * RCCallUni - v5.1.14-release.1
  3. * CommitId - a184e82065a309fc565be987321c44e9da02abbb
  4. * Thu Jan 06 2022 16:03:36 GMT+0800 (中国标准时间)
  5. * ©2020 RongCloud, Inc. All rights reserved.
  6. */
  7. declare enum RCCallIWCamera {
  8. NONE = -1,
  9. FRONT = 0,
  10. BACK = 1
  11. }
  12. /**
  13. * 通话媒体类型
  14. */
  15. declare enum RCCallIWMediaType {
  16. /**
  17. * 音频通话
  18. */
  19. AUDIO = 0,
  20. /**
  21. * 视频通话
  22. */
  23. AUDIO_VIDEO = 1
  24. }
  25. declare enum RCUNICallErrorCode {
  26. SUCCESS = 0,
  27. ENGINE_NOT_FOUND = 1,
  28. NETWORK_UNAVAILABLE = 2,
  29. ONE_CALL_EXISTED = 3,
  30. OPERATION_UNAVAILABLE = 4,
  31. INVALID_PARAM = 5,
  32. NETWORK_UNSTABLE = 6,
  33. MEDIA_REQUEST_FAILED = 7,
  34. MEDIA_SERVER_NOT_READY = 8,
  35. MEDIA_SERVER_NOT_INITIALIZED = 9,
  36. MEDIA_REQUEST_TIMEOUT = 10,
  37. MEDIA_UNKOWN_ERROR = 11,
  38. MEDIA_KICKED_BY_SERVER_ERROR = 12,
  39. MEDIA_SERVER_CLOSED_ERROR = 13,
  40. MEDIA_SERVER_PUBLISH_ERROR = 14,
  41. MEDIA_SERVER_SUBSCRIBE_ERROR = 15,
  42. MEDIA_JOIN_ROOM_REFUSE_ERROR = 16
  43. }
  44. declare enum RCCallIWCallDisconnectedReason {
  45. CANCEL = 0,
  46. REJECT = 1,
  47. HANGUP = 2,
  48. BUSY_LINE = 3,
  49. NO_RESPONSE = 4,
  50. ENGINE_UNSUPPORTED = 5,
  51. NETWORK_ERROR = 6,
  52. RESOURCE_GET_ERROR = 7,
  53. RESOURCE_PUBLISH_ERROR = 8,
  54. RESOURCE_SUBSCRIBE_ERROR = 9,
  55. REMOTE_CANCEL = 10,
  56. REMOTE_REJECT = 11,
  57. REMOTE_HANGUP = 12,
  58. REMOTE_BUSY_LINE = 13,
  59. REMOTE_NO_RESPONSE = 14,
  60. REMOTE_ENGINE_UNSUPPORTED = 15,
  61. REMOTE_NETWORK_ERROR = 16,
  62. REMOTE_RESOURCE_GET_ERROR = 17,
  63. REMOTE_RESOURCE_PUBLISH_ERROR = 18,
  64. REMOTE_RESOURCE_SUBSCRIBE_ERROR = 19,
  65. KICKED_BY_OTHER_CALL = 20,
  66. IN_OTHER_CALL = 21,
  67. KICKED_BY_SERVER = 22,
  68. REMOTE_KICKED_BY_OTHER_CALL = 23,
  69. REMOTE_IN_OTHER_CALL = 24,
  70. REMOTE_KICKED_BY_SERVER = 25,
  71. ACCEPT_BY_OTHER_CLIENT = 26,
  72. HANGUP_BY_OTHER_CLIENT = 27,
  73. REJECTED_BY_BLACKLIST = 28,
  74. SERVICE_NOT_OPENED = 29,
  75. DROP_TO_OBSERVER = 30,
  76. INIT_VIDEO_ERROR = 31,
  77. OTHER_DEVICE_HAD_ACCEPTED = 32,
  78. SERVICE_DISCONNECTED = 33
  79. }
  80. declare enum RCCallIWBeautyFilterType {
  81. NONE = 0,
  82. ESTHETIC = 1,
  83. FRESH = 2,
  84. ROMANTIC = 3
  85. }
  86. interface UniListenerResult<T> {
  87. module: string;
  88. type: string;
  89. data: T;
  90. }
  91. interface usersParams {
  92. userId: string;
  93. mediaType: string;
  94. enableCamera: string;
  95. userType: string;
  96. enableMicrophone: string;
  97. mediaId?: string;
  98. }
  99. interface ReceivedListenerResult {
  100. mine: usersParams;
  101. inviter: usersParams;
  102. startTime: number;
  103. caller: usersParams;
  104. mediaType: number;
  105. callType: number;
  106. endTime: number;
  107. extra: string;
  108. targetId: string;
  109. connectedTime: number;
  110. users: usersParams[];
  111. callId: string;
  112. }
  113. interface ListenerResultRes {
  114. reason?: RCCallIWCallDisconnectedReason;
  115. }
  116. interface ListenerResultError {
  117. reason?: RCUNICallErrorCode;
  118. }
  119. interface ListenerResultData {
  120. userId?: string;
  121. user?: usersParams;
  122. mediaType?: string;
  123. }
  124. interface RCCallIWBeautyOption {
  125. whitenessLevel: number;
  126. smoothLevel: number;
  127. ruddyLevel: number;
  128. brightLevel: number;
  129. }
  130. /**
  131. * 初始化 SDK,只需要调用一次
  132. *
  133. * calllib初始化默认不传参数
  134. */
  135. declare function init(): void;
  136. /**
  137. * 注销calllib
  138. *
  139. * 注销calllib默认不传参数
  140. */
  141. declare function unInit(): void;
  142. /**
  143. * 添加接收监听函数
  144. *
  145. * @param listener 回调函数
  146. */
  147. declare function onCallReceived(listener: (result: UniListenerResult<ReceivedListenerResult>) => void): void;
  148. /**
  149. * 添加挂断监听函数
  150. *
  151. * @param listener 回调函数
  152. */
  153. declare function onCallDisconnected(listener: (result: UniListenerResult<ListenerResultRes>) => void): void;
  154. /**
  155. * 添加连接监听函数
  156. *
  157. * @param listener 回调函数
  158. */
  159. declare function onCallConnected(listener: (result: UniListenerResult<ListenerResultRes>) => void): void;
  160. /**
  161. * 通话中的某一个参与者,邀请好友加入通话
  162. *
  163. * @param listener 回调函数
  164. */
  165. declare function onRemoteUserInvited(listener: (result: UniListenerResult<ListenerResultRes>) => void): void;
  166. /**
  167. * 对端用户加入了通话
  168. * @param listener 回调函数
  169. */
  170. declare function onRemoteUserJoined(listener: (result: UniListenerResult<usersParams>) => void): void;
  171. /**
  172. * 对端用户挂断 (实际测试,只在群聊时用触发)
  173. * @param listener 回调函数
  174. */
  175. declare function onRemoteUserLeft(listener: (result: UniListenerResult<ListenerResultRes>) => void): void;
  176. /**
  177. * 电话已拨出 主叫端拨出电话后,通过回调 onCallOutgoing 通知当前 call 的详细信息
  178. * @param listener 回调函数
  179. */
  180. declare function onCallOutgoing(listener: (result: UniListenerResult<ListenerResultRes>) => void): void;
  181. /**
  182. * 被叫端正在振铃,主叫端拨出电话,被叫端收到请求,发出振铃响应时监听
  183. * @param listener 回调函数
  184. */
  185. declare function onRemoteUserRinging(listener: (result: UniListenerResult<ListenerResultRes>) => void): void;
  186. /**
  187. * 通话出现错误的回调
  188. * @param listener 回调函数
  189. */
  190. declare function onError(listener: (result: UniListenerResult<ListenerResultError>) => void): void;
  191. /**
  192. * 对端用户切换了媒体类型
  193. * @param listener 回调函数
  194. */
  195. declare function onRemoteUserMediaTypeChanged(listener: (result: UniListenerResult<ListenerResultData>) => void): void;
  196. /**
  197. * 对端用户关闭了摄像头
  198. * @param listener 回调函数
  199. */
  200. declare function onRemoteUserCameraStateChanged(listener: (result: UniListenerResult<ListenerResultData>) => void): void;
  201. /**
  202. * 对端用户关闭了麦克风
  203. * @param listener 回调函数
  204. */
  205. declare function onRemoteUserMicrophoneStateChanged(listener: (result: UniListenerResult<ListenerResultData>) => void): void;
  206. /**
  207. * 邀请用户
  208. * @param userIds 被邀请用户id列表
  209. * @param observerUserIds 被邀请观察者id列表 (只能听或看,不能推流的用户)
  210. */
  211. declare function inviteUsers(userIds: string[], observerUserIds: string[]): void;
  212. /**
  213. * 移除监听-接收到通话呼入
  214. */
  215. declare function removeCallReceivedListener(): void;
  216. /**
  217. * 移除监听-通话已接通
  218. */
  219. declare function removeCallConnectedListener(): void;
  220. /**
  221. * 移除监听-通话已结束
  222. * @param 挂断原因
  223. */
  224. declare function removeCallDisconnectedListener(): void;
  225. /**
  226. * 移除监听-对端用户加入了通话
  227. */
  228. declare function removeRemoteUserJoinedListener(): void;
  229. /**
  230. * 移除监听-对端用户挂断
  231. */
  232. declare function removeRemoteUserLeftListener(): void;
  233. /**
  234. * 移除监听-有用户被邀请加入通话
  235. */
  236. declare function removeRemoteUserInvited(): void;
  237. /**
  238. * 移除监听-开启或关闭摄像头的回调
  239. */
  240. declare function removeEnableCameraListener(): void;
  241. /**
  242. * 移除监听-切换摄像头回调
  243. */
  244. declare function removeSwitchCameraListener(): void;
  245. /**
  246. * 移除监听-通话出现错误的回调
  247. */
  248. declare function removeErrorListener(): void;
  249. /**
  250. * 移除监听-开始呼叫通话的回调
  251. */
  252. declare function removeCallOutgoingListener(): void;
  253. /**
  254. * 移除监听-对端用户正在振铃
  255. */
  256. declare function removeRemoteUserRingingListener(): void;
  257. /**
  258. * 移除监听-对端用户切换了媒体类型
  259. */
  260. declare function removeRemoteUserMediaTypeChangedListener(): void;
  261. /**
  262. * 获取当前calllib本地存储信息
  263. *
  264. * 默认不传参数
  265. */
  266. declare function getCurrentCallSession(): any;
  267. /**
  268. * 挂断calllib
  269. *
  270. * 默认不传参数
  271. */
  272. declare function hangup(): void;
  273. /**
  274. * 接收calllib
  275. *
  276. * 默认不传参数
  277. */
  278. declare function accept(): void;
  279. /**
  280. * 发起单聊呼叫
  281. *
  282. * @param targetId 目标ID
  283. * @param type 呼叫类型(0:音频 1:音视频)
  284. * @param extra 默认传''
  285. *
  286. */
  287. declare function startSingleCall(targetId: string, type: number, extra: null): void;
  288. /**
  289. * 发起组呼呼叫
  290. *
  291. * @param groupId 组ID
  292. * @param userIds 群组成员
  293. * @param observerUserIds 观察者ID默认为空数组
  294. * @param type 呼叫类型(0:音频 1:音视频)
  295. * @param extra 默认传''
  296. *
  297. */
  298. declare function startGroupCall(groupId: string, userIds: Array<string>, observerUserIds: Array<string>, type: number, extra: string): void;
  299. /**
  300. * 设置预览窗口,此方法需要在视图更新渲染完成后执行
  301. *
  302. * @param userId 用户id
  303. * @param ref ref ID 对应组件的标识
  304. * @param type 视频显示模式 0 铺满 1 自适应
  305. * @param isZOrderOnTop android only 是否置顶
  306. */
  307. declare function setVideoView(userId: string, ref: string, type: number, isZOrderOnTop?: boolean): void;
  308. /**
  309. * 设置callib是否开启扬声器
  310. *
  311. * @param isOpen 默认开启
  312. *
  313. */
  314. declare function enableSpeaker(isOpen: boolean): void;
  315. /**
  316. * 设置callib是否开启麦克风
  317. *
  318. * @param isOPen 默认开启
  319. *
  320. */
  321. declare function enableMicrophone(isOpen: boolean): void;
  322. /**
  323. * 切换摄像头
  324. *
  325. * 默认不传参数
  326. *
  327. */
  328. declare function switchCamera(): void;
  329. /**
  330. * 获取当前摄像头方式
  331. *
  332. * 默认不传参数
  333. */
  334. declare function currentCamera(): any;
  335. /**
  336. * 开启摄像头摄像头
  337. *
  338. * @param isOpen 是否开启
  339. * @param RCCallIWCamera 对端还是本端
  340. *
  341. */
  342. declare function enableCamera(isOpen: boolean, camera: RCCallIWCamera): void;
  343. /**
  344. * 修改通话类型
  345. * @param type
  346. */
  347. declare function changeMediaType(type: RCCallIWMediaType): void;
  348. /**
  349. * 设置滤镜
  350. * @param filter
  351. */
  352. declare function setBeautyFilter(filter: RCCallIWBeautyFilterType): void;
  353. /**
  354. * 获取当前的滤镜
  355. * 默认不传参数
  356. */
  357. declare function getCurrentBeautyFilter(): any;
  358. /**
  359. * 设置美颜参数
  360. * @param enable 默认关闭
  361. * @param RCCallIWBeautyOption 美颜参数
  362. */
  363. declare function setBeautyOption(enable: boolean | undefined, option: RCCallIWBeautyOption): void;
  364. /**
  365. * 获取当前的美颜参数
  366. * 默认不传参数
  367. */
  368. declare function getCurrentBeautyOption(): any;
  369. /**
  370. * 重置美颜参数和滤镜
  371. * 默认不传参数
  372. */
  373. declare function resetBeauty(): void;
  374. export { RCCallIWBeautyFilterType, RCCallIWCallDisconnectedReason, RCCallIWCamera, RCCallIWMediaType, RCUNICallErrorCode, accept, changeMediaType, currentCamera, enableCamera, enableMicrophone, enableSpeaker, getCurrentBeautyFilter, getCurrentBeautyOption, getCurrentCallSession, hangup, init, inviteUsers, onCallConnected, onCallDisconnected, onCallOutgoing, onCallReceived, onError, onRemoteUserCameraStateChanged, onRemoteUserInvited, onRemoteUserJoined, onRemoteUserLeft, onRemoteUserMediaTypeChanged, onRemoteUserMicrophoneStateChanged, onRemoteUserRinging, removeCallConnectedListener, removeCallDisconnectedListener, removeCallOutgoingListener, removeCallReceivedListener, removeEnableCameraListener, removeErrorListener, removeRemoteUserInvited, removeRemoteUserJoinedListener, removeRemoteUserLeftListener, removeRemoteUserMediaTypeChangedListener, removeRemoteUserRingingListener, removeSwitchCameraListener, resetBeauty, setBeautyFilter, setBeautyOption, setVideoView, startGroupCall, startSingleCall, switchCamera, unInit };