No Description

RtcEngine.native.d.ts 44KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149
  1. import { Option, Callback, AgoraUserInfo, AudioMixingOption, PlayEffectOption, AudioRecordingOption, AudioFrameOption, MixedAudioFrameOption, ImageOption, VideoStreamOption, DefaultVideoStreamOption, InjectStreamOption, RemoveInjectStreamOption, PublishStreamOption, RemovePublishStreamOption, LiveTranscodingOption, PositionOption, BeautyOption, LastmileProbeConfig, CameraCapturerConfiguration } from "./types";
  2. /**
  3. * RtcEngine is the javascript object for control agora native sdk through react native bridge.
  4. *
  5. * You can use the RtcEngine methods to create {@link init}
  6. *
  7. * Other methods of the RtcEngine object serve for agora native sdk and set up error logging.
  8. */
  9. declare class RtcEngine {
  10. /**
  11. * @ignore eventTypes
  12. */
  13. private static readonly _eventTypes;
  14. /**
  15. * @ignore AG_PREFIX
  16. */
  17. private static readonly AG_PREFIX;
  18. /**
  19. * Creates a RtcEngine Object internal.
  20. *
  21. * This method creates and start event observer. You should call this method once.
  22. * @example `RtcEngine.init(option)`
  23. * @param options Defines the property of the client, see {@link Option} for details.
  24. */
  25. static init(options: Option): void;
  26. /**
  27. * join specified channel
  28. *
  29. * This method joins and begin rendering the video stream. when join succeeds.
  30. * Otherwise, it will invoke error by the event
  31. * @param channelName
  32. * @param uid
  33. * @param token
  34. * @param info
  35. */
  36. static joinChannel(channelName: string, uid?: number, token?: string, info?: Object): Promise<any>;
  37. /**
  38. * switch to specified channel
  39. *
  40. * This method will switch channel smoothly than you invoke leaveChannel & joinChannel.
  41. * Otherwise, it will invoke error by the event
  42. * It will occurs two events:
  43. * Occurs leaveChannel when achieve leaving stage
  44. * Occurs joinChannelSuccess when achieve joining stage
  45. * @param channelName
  46. * @param token
  47. */
  48. static switchChannel(channelName: string, token?: string): Promise<any>;
  49. static startChannelMediaRelay(): void;
  50. static updateChannelMediaRelay(): void;
  51. static stopChannelMediaRelay(): void;
  52. /**
  53. * Registers a user account.
  54. *
  55. * Once registered, the user account can be used to identify the local user when the user joins the channel. After the user successfully registers a user account, the SDK triggers the `on("localUserRegistered", callback)` on the local client, reporting the user ID and user account of the local user.
  56. * To join a channel with a user account, you can choose either of the following:
  57. * Call the {@link registerLocalUserAccount} method to create a user account, and then the {@link joinChannelWithUserAccount} method to join the channel.
  58. * Call the {@link joinChannelWithUserAccount} method to join the channel.
  59. *
  60. * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type.
  61. *
  62. * @param userAccount
  63. * @returns Promise<any>
  64. */
  65. static registerLocalUserAccount(userAccount: string): Promise<any>;
  66. /**
  67. * Joins the channel with a user account.
  68. *
  69. * After the user successfully joins the channel, the SDK triggers the following callbacks:
  70. *
  71. * The local client: `on("localUserRegistered", callback)` and `on("joinChannelSuccess", callback)`.
  72. * The remote client: `on("userJoined", callback)` and `on("userInfoUpdated", callback)`, if the user joining the channel is in the Communication profile, or is a BROADCASTER in the Live Broadcast profile.
  73. *
  74. * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type.
  75. *
  76. * @param channelName
  77. * @param userAccount
  78. * @param token
  79. * @returns Promise<any>
  80. */
  81. static joinChannelWithUserAccount(channelName: string, userAccount: string, token: string): Promise<any>;
  82. /**
  83. * Gets the user information by passing in the user account.
  84. *
  85. * After receiving the "userInfoUpdated" callback, you can call this method to get the user ID of the remote user from the {@link AgoraUserInfo} object by passing in the userAccount.
  86. * @param uid
  87. * @returns Promise<{@link AgoraUserInfo}>
  88. */
  89. static getUserInfoByUid(uid: number): Promise<AgoraUserInfo>;
  90. /**
  91. * Gets the user information by passing in the user account.
  92. *
  93. * After receiving the "userInfoUpdated" callback, you can call this method to get the user ID of the remote user from the {@link AgoraUserInfo} object by passing in the userAccount.
  94. * @param userAccount
  95. * @returns Promise<{@link AgoraUserInfo}>
  96. */
  97. static getUserInfoByUserAccount(userAccount: string): Promise<AgoraUserInfo>;
  98. /**
  99. * add event listener
  100. *
  101. * This method subscribes specified eventType and run listener. You should call this method at first.
  102. *
  103. * @event listener
  104. *
  105. * ---
  106. * name | description | usage |
  107. * error | occurs when emit error | on("error", evt) |
  108. * warning | occurs when emit warning | on("warning", evt) |
  109. * messageReceived | occurs when message received | on("messageReceived", evt) |
  110. * localInvitationReceivedByPeer | occurs when local inviation received by peer | on("localInvitationReceivedByPeer", evt) |
  111. * localInvitationAccepted | occurs when local invitation accepted | on("localInvitationAccepted", evt) |
  112. * localInvitationRefused | occurs when local invitation refused | on("localInvitationRefused", evt) |
  113. * localInvitationCanceled | occurs when local invitation canceled | on("localInvitationCanceled", evt) |
  114. * localInvitationFailure | occurs when local invitation failure | on("localInvitationFailure", evt) |
  115. * remoteInvitationFailure | occurs when remote invitation failure | on("remoteInvitationFailure", evt) |
  116. * remoteInvitationReceived | occurs when remote invitation received | on("remoteInvitationReceived", evt) |
  117. * remoteInvitationAccepted | occurs when remote invitation accepted | on("remoteInvitationAccepted", evt) |
  118. * remoteInvitationRefused | occurs when remote invitation refused | on("remoteInvitationRefused", evt) |
  119. * remoteInvitationCanceled | occurs when remote invitation canceled | on("remoteInvitationCanceled", evt) |
  120. * channelMessageReceived | occurs when received channel message | on("channelMessageReceived", evt) |
  121. * channelMemberJoined | occurs when some one joined in the subscribed channel | on("channelMemberJoined", evt) |
  122. * channelMemberLeft | occurs when sone one left from u subscribed channel | on("channelMemberLeft", evt) |
  123. * tokenExpired | occurs when token has expired | on("tokenExpired", evt) |
  124. * apiCallExecute | occurs when apiCallExecute emit, this event is api call monitor | on("apiCallExecute", evt) |
  125. * joinChannelSuccess | occurs when joinChannel success | on("joinChannelSuccess", evt) |
  126. * rejoinChannelSuccess | occurs when rejoinChannel success | on("rejoinChannelSuccess", evt) |
  127. * leaveChannel | occurs when leaveChannel success | on("leaveChannel", evt) |
  128. * clientRoleChanged | occurs when setClientRole changed | on("clientRoleChanged", evt) |
  129. * userJoined | occurs when remote user joined | on("userJoined", evt) |
  130. * userOffline | this event occurs when remote user offline in rtc mode, this events only occurs host user offline in live mode | on("userOffline", evt) |
  131. * connectionStateChanged | occurs when sdk connection changed state | on("connectionStateChanged", evt) |
  132. * connectionLost | occurs when sdk connection lost | on("connectionLost", evt) |
  133. * tokenPrivilegeWillExpire | occurs when token will expire | on("tokenPrivilegeWillExpire", evt) |
  134. * requestToken | occurs when token expired | on("requestToken") |
  135. * localAudioStateChanged | occurs when local audio device state changed | on("localAudioStateChanged", (state, errorCode) => {}) |
  136. * audioVolumeIndication | occurs when audio volume indication changed | on("audioVolumeIndication", evt) |
  137. * activeSpeaker | occurs when detect active speaker | on("activeSpeaker", evt) |
  138. * firstLocalAudioFrame | occurs when sent first audio frame on local | on("firstLocalAudioFrame", evt) |
  139. * firstRemoteAudioFrame | occurs when received first audio frame from remote side | on("firstRemoteAudioFrame", evt) |
  140. * firstRemoteAudioDecoded | occurs when first remote audio decoded | on("firstRemoteAudioDecoded", evt) |
  141. * firstLocalVideoFrame | occurs when sent first video frame on local | on("firstLocalVideoFrame", evt) |
  142. * firstRemoteVideoFrame | occurs when received first video frame from remote side | on("firstRemoteVideoFrame", evt) |
  143. * userMuteAudio | occurs when user mute audio | on("userMuteAudio", evt) |
  144. * videoSizeChanged | occurs when change local or remote side video size or rotation | on("videoSizeChanged", evt) |
  145. * remoteVideoStateChanged | occurs when remote video state has any changed | on("remoteVideoStateChanged", evt) |
  146. * remoteAudioStateChanged | occurs when remote audio state has any changed | on("remoteAudioStateChanged", evt) |
  147. * localAudioStats | occurs when engine start to report local audio stats | on("localAudioStats", evt) |
  148. * localPublishFallbackToAudioOnly | occurs when published stream from local side fallback to audio stream | on("localPublishFallbackToAudioOnly", evt) |
  149. * remoteSubscribeFallbackToAudioOnly | occurs when subscribed side's stream fallback to audio stream | on("remoteSubscribeFallbackToAudioOnly", evt) |
  150. * audioRouteChanged | occurs when local audio route changed | on("audioRouteChanged", evt) |
  151. * cameraFocusAreaChanged | occurs when a camera focus area changed | on("cameraFocusAreaChanged", evt) |
  152. * cameraExposureAreaChanged | occurs when a camera exposure area changed | on("cameraExposureAreaChanged", evt) |
  153. * rtcStats | occurs when reports the statistics of the current call session once every two seconds. | on("rtcStats", evt) |
  154. * lastmileQuality | occurs when reports the last mile network quality of the local user once every two seconds before the user joins a channel.| on("lastmileQuality", evt) |
  155. * networkQuality | occurs when reports the last mile network quality of each user in the channel once every two seconds.| on("networkQuality", evt) |
  156. * localVideoStats | occurs when reports local video statistics | on("localVideoStats", evt) |
  157. * remoteVideoStats | occurs when reports remote video statistics| on("remoteVideoStats", evt) |
  158. * remoteAudioStats | occurs when reports remote audio statistics| on("remoteAudioStats", evt) |
  159. * audioEffectFinish | occurs when the local audio effect playback finishes. | on("audioEffectFinish", evt) |
  160. * streamPublished | occurs when addPublishStreamUrl success| on("streamPublished", evt) |
  161. * streamUnpublish | occurs when removePublishStreamUrl success| on("streamUnpublish", evt) |
  162. * transcodingUpdate | occurs when the cdn live streaming settings are updated | on("transcodingUpdate", evt) |
  163. * streamInjectedStatus | occurs when report the status of online injecting stream to a live broadcast | on("streamInjectedStatus", evt) |
  164. * mediaEngineLoaded | occurs when the media engine loaded | on("mediaEngineLoaded", evt) |
  165. * mediaEngineStartCall | occurs when the media engine call starts | on("mediaEngineStartCall", evt) |
  166. * startEchoTestWithInterval | occurs when startEchoTestWithInterval success | on("startEchoTestWithInterval", evt) |
  167. * audioMixingStateChanged | occurs when reports the local audio mixing state changed | on("audioMixingStateChanged", evt) |
  168. * lastmileProbeTestResult | occurs when reports the last-mile network probe result.| on("lastmileProbeTestResult", evt) |
  169. * rtmpStreamingStateChanged | occurs when reports the rtmp injecting stream state changed | on("rtmpStreamingStateChanged", evt) |
  170. * localVideoChanged | occurs when the local video changed | on("localVideoChanged", evt) |
  171. * networkTypeChanged | occurs when the device network type changed | on("networkTypeChanged", evt) |
  172. * mediaMetaDataReceived | occurs when you received media meta data from the remote side through sendMediaData | on("mediaMetaDataReceived", evt) |
  173. * localUserRegistered | occurs when you register user account success | on("localUserRegistered", evt) |
  174. * userInfoUpdated | occurs when you peer side using user account join channel | on("userInfoUpdated", evt) |
  175. * ---
  176. *
  177. * @param eventType
  178. * @param listener
  179. * @return any
  180. */
  181. static on(eventType: string, listener: (...args: any[]) => any): any;
  182. /**
  183. * @deprecated removeAllListeners
  184. */
  185. static removeAllListeners(): void;
  186. /**
  187. * @deprecated off
  188. * @param mode
  189. */
  190. static off(evt: any): void;
  191. /**
  192. * renew token
  193. *
  194. * This method renews a new token.
  195. * @param token
  196. */
  197. static renewToken(token: string): any;
  198. /**
  199. * enable websdk interoperability
  200. *
  201. * This method used to enable websdk interoperability, so that it can connect with agora websdk apps.
  202. *
  203. * @param enabled
  204. * @return Promise<{success, value}>
  205. */
  206. static enableWebSdkInteroperability(enabled: boolean): Promise<any>;
  207. /**
  208. * get agora native sdk connection state
  209. *
  210. * This method gets agora native sdk connection state
  211. * @return Promise<{state: (connection state)}>
  212. */
  213. static getConnectionState(): Promise<any>;
  214. /**
  215. * change the client role
  216. *
  217. * This method changes the client of role.
  218. * @param role (audience: 0, host: 1)
  219. */
  220. static setClientRole(role: number): Promise<any>;
  221. /**
  222. * leave channel
  223. *
  224. * This method leaves the joined channel, then your video view will not render ever.
  225. * You should call it, when you dont need render video stream.
  226. *
  227. * @return Promise<null>
  228. */
  229. static leaveChannel(): Promise<any>;
  230. /**
  231. * destroy
  232. *
  233. * This method stops event subscribe and destroy the RtcEngine instance's.
  234. * You should call it, when you want to destroy the engine.
  235. *
  236. * @return void
  237. */
  238. static destroy(): any;
  239. /**
  240. * set local video render mode
  241. *
  242. * This method calls native sdk render mode for local video.
  243. * @param mode
  244. * @return Promise<any>
  245. */
  246. static setLocalRenderMode(mode: number): Promise<any>;
  247. /**
  248. * set the specified remote video render mode
  249. *
  250. * This method calls native sdk render mode for the specified remote video.
  251. *
  252. * @param uid
  253. * @param mode
  254. * @return Promise<any>
  255. */
  256. static setRemoteRenderMode(uid: number, mode: number): Promise<any>;
  257. /**
  258. * start video preview
  259. *
  260. * This method start video preview for video.
  261. * @return Promise<any>
  262. */
  263. static startPreview(): Promise<any>;
  264. /**
  265. * stop video preview
  266. *
  267. * This method stops video preview for video.
  268. * @return Promise<any>
  269. */
  270. static stopPreview(): Promise<any>;
  271. /**
  272. * set enable speaker phone
  273. *
  274. * This method set the speaker phone enable or disable by pass boolean parameter.
  275. * @param enabled
  276. * @return Promise<any>
  277. */
  278. static setEnableSpeakerphone(enabled: boolean): Promise<any>;
  279. /**
  280. * set default audio speaker
  281. *
  282. * This method set the default audio speaker enable or disable by pass boolean parameter.
  283. * @param enabled
  284. * @return Promise<any>
  285. */
  286. static setDefaultAudioRouteToSpeakerphone(enabled: boolean): Promise<any>;
  287. /**
  288. * set default mute all remote audio streams
  289. *
  290. * This method set default mute all remote audio streams enable or not by pass boolean parameter.
  291. * @param enabled
  292. * @return Promise<any>
  293. */
  294. static setDefaultMuteAllRemoteAudioStreams(enabled: boolean): Promise<any>;
  295. /**
  296. * enable video
  297. *
  298. * This method enables video.
  299. * @return Promise<any>
  300. */
  301. static enableVideo(): Promise<any>;
  302. /**
  303. * disable video
  304. *
  305. * This method disables video.
  306. * @return Promise<any>
  307. */
  308. static disableVideo(): Promise<any>;
  309. /**
  310. * enable local video
  311. *
  312. * This method enables the local video by the boolean parameter.
  313. * @param enabled
  314. * @return Promise<any>
  315. */
  316. static enableLocalVideo(enabled: boolean): Promise<any>;
  317. /**
  318. * mute local video stream
  319. *
  320. * This method mutes video stream by the boolean parameter.
  321. * @param muted
  322. * @return Promise<any>
  323. */
  324. static muteLocalVideoStream(muted: boolean): Promise<any>;
  325. /**
  326. * mute all remote video streams
  327. *
  328. * This method mutes all remote streams by the boolean parameter.
  329. * @param muted
  330. * @return Promise<any>
  331. */
  332. static muteAllRemoteVideoStreams(muted: boolean): Promise<any>;
  333. /**
  334. * @ignore Uint32ToInt32
  335. */
  336. private static Uint32ToInt32;
  337. /**
  338. * @ignore Int32ToUint32
  339. */
  340. private static Int32ToUint32;
  341. /**
  342. * mute specified remote video stream.
  343. *
  344. * This method mutes remote video stream by the number of uid and boolean parameter.
  345. * @param uid
  346. * @param muted
  347. * @return Promise<any>
  348. */
  349. static muteRemoteVideoStream(uid: number, muted: boolean): Promise<any>;
  350. /**
  351. * set default mute all remote video stream
  352. *
  353. * This method mutes all remote video stream default by the boolean parameter.
  354. * @param muted
  355. * @return Promise<any>
  356. */
  357. static setDefaultMuteAllRemoteVideoStreams(muted: boolean): Promise<any>;
  358. /**
  359. * enable audio
  360. *
  361. * This method enables audio
  362. * @return Promise<any>
  363. */
  364. static enableAudio(): Promise<any>;
  365. /**
  366. * disable audio
  367. *
  368. * This method disables audio
  369. * @return Promise<any>
  370. */
  371. static disableAudio(): Promise<any>;
  372. /**
  373. * enable local audio
  374. *
  375. * This method enables local audio by the boolean parameter.
  376. * @param enabled
  377. * @return Promise<any>
  378. */
  379. static enableLocalAudio(enabled: boolean): Promise<any>;
  380. /**
  381. * mute local audio stream
  382. *
  383. * This method mutes the local audio stream by muted.
  384. * @param muted
  385. * @return Promise<any>
  386. */
  387. static disableLocalAudio(muted: boolean): Promise<any>;
  388. /**
  389. * mute all remote audio streams
  390. *
  391. * This method mutes all remote audio streams by muted
  392. * @param muted boolean
  393. * @return Promise<any>
  394. */
  395. static muteAllRemoteAudioStreams(muted: boolean): Promise<any>;
  396. /**
  397. * mute specified remote audio stream by muted
  398. *
  399. * This method mutes specified remote audio stream by number uid and boolean muted.
  400. * @param uid
  401. * @param muted
  402. * @return Promise<any>
  403. */
  404. static muteRemoteAudioStream(uid: number, muted: boolean): Promise<any>;
  405. /**
  406. * adjust recording signal volume
  407. *
  408. * This method adjusts recording your signal by volume.
  409. * @param volume
  410. * @return Promise<any>
  411. */
  412. static adjustRecordingSignalVolume(volume: number): Promise<any>;
  413. /**
  414. * adjust playback signal volume
  415. *
  416. * This method adjusts playback signal by volume.
  417. * @param volume
  418. * @return Promise<any>
  419. */
  420. static adjustPlaybackSignalVolume(volume: number): Promise<any>;
  421. /**
  422. * enable audio volume indication
  423. *
  424. * This method enables audio volume by interval and smooth
  425. * @param interval
  426. * @param smooth
  427. * @return Promise<any>
  428. */
  429. static enableAudioVolumeIndication(interval: number, smooth: number): Promise<any>;
  430. /**
  431. * check for mobile phone speaker enabled
  432. *
  433. * This method checks the phone speaker is enabled
  434. * @param callback
  435. * @return any
  436. */
  437. static isSpeakerphoneEnabled(callback: Callback<any>): any;
  438. /**
  439. * enable in-ear monitor
  440. *
  441. * This method enables in-ear monitoring by boolean parameter enabled
  442. *
  443. * @param enabled
  444. * @return Promise<any>
  445. */
  446. static enableInEarMonitoring(enabled: boolean): Promise<any>;
  447. /**
  448. * set in-ear monitoring volume
  449. *
  450. * This method sets the in-ear-monitoring volume by number parameter volume
  451. *
  452. * @param volume
  453. * @return Promise<any>
  454. */
  455. static setInEarMonitoringVolume(volume: number): Promise<any>;
  456. /**
  457. * set local voice pitch
  458. *
  459. * This method sets the local voice pitch by float parameter pitch
  460. *
  461. * @param pitch
  462. * @return Promise<any>
  463. */
  464. static setLocalVoicePitch(pitch: number): Promise<any>;
  465. /**
  466. * set local voice equalization
  467. *
  468. * This method set local video equalization of band frequency by enum band number and number of gain
  469. *
  470. * @param band
  471. * @param gain
  472. * @return Promise<any>
  473. */
  474. static setLocalVoiceEqualization(band: number, gain: number): void;
  475. /**
  476. * set local voice reverb
  477. *
  478. * This method sets local voice by reverb and value
  479. * @param reverb
  480. * @param value
  481. */
  482. static setLocalVoiceReverb(reverb: number, value: number): void;
  483. /**
  484. * start audio mixing
  485. *
  486. * This method will start audio mixing by option config
  487. *
  488. * @param options {@link AudioMixingOption}
  489. */
  490. static startAudioMixing(options: AudioMixingOption): void;
  491. /**
  492. * stop audio mixing
  493. *
  494. * This methods stops for audio mixing.
  495. */
  496. static stopAudioMixing(): void;
  497. /**
  498. * pause audio mixing
  499. *
  500. * This method pauses for audio mixing.
  501. */
  502. static pauseAudioMixing(): void;
  503. /**
  504. * resume audio mixing
  505. *
  506. * This method resumes for audio mixing.
  507. */
  508. static resumeAudioMixing(): void;
  509. /**
  510. * adjust audio mixing volume
  511. *
  512. * This method adjusts audio mixing volume by the volume number parameter
  513. * @param volume
  514. */
  515. static adjustAudioMixingVolume(volume: number): void;
  516. /**
  517. * adjust audio mixing playout volume
  518. *
  519. * This method adjusts audio mixing playout by the volume parameter
  520. * @param volume
  521. */
  522. static adjustAudioMixingPlayoutVolume(volume: number): void;
  523. /**
  524. * adjust audio mixing publish volume
  525. *
  526. * This method adjusts audio mixing publish by the volume paraemter
  527. * @param volume
  528. */
  529. static adjustAudioMixingPublishVolume(volume: number): void;
  530. /**
  531. * get audio mixing duration
  532. *
  533. * This method gets the audio mixing duration
  534. * @return Promise<{success, value}>
  535. */
  536. static getAudioMixingDuration(): Promise<any>;
  537. /**
  538. * get audio mixing current position
  539. *
  540. * This method gets audio mixing current position value.
  541. * @return Promise<{success, value}>
  542. */
  543. static getAudioMixingCurrentPosition(): Promise<any>;
  544. /**
  545. * set audio mixing position
  546. *
  547. * This method sets audio mixing position by the parameter pos
  548. * @param pos
  549. */
  550. static setAudioMixingPosition(pos: number): Promise<any>;
  551. /**
  552. * get effects of volume
  553. *
  554. * This methods get audio mixing effects volume value.
  555. * @return Promise<{success, value}>
  556. */
  557. static getEffectsVolume(): Promise<any>;
  558. /**
  559. * set effects volume
  560. *
  561. * This methods set audio mixing effects volume by float parameter.
  562. * @param volume
  563. * @return Promise<{success, value}>
  564. */
  565. static setEffectsVolume(volume: number): Promise<any>;
  566. /**
  567. * set volume for playing effects.
  568. *
  569. * This methods set for playing audio mixing effects
  570. * @return Promise<{success, value}>
  571. */
  572. static setVolumeOfEffect(volume: number): Promise<any>;
  573. /**
  574. * play specified effect for audio mixing
  575. *
  576. * This methos plays the specified effect of audio mixing file by option config.
  577. * @param options {@link PlayEffectOption}
  578. * @return Promise<{success, value}>
  579. */
  580. static playEffect(options: PlayEffectOption): Promise<any>;
  581. /**
  582. * stop play effect for audio mixing
  583. *
  584. * This methods stops the specified effect for audio mixing file by soundId.
  585. * @param sounid
  586. * @return Promise<{success, value}>
  587. */
  588. static stopEffect(soundId: number): Promise<any>;
  589. /**
  590. * stop play all for effect audio mixing.
  591. *
  592. * This methods stops all effect audio mixing.
  593. * @return Promise<{success, value}>
  594. */
  595. static stopAllEffects(): Promise<any>;
  596. /**
  597. * preload effect for audio mixing file.
  598. *
  599. * This methods preloads the specified audio mixing file to memory by the soundId
  600. * @param soundId
  601. * @param filePath
  602. * @return Promise<{success, value}>
  603. */
  604. static preloadEffect(soundId: number, filePath: string): Promise<any>;
  605. /**
  606. * unload effect
  607. *
  608. * This methods unload the already loaded audio mixing file from memory by the soundId.
  609. * @param soundId
  610. * @return Promise<{success, value}>
  611. */
  612. static unloadEffect(soundId: number): Promise<any>;
  613. /**
  614. * pause the specified effect for audio mixing by soundId
  615. *
  616. * This method pauses the specified effect for audio mixing by soundId.
  617. * @param soundId
  618. * @return Promise<{success, value}>
  619. */
  620. static pauseEffect(soundId: number): Promise<any>;
  621. /**
  622. * pause all effects for audio mixing
  623. *
  624. * This method pause all effects for audio mixing.
  625. * @param soundId
  626. * @return Promise<{success, value}>
  627. */
  628. static pauseAllEffects(): Promise<any>;
  629. /**
  630. * resume audio mixing effect by the specified soundId
  631. *
  632. * This method resumes audio mixing effect by the specified soundId
  633. * @param soundId
  634. * @return Promise<{success, value}>
  635. */
  636. static resumeEffect(soundId: number): Promise<any>;
  637. /**
  638. * resume all audio mixing effects.
  639. *
  640. * This method resumes all audio mixing effects.
  641. * @return Promise<{success, value}>
  642. */
  643. static resumeAllEffects(): Promise<any>;
  644. /**
  645. * start audio recording by quality
  646. *
  647. * This method start audio recording by quality config
  648. * @param options {@link AudioRecordingOption}
  649. * @return Promise<{success, value}>
  650. */
  651. static startAudioRecording(options: AudioRecordingOption): Promise<any>;
  652. /**
  653. * stop audio recording
  654. *
  655. * This method stops audio recording.
  656. * @return Promise<{success, value}>
  657. */
  658. static stopAudioRecording(): Promise<any>;
  659. /**
  660. * set audio session operation restriction
  661. *
  662. * The SDK and the app can both configure the audio session by default. The app may occasionally use other apps or third-party components to manipulate the audio session and restrict the SDK from doing so. This method allows the app to restrict the SDK’s manipulation of the audio session.
  663. * You can call this method at any time to return the control of the audio sessions to the SDK.
  664. * This method restricts the SDK’s manipulation of the audio session. Any operation to the audio session relies solely on the app, other apps, or third-party components.
  665. * @notice iOS support only
  666. */
  667. static setAudioSessionOperationRestriction(): void;
  668. /**
  669. * @deprecated startEchoTest
  670. * startEchoTest
  671. */
  672. /**
  673. * @deprecated isCameraAutoFocusFaceModeSupported
  674. * @deprecated isCameraExposurePositionSupported
  675. * @deprecated isCameraFocusSupported
  676. * @deprecated isCameraTorchSupported
  677. * @deprecated isCameraZoomSupported
  678. * instead use {@method getCameraInfo}
  679. */
  680. /**
  681. * stop echo test
  682. *
  683. * This method stop launched an audio call test.
  684. * @return Promise<{success, value}>
  685. */
  686. static stopEchoTest(): Promise<any>;
  687. /**
  688. * enable lastmile test
  689. *
  690. * This method enables the network connection qualit test.
  691. *
  692. * @return Promise<{success, value}>
  693. */
  694. static enableLastmileTest(): Promise<any>;
  695. /**
  696. * disable lastmile test
  697. *
  698. * This method disable the network connection qualit test.
  699. *
  700. * @return Promise<{success, value}>
  701. */
  702. static disableLastmileTest(): Promise<any>;
  703. /**
  704. * set recording audio frame parameters
  705. *
  706. * This method Sets the audio recording format for the audioFrame callback.
  707. *
  708. * @param options {@link RecordingAudioFrameOption}
  709. * @return Promise<{success, value}>
  710. */
  711. static setRecordingAudioFrameParameters(options: AudioFrameOption): Promise<any>;
  712. /**
  713. * set playback audio frame parameters
  714. *
  715. * This method Sets the audio frame format for the playbackFrame callback.
  716. *
  717. * @param options {@link AudioFrameOption}
  718. * @return Promise<{success, value}>
  719. */
  720. static setPlaybackAudioFrameParameters(options: AudioFrameOption): Promise<any>;
  721. /**
  722. * set mixed audio frame parameters
  723. *
  724. * This method Sets the audio frame format for the mixedAudioFrame callback.
  725. *
  726. * @param options {@link MixedAudioFrameOption}
  727. * @return Promise<{success, value}>
  728. */
  729. static setMixedAudioFrameParameters(options: MixedAudioFrameOption): Promise<any>;
  730. /**
  731. * add video watermark
  732. *
  733. * This method adds video watermark to the local video.
  734. *
  735. * @param options {@link ImageOption}
  736. * @return Promise<{success, value}>
  737. */
  738. static addVideoWatermark(options: ImageOption): Promise<any>;
  739. /**
  740. * clear video watermarks
  741. *
  742. * This method removes the watermark image from the video stream added by addVideoWatermark.
  743. *
  744. * @return Promise<{success, value}>
  745. */
  746. static clearVideoWatermarks(): Promise<any>;
  747. /**
  748. * set local publish fallback
  749. *
  750. * This method sets the fallback option for the locally published video stream based on the network conditions.
  751. *
  752. * @param option {0, 1, 2} [more details](https://docs.agora.io/en/Video/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_constants.html#a3e453c93766e783a7e5eca05b1776238)
  753. * @return Promise<{success, value}>
  754. */
  755. static setLocalPublishFallbackOption(option: number): Promise<any>;
  756. /**
  757. * set remote publish fallback
  758. *
  759. * This method sets the fallback option for the remotely subscribed video stream based on the network conditions.
  760. *
  761. * @param option {0, 1, 2} [more details](https://docs.agora.io/en/Video/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_constants.html#a3e453c93766e783a7e5eca05b1776238)
  762. * @return Promise<{success, value}>
  763. */
  764. static setRemoteSubscribeFallbackOption(option: number): Promise<any>;
  765. /**
  766. * enable dual stream mode
  767. *
  768. * This method enables the dual stream by parameter mode.
  769. *
  770. * @param enabled
  771. * @return Promise<{success, value}>
  772. */
  773. static enableDualStreamMode(enabled: boolean): Promise<any>;
  774. /**
  775. * set remote video stream type
  776. *
  777. * This method sets the remote video stream type by uid and streamType.
  778. *
  779. * @param options {@link VideoStreamOption}
  780. * @return Promise<{success, value}>
  781. */
  782. static setRemoteVideoStreamType(options: VideoStreamOption): Promise<any>;
  783. /**
  784. * set remote default video stream type
  785. *
  786. * This method sets the default video stream type.
  787. *
  788. * @param options {@link DefaultVideoStreamOption}
  789. * @return Promise<{success, value}>
  790. */
  791. static setRemoteDefaultVideoStreamType(options: DefaultVideoStreamOption): Promise<any>;
  792. /**
  793. * add inject stream url
  794. *
  795. * This method injects an online media stream to a live broadcast.
  796. *
  797. * @param options {@link InjectStreamOption}
  798. * @return Promise<{success, value}>
  799. */
  800. static addInjectStreamUrl(options: InjectStreamOption): Promise<any>;
  801. /**
  802. * remove inject stream url
  803. *
  804. * This method removes stream by addInjectsStreamUrl.
  805. *
  806. * @param options {@link RemoveInjectStreamOption}
  807. * @return Promise<{success, value}>
  808. */
  809. static removeInjectStreamUrl(options: RemoveInjectStreamOption): Promise<any>;
  810. /**
  811. * @deprecated sendMessage
  812. * sendMessage
  813. */
  814. static sendMessage(): Promise<any>;
  815. /**
  816. * @deprecated createDataStream
  817. * createDataStream
  818. */
  819. /**
  820. * @deprecated setupLocalVideo
  821. * setupLocalVideo
  822. */
  823. /**
  824. * @deprecated setupRemoteVideo
  825. * setupRemoteVideo
  826. */
  827. /**
  828. * @deprecated setVideoQualityParameters
  829. * setVideoQualityParameters
  830. */
  831. /**
  832. * set local video mirror mode
  833. *
  834. * This method sets local video mirror mode
  835. *
  836. * @param mode
  837. * @return Promise<{success, value}>
  838. */
  839. static setLocalVideoMirrorMode(mode: number): Promise<any>;
  840. /**
  841. * switch camera
  842. *
  843. * This method switches camera between front and rear.
  844. *
  845. * @return Promise<{success, value}>
  846. */
  847. static switchCamera(): Promise<any>;
  848. /**
  849. * set camera zoom ratio
  850. *
  851. * This method sets the camera zoom ratio.
  852. *
  853. * @param zoomFactor
  854. * @return Promise<{success, value}>
  855. */
  856. static setCameraZoomFactor(zoomFactor: number): Promise<any>;
  857. /**
  858. * get camera max zoom ratio
  859. *
  860. * This method gets the camera maximum zoom ratio.
  861. *
  862. * @notice Android Only
  863. * @return Promise<{success, value}>
  864. */
  865. static getCameraMaxZoomFactor(): Promise<any>;
  866. /**
  867. * set camera focus position in preview
  868. *
  869. * This method sets the mannual focus position.
  870. *
  871. * @param options {@link PositionOption}
  872. * @return Promise<{success, value}>
  873. */
  874. static setCameraFocusPositionInPreview(options: PositionOption): Promise<any>;
  875. /**
  876. * set camera exposure position
  877. *
  878. * This method sets the mannual exposure position.
  879. *
  880. * @param options {@link PositionOption}
  881. * @return Promise<{success, value}>
  882. */
  883. static setCameraExposurePosition(options: PositionOption): Promise<any>;
  884. /**
  885. * set camera torch on
  886. *
  887. * This method enables the camera flash function.
  888. *
  889. * @param enabled
  890. * @return Promise<{success, value}>
  891. */
  892. static setCameraTorchOn(enabled: boolean): Promise<any>;
  893. /**
  894. * set enable auto focus face mode
  895. *
  896. * This method enables auto-focus face mode function.
  897. *
  898. * @param enabled boolean
  899. * @return Promise<{success, value}>
  900. */
  901. static setCameraAutoFocusFaceModeEnabled(enabled: boolean): Promise<any>;
  902. /**
  903. * get call id
  904. *
  905. * This method is used to get call id.
  906. *
  907. * @return Promise<{success, value}>
  908. */
  909. static getCallId(): Promise<any>;
  910. /**
  911. * set log file and log filter
  912. *
  913. * This method sets the log file generated path and specified the log level.
  914. *
  915. * @param filePath string
  916. * @param level enum
  917. * @param maxfileSize integer (KB)
  918. * @return Promise<{success, value}>
  919. */
  920. static setLog(filePath: string, level: number, maxfileSize: number): Promise<any>;
  921. /**
  922. * add publish stream url
  923. *
  924. * This method add publish stream by option.
  925. *
  926. * @param options {@link PublishStreamOption}
  927. * @return Promise<{success, value}>
  928. */
  929. static addPublishStreamUrl(options: PublishStreamOption): Promise<any>;
  930. /**
  931. * remove publish stream url
  932. *
  933. * This method remove publish stream by options.
  934. *
  935. * @param options {@link RemovePublishStreamOption}
  936. * @return Promise<{success, value}>
  937. */
  938. static removePublishStreamUrl(options: RemovePublishStreamOption): Promise<any>;
  939. /**
  940. * set live transcoding
  941. *
  942. * This method sets the video layout and audio settings for CDN live.
  943. *
  944. * @param options {@link LiveTranscoding}
  945. * @return Promise<{success, value}>
  946. */
  947. static setLiveTranscoding(options: LiveTranscodingOption): Promise<any>;
  948. /**
  949. * get sdk version
  950. *
  951. * This method gets the sdk version details and passed it into callback function
  952. *
  953. * @param callback to handle resolve from getSdkVersion
  954. * @param errorHandler to handle reject error from getSdkVersion
  955. * @return any
  956. */
  957. static getSdkVersion(callback: Callback<any>, errorHandler?: Callback<any>): any;
  958. /**
  959. * mute local audio stream
  960. *
  961. * This method sends/stops sending the local audio.
  962. *
  963. * @param enabled
  964. * @return Promise<any>
  965. */
  966. static muteLocalAudioStream(enabled: boolean): Promise<any>;
  967. /**
  968. * video pre-process/post-process
  969. *
  970. * This method enables/disables image enhancement and sets the options.
  971. *
  972. * @param enable boolean
  973. * @param options {@link BeautyOptions}
  974. * @return Promise<any>
  975. */
  976. static setBeautyEffectOptions(enabled: boolean, options: BeautyOption): Promise<any>;
  977. /**
  978. * set local voice change
  979. *
  980. * This method changes local speaker voice with voiceChanger
  981. *
  982. * @param voiceChanger integer
  983. * @voiceChanger value ranges [
  984. * 0: "The original voice",
  985. * 1: "An old man’s voice",
  986. * 2: "A little boy’s voice.",
  987. * 3: "A little girl’s voice.",
  988. * 4: "TBD",
  989. * 5: "Ethereal vocal effects.",
  990. * 6: "Hulk’s voice."
  991. * ]
  992. * @return Promise<any>
  993. */
  994. static setLocalVoiceChanger(voiceChanger: number): Promise<any>;
  995. /**
  996. * set the preset local voice reverberation effect.
  997. *
  998. * This method sets the preset local voice reverberation effect.
  999. *
  1000. * @param preset integer
  1001. * @return Promise<any>
  1002. */
  1003. static setLocalVoiceReverbPreset(preset: number): Promise<any>;
  1004. /**
  1005. * control stereo panning for remote users
  1006. *
  1007. * This method enables/disables stereo panning for remote users.
  1008. *
  1009. * @param enabled boolean
  1010. * @return Promise<any>
  1011. */
  1012. static enableSoundPositionIndication(enabled: boolean): Promise<any>;
  1013. /**
  1014. * set the sound position of a remote user
  1015. *
  1016. * This method sets the sound position of a remote user by uid
  1017. *
  1018. * @param uid number | The ID of the remote user
  1019. * @param pan float | The sound position of the remote user. The value ranges from -1.0 to 1.0
  1020. * @pan
  1021. * 0.0: the remote sound comes from the front.
  1022. * -1.0: the remote sound comes from the left.
  1023. * 1.0: the remote sound comes from the right.
  1024. * @param gain float | Gain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain.
  1025. * @return Promise<any>
  1026. */
  1027. static setRemoteVoicePosition(uid: number, pan: number, gain: number): Promise<any>;
  1028. /**
  1029. * start the lastmile probe test
  1030. *
  1031. * This method start the last-mile network probe test before joining a channel to get the uplink and downlink last-mile network statistics, including the bandwidth, packet loss, jitter, and round-trip time (RTT).
  1032. *
  1033. * @param config LastmileProbeConfig {@link LastmileProbeConfig}
  1034. *
  1035. * event onLastmileQuality: the SDK triggers this callback within two seconds depending on the network conditions. This callback rates the network conditions with a score and is more closely linked to the user experience.
  1036. * event onLastmileProbeResult: the SDK triggers this callback within 30 seconds depending on the network conditions. This callback returns the real-time statistics of the network conditions and is more objective.
  1037. * @return Promise<any>
  1038. */
  1039. static startLastmileProbeTest(config: LastmileProbeConfig): Promise<any>;
  1040. /**
  1041. * stop the lastmile probe test
  1042. *
  1043. * This method stop the lastmile probe test.
  1044. *
  1045. * @return Promise<any>
  1046. */
  1047. static stopLastmileProbeTest(): Promise<any>;
  1048. /**
  1049. * sets the priority of a remote user's media stream.
  1050. *
  1051. * note: Use this method with the setRemoteSubscribeFallbackOption method. If the fallback function is enabled for a subscribed stream, the SDK ensures the high-priority user gets the best possible stream quality.
  1052. *
  1053. * This method sets the priority of a remote user's media stream.
  1054. * @param uid number
  1055. * @param userPriority number | The value range is [50 is "user's priority is high", 100 is "the default user's priority is normal"]
  1056. *
  1057. * @return Promise<any>
  1058. */
  1059. static setRemoteUserPriority(uid: number, userPriority: number): Promise<any>;
  1060. /**
  1061. * start an audio call test.
  1062. *
  1063. * note:
  1064. * Call this method before joining a channel.
  1065. * After calling this method, call the stopEchoTest method to end the test. Otherwise, the app cannot run the next echo test, or call the joinChannel method.
  1066. * In the Live-broadcast profile, only a host can call this method.
  1067. * This method will start an audio call test with interval parameter.
  1068. * In the audio call test, you record your voice. If the recording plays back within the set time interval, the audio devices and the network connection are working properly.
  1069. *
  1070. * @param interval number
  1071. *
  1072. * @return Promise<any>
  1073. */
  1074. static startEchoTestWithInterval(interval: number): Promise<any>;
  1075. /**
  1076. * set the camera capture preference.
  1077. *
  1078. * note:
  1079. * For a video call or live broadcast, generally the SDK controls the camera output parameters. When the default camera capture settings do not meet special requirements or cause performance problems, we recommend using this method to set the camera capture preference:
  1080. * If the resolution or frame rate of the captured raw video data are higher than those set by setVideoEncoderConfiguration, processing video frames requires extra CPU and RAM usage and degrades performance. We recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE(1) to avoid such problems.
  1081. * If you do not need local video preview or are willing to sacrifice preview quality, we recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE(1) to optimize CPU and RAM usage.
  1082. * If you want better quality for the local video preview, we recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PREVIEW(2).
  1083. *
  1084. * This method will set the camera capture preference.
  1085. *
  1086. * @param config {@link CameraCapturerConfiguration}
  1087. *
  1088. * @return Promise<any>
  1089. */
  1090. static setCameraCapturerConfiguration(config: CameraCapturerConfiguration): Promise<any>;
  1091. /**
  1092. * Gets the audio mixing volume for local playback.
  1093. *
  1094. * note:
  1095. * This method helps troubleshoot audio volume related issues.
  1096. *
  1097. * @return Promise<any>
  1098. */
  1099. static getAudioMixingPlayoutVolume(): Promise<any>;
  1100. /**
  1101. * Gets the audio mixing volume for publishing.
  1102. *
  1103. * note:
  1104. * This method helps troubleshoot audio volume related issues.
  1105. *
  1106. * @return Promise<any>
  1107. */
  1108. static getAudioMixingPublishVolume(): Promise<any>;
  1109. /**
  1110. * sendMediaData for media observer.
  1111. *
  1112. * note:
  1113. * This method needs you invoke registerMediaMetadataObserver success first and you could send media data through interval media observer feature.
  1114. * The data have limit length is 1024 bytes, if you pass data length bigger than limit it will failed.
  1115. * @param data String: 1024 bytes limit
  1116. * @return Promise<any>
  1117. */
  1118. static sendMediaData(data: String): Promise<any>;
  1119. /**
  1120. * Registers the metadata observer.
  1121. *
  1122. * note:
  1123. * This method only work in live mode
  1124. * This method enables you to add synchronized metadata in the video stream for more diversified live broadcast interactions, such as sending shopping links, digital coupons, and online quizzes.
  1125. * This method trigger 'mediaMetaDataReceived' event, here is example:
  1126. * ```javascript
  1127. * RtcEngine.on("mediaMetaDataReceived", (data) => {
  1128. * console.log("mediaMetaDataReceived", data);
  1129. * })
  1130. * ```
  1131. * @return Promise<any>
  1132. */
  1133. static registerMediaMetadataObserver(): Promise<any>;
  1134. /**
  1135. * Get local device camera support info
  1136. *
  1137. * note:
  1138. * This method returns your current device camera support info.
  1139. * ```javascript
  1140. * RtcEngine.getCameraInfo().then(info => {
  1141. * console.log("your currrent camera", info);
  1142. * })
  1143. * ```
  1144. * @return Promise{cameraSupportInfo}>
  1145. */
  1146. static getCameraInfo(): Promise<any>;
  1147. }
  1148. export default RtcEngine;