Няма описание

RtcEngine.native.js 52KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const tslib_1 = require("tslib");
  4. const react_native_1 = require("react-native");
  5. const { Agora } = react_native_1.NativeModules;
  6. const AgoraEventEmitter = new react_native_1.NativeEventEmitter(Agora);
  7. /**
  8. * RtcEngine is the javascript object for control agora native sdk through react native bridge.
  9. *
  10. * You can use the RtcEngine methods to create {@link init}
  11. *
  12. * Other methods of the RtcEngine object serve for agora native sdk and set up error logging.
  13. */
  14. class RtcEngine {
  15. /**
  16. * Creates a RtcEngine Object internal.
  17. *
  18. * This method creates and start event observer. You should call this method once.
  19. * @example `RtcEngine.init(option)`
  20. * @param options Defines the property of the client, see {@link Option} for details.
  21. */
  22. static init(options) {
  23. Agora.init(options);
  24. }
  25. /**
  26. * join specified channel
  27. *
  28. * This method joins and begin rendering the video stream. when join succeeds.
  29. * Otherwise, it will invoke error by the event
  30. * @param channelName
  31. * @param uid
  32. * @param token
  33. * @param info
  34. */
  35. static joinChannel(channelName, uid, token, info) {
  36. return Agora.joinChannel({ channelName, uid, token, info });
  37. }
  38. /**
  39. * Registers a user account.
  40. *
  41. * 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.
  42. * To join a channel with a user account, you can choose either of the following:
  43. * Call the {@link registerLocalUserAccount} method to create a user account, and then the {@link joinChannelWithUserAccount} method to join the channel.
  44. * Call the {@link joinChannelWithUserAccount} method to join the channel.
  45. *
  46. * @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.
  47. *
  48. * @param userAccount
  49. * @returns Promise<any>
  50. */
  51. static registerLocalUserAccount(userAccount) {
  52. return Agora.registerLocalUserAccount({ userAccount });
  53. }
  54. /**
  55. * Joins the channel with a user account.
  56. *
  57. * After the user successfully joins the channel, the SDK triggers the following callbacks:
  58. *
  59. * The local client: `on("localUserRegistered", callback)` and `on("joinChannelSuccess", callback)`.
  60. * 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.
  61. *
  62. * @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.
  63. *
  64. * @param channelName
  65. * @param userAccount
  66. * @param token
  67. * @returns Promise<any>
  68. */
  69. static joinChannelWithUserAccount(channelName, userAccount, token) {
  70. return Agora.joinChannelWithUserAccount({ channelName, userAccount, token });
  71. }
  72. /**
  73. * Gets the user information by passing in the user account.
  74. *
  75. * 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.
  76. * @param uid
  77. * @returns Promise<{@link AgoraUserInfo}>
  78. */
  79. static getUserInfoByUid(uid) {
  80. return tslib_1.__awaiter(this, void 0, void 0, function* () {
  81. if (react_native_1.Platform.OS === 'android') {
  82. const _uid = this.Uint32ToInt32(uid);
  83. let result = yield Agora.getUserInfoByUid(_uid);
  84. result.uid = this.Int32ToUint32(result.uid);
  85. return result;
  86. }
  87. return Agora.getUserInfoByUid(uid);
  88. });
  89. }
  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) {
  98. return tslib_1.__awaiter(this, void 0, void 0, function* () {
  99. if (react_native_1.Platform.OS === 'android') {
  100. let result = yield Agora.getUserInfoByUserAccount(userAccount);
  101. result.uid = this.Int32ToUint32(result.uid);
  102. return result;
  103. }
  104. return Agora.getUserInfoByUserAccount(userAccount);
  105. });
  106. }
  107. /**
  108. * add event listener
  109. *
  110. * This method subscribes specified eventType and run listener. You should call this method at first.
  111. *
  112. * @event listener
  113. *
  114. * ---
  115. * name | description | usage |
  116. * error | occurs when emit error | on("error", evt) |
  117. * warning | occurs when emit warning | on("warning", evt) |
  118. * messageReceived | occurs when message received | on("messageReceived", evt) |
  119. * localInvitationReceivedByPeer | occurs when local inviation received by peer | on("localInvitationReceivedByPeer", evt) |
  120. * localInvitationAccepted | occurs when local invitation accepted | on("localInvitationAccepted", evt) |
  121. * localInvitationRefused | occurs when local invitation refused | on("localInvitationRefused", evt) |
  122. * localInvitationCanceled | occurs when local invitation canceled | on("localInvitationCanceled", evt) |
  123. * localInvitationFailure | occurs when local invitation failure | on("localInvitationFailure", evt) |
  124. * remoteInvitationFailure | occurs when remote invitation failure | on("remoteInvitationFailure", evt) |
  125. * remoteInvitationReceived | occurs when remote invitation received | on("remoteInvitationReceived", evt) |
  126. * remoteInvitationAccepted | occurs when remote invitation accepted | on("remoteInvitationAccepted", evt) |
  127. * remoteInvitationRefused | occurs when remote invitation refused | on("remoteInvitationRefused", evt) |
  128. * remoteInvitationCanceled | occurs when remote invitation canceled | on("remoteInvitationCanceled", evt) |
  129. * channelMessageReceived | occurs when received channel message | on("channelMessageReceived", evt) |
  130. * channelMemberJoined | occurs when some one joined in the subscribed channel | on("channelMemberJoined", evt) |
  131. * channelMemberLeft | occurs when sone one left from u subscribed channel | on("channelMemberLeft", evt) |
  132. * tokenExpired | occurs when token has expired | on("tokenExpired", evt) |
  133. * apiCallExecute | occurs when apiCallExecute emit, this event is api call monitor | on("apiCallExecute", evt) |
  134. * joinChannelSuccess | occurs when joinChannel success | on("joinChannelSuccess", evt) |
  135. * rejoinChannelSuccess | occurs when rejoinChannel success | on("rejoinChannelSuccess", evt) |
  136. * leaveChannel | occurs when leaveChannel success | on("leaveChannel", evt) |
  137. * clientRoleChanged | occurs when setClientRole changed | on("clientRoleChanged", evt) |
  138. * userJoined | occurs when remote user joined | on("userJoined", evt) |
  139. * userOffline | this event occurs when remote user offline in rtc mode, this events only occurs host user offline in live mode | on("userOffline", evt) |
  140. * connectionStateChanged | occurs when sdk connection changed state | on("connectionStateChanged", evt) |
  141. * connectionLost | occurs when sdk connection lost | on("connectionLost", evt) |
  142. * tokenPrivilegeWillExpire | occurs when token will expire | on("tokenPrivilegeWillExpire", evt) |
  143. * requestToken | occurs when token expired | on("requestToken") |
  144. * microphoneEnabled | occurs when microphone enable state changed | on("microphoneEnabled", evt) |
  145. * audioVolumeIndication | occurs when audio volume indication changed | on("audioVolumeIndication", evt) |
  146. * activeSpeaker | occurs when detect active speaker | on("activeSpeaker", evt) |
  147. * firstLocalAudioFrame | occurs when sent first audio frame on local | on("firstLocalAudioFrame", evt) |
  148. * firstRemoteAudioFrame | occurs when received first audio frame from remote side | on("firstRemoteAudioFrame", evt) |
  149. * firstRemoteAudioDecoded | occurs when first remote audio decoded | on("firstRemoteAudioDecoded", evt) |
  150. * firstLocalVideoFrame | occurs when sent first video frame on local | on("firstLocalVideoFrame", evt) |
  151. * firstRemoteVideoDecoded | occurs when received first video frame from remote side decoded | on("firstRemoteVideoDecoded", evt) |
  152. * firstRemoteVideoFrame | occurs when received first video frame from remote side | on("firstRemoteVideoFrame", evt) |
  153. * userMuteAudio | occurs when user mute audio | on("userMuteAudio", evt) |
  154. * userMuteVideo | occurs when user mute video | on("userMuteVideo", evt) |
  155. * userEnableVideo | occurs when remote side's user change video enable state | on("userEnableVideo", evt) |
  156. * userEnableLocalVideo | occurs when user change video enable state on local | on("userEnableLocalVideo", evt) |
  157. * videoSizeChanged | occurs when change local or remote side video size or rotation | on("videoSizeChanged", evt) |
  158. * remoteVideoStateChanged | occurs when remote video state has any changed | on("remoteVideoStateChanged", evt) |
  159. * localPublishFallbackToAudioOnly | occurs when published stream from local side fallback to audio stream | on("localPublishFallbackToAudioOnly", evt) |
  160. * remoteSubscribeFallbackToAudioOnly | occurs when subscribed side's stream fallback to audio stream | on("remoteSubscribeFallbackToAudioOnly", evt) |
  161. * audioRouteChanged | occurs when local audio route changed | on("audioRouteChanged", evt) |
  162. * cameraFocusAreaChanged | occurs when a camera focus area changed | on("cameraFocusAreaChanged", evt) |
  163. * cameraExposureAreaChanged | occurs when a camera exposure area changed | on("cameraExposureAreaChanged", evt) |
  164. * rtcStats | occurs when reports the statistics of the current call session once every two seconds. | on("rtcStats", evt) |
  165. * 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) |
  166. * networkQuality | occurs when reports the last mile network quality of each user in the channel once every two seconds.| on("networkQuality", evt) |
  167. * localVideoStats | occurs when reports local video statistics | on("localVideoStats", evt) |
  168. * remoteVideoStats | occurs when reports remote video statistics| on("remoteVideoStats", evt) |
  169. * remoteAudioStats | occurs when reports remote audio statistics| on("remoteAudioStats", evt) |
  170. * audioTransportStatsOfUid | occurs when reports transport-layer statistics of each remote audio stream. | on("audioTransportStatsOfUid", evt) |
  171. * videoTransportStatsOfUid | occurs when reports transport-layer statistics of each remote video stream.| on("videoTransportStatsOfUid", evt) |
  172. * audioEffectFinish | occurs when the local audio effect playback finishes. | on("audioEffectFinish", evt) |
  173. * streamPublished | occurs when addPublishStreamUrl success| on("streamPublished", evt) |
  174. * streamUnpublish | occurs when removePublishStreamUrl success| on("streamUnpublish", evt) |
  175. * transcodingUpdate | occurs when the cdn live streaming settings are updated | on("transcodingUpdate", evt) |
  176. * streamInjectedStatus | occurs when report the status of online injecting stream to a live broadcast | on("streamInjectedStatus", evt) |
  177. * mediaEngineLoaded | occurs when the media engine loaded | on("mediaEngineLoaded", evt) |
  178. * mediaEngineStartCall | occurs when the media engine call starts | on("mediaEngineStartCall", evt) |
  179. * startEchoTestWithInterval | occurs when startEchoTestWithInterval success | on("startEchoTestWithInterval", evt) |
  180. * audioMixingStateChanged | occurs when reports the local audio mixing state changed | on("audioMixingStateChanged", evt) |
  181. * lastmileProbeTestResult | occurs when reports the last-mile network probe result.| on("lastmileProbeTestResult", evt) |
  182. * rtmpStreamingStateChanged | occurs when reports the rtmp injecting stream state changed | on("rtmpStreamingStateChanged", evt) |
  183. * localVideoChanged | occurs when the local video changed | on("localVideoChanged", evt) |
  184. * networkTypeChanged | occurs when the device network type changed | on("networkTypeChanged", evt) |
  185. * mediaMetaDataReceived | occurs when you received media meta data from the remote side through sendMediaData | on("mediaMetaDataReceived", evt) |
  186. * localUserRegistered | occurs when you register user account success | on("localUserRegistered", evt) |
  187. * userInfoUpdated | occurs when you peer side using user account join channel | on("userInfoUpdated", evt) |
  188. * ---
  189. *
  190. * @param eventType
  191. * @param listener
  192. * @return any
  193. */
  194. static on(eventType, listener) {
  195. // convert int32 to uint32
  196. if ([
  197. 'joinChannelSuccess',
  198. 'rejoinChannelSuccess',
  199. 'userJoined',
  200. 'userOffline',
  201. 'occurStreamMessageError',
  202. 'receiveStreamMessage',
  203. 'activeSpeaker',
  204. 'firstRemoteAudioFrame',
  205. 'firstRemoteVideoDecoded',
  206. 'firstRemoteVideoFrame',
  207. 'userMuteAudio',
  208. 'userMuteVideo',
  209. 'userEnableVideo',
  210. 'userEnableLocalVideo',
  211. 'videoSizeChanged',
  212. 'firstRemoteAudioDecoded',
  213. 'remoteVideoStateChanged',
  214. 'remoteSubscribeFallbackToAudioOnly',
  215. 'networkQuality',
  216. 'streamInjectedStatus',
  217. 'localUserRegistered'
  218. ].indexOf(eventType) != -1) {
  219. AgoraEventEmitter.addListener(`${RtcEngine.AG_PREFIX}${eventType}`, (args) => {
  220. args.uid = this.Int32ToUint32(args.uid);
  221. // convert int32 streamId to uint32
  222. if (args.streamId) {
  223. args.streamId = this.Int32ToUint32(args.streamId);
  224. }
  225. listener(args);
  226. });
  227. return;
  228. }
  229. if (['userInfoUpdated'].indexOf(eventType) != -1) {
  230. AgoraEventEmitter.addListener(`${RtcEngine.AG_PREFIX}${eventType}`, (args) => {
  231. args.uid = this.Int32ToUint32(args.uid);
  232. args.peer.uid = this.Int32ToUint32(args.peer.uid);
  233. listener(args);
  234. });
  235. return;
  236. }
  237. if (['audioVolumeIndication'].indexOf(eventType) != -1) {
  238. AgoraEventEmitter.addListener(`${RtcEngine.AG_PREFIX}${eventType}`, (args) => {
  239. args.speakers.map((speaker) => {
  240. const uid = this.Int32ToUint32(speaker.uid);
  241. return Object.assign({}, speaker, { uid });
  242. });
  243. listener(args);
  244. });
  245. return;
  246. }
  247. if ([
  248. 'remoteAudioStats',
  249. 'remoteVideoStats',
  250. 'audioTransportStatsOfUid',
  251. 'videoTransportStatsOfUid',
  252. ].indexOf(eventType) != -1) {
  253. AgoraEventEmitter.addListener(`${RtcEngine.AG_PREFIX}${eventType}`, (args) => {
  254. args.stats.uid = this.Int32ToUint32(args.stats.uid);
  255. listener(args);
  256. });
  257. return;
  258. }
  259. AgoraEventEmitter.addListener(`${RtcEngine.AG_PREFIX}${eventType}`, listener);
  260. }
  261. /**
  262. * @deprecated removeAllListeners
  263. */
  264. static removeAllListeners() {
  265. console.warn("removeAllListeners method already deprecated");
  266. }
  267. /**
  268. * @deprecated off
  269. * @param mode
  270. */
  271. static off(evt) {
  272. console.warn("off method already deprecated");
  273. }
  274. /**
  275. * renew token
  276. *
  277. * This method renews a new token.
  278. * @param token
  279. */
  280. static renewToken(token) {
  281. return Agora.renewToken(token);
  282. }
  283. /**
  284. * enable websdk interoperability
  285. *
  286. * This method used to enable websdk interoperability, so that it can connect with agora websdk apps.
  287. *
  288. * @param enabled
  289. * @return Promise<{success, value}>
  290. */
  291. static enableWebSdkInteroperability(enabled) {
  292. return Agora.enableWebSdkInteroperability(enabled);
  293. }
  294. /**
  295. * get agora native sdk connection state
  296. *
  297. * This method gets agora native sdk connection state
  298. * @return Promise<{state: (connection state)}>
  299. */
  300. static getConnectionState() {
  301. return Agora.getConnectionState();
  302. }
  303. /**
  304. * change the client role
  305. *
  306. * This method changes the client of role.
  307. * @param role (audience: 0, host: 1)
  308. */
  309. static setClientRole(role) {
  310. return Agora.setClientRole(role);
  311. }
  312. /**
  313. * leave channel
  314. *
  315. * This method leaves the joined channel, then your video view will not render ever.
  316. * You should call it, when you dont need render video stream.
  317. *
  318. * @return Promise<null>
  319. */
  320. static leaveChannel() {
  321. return Agora.leaveChannel();
  322. }
  323. /**
  324. * destroy
  325. *
  326. * This method stops event subscribe and destroy the RtcEngine instance's.
  327. * You should call it, when you want to destroy the engine.
  328. *
  329. * @return void
  330. */
  331. static destroy() {
  332. return Agora.destroy();
  333. }
  334. /**
  335. * set local video render mode
  336. *
  337. * This method calls native sdk render mode for local video.
  338. * @param mode
  339. * @return Promise<any>
  340. */
  341. static setLocalRenderMode(mode) {
  342. return Agora.setLocalRenderMode(mode);
  343. }
  344. /**
  345. * set the specified remote video render mode
  346. *
  347. * This method calls native sdk render mode for the specified remote video.
  348. *
  349. * @param uid
  350. * @param mode
  351. * @return Promise<any>
  352. */
  353. static setRemoteRenderMode(uid, mode) {
  354. let uint32 = react_native_1.Platform.OS === 'android' ? this.Uint32ToInt32(uid) : uid;
  355. return Agora.setRemoteRenderMode(uint32, mode);
  356. }
  357. /**
  358. * start video preview
  359. *
  360. * This method start video preview for video.
  361. * @return Promise<any>
  362. */
  363. static startPreview() {
  364. return Agora.startPreview();
  365. }
  366. /**
  367. * stop video preview
  368. *
  369. * This method stops video preview for video.
  370. * @return Promise<any>
  371. */
  372. static stopPreview() {
  373. return Agora.stopPreview();
  374. }
  375. /**
  376. * set enable speaker phone
  377. *
  378. * This method set the speaker phone enable or disable by pass boolean parameter.
  379. * @param enabled
  380. * @return Promise<any>
  381. */
  382. static setEnableSpeakerphone(enabled) {
  383. return Agora.setEnableSpeakerphone(enabled);
  384. }
  385. /**
  386. * set default audio speaker
  387. *
  388. * This method set the default audio speaker enable or disable by pass boolean parameter.
  389. * @param enabled
  390. * @return Promise<any>
  391. */
  392. static setDefaultAudioRouteToSpeakerphone(enabled) {
  393. return Agora.setDefaultAudioRouteToSpeakerphone(enabled);
  394. }
  395. /**
  396. * set default mute all remote audio streams
  397. *
  398. * This method set default mute all remote audio streams enable or not by pass boolean parameter.
  399. * @param enabled
  400. * @return Promise<any>
  401. */
  402. static setDefaultMuteAllRemoteAudioStreams(enabled) {
  403. return Agora.setDefaultMuteAllRemoteAudioStreams(enabled);
  404. }
  405. /**
  406. * enable video
  407. *
  408. * This method enables video.
  409. * @return Promise<any>
  410. */
  411. static enableVideo() {
  412. return Agora.enableVideo();
  413. }
  414. /**
  415. * disable video
  416. *
  417. * This method disables video.
  418. * @return Promise<any>
  419. */
  420. static disableVideo() {
  421. return Agora.disableVideo();
  422. }
  423. /**
  424. * enable local video
  425. *
  426. * This method enables the local video by the boolean parameter.
  427. * @param enabled
  428. * @return Promise<any>
  429. */
  430. static enableLocalVideo(enabled) {
  431. return Agora.enableLocalVideo(enabled);
  432. }
  433. /**
  434. * mute local video stream
  435. *
  436. * This method mutes video stream by the boolean parameter.
  437. * @param muted
  438. * @return Promise<any>
  439. */
  440. static muteLocalVideoStream(muted) {
  441. return Agora.muteLocalVideoStream(muted);
  442. }
  443. /**
  444. * mute all remote video streams
  445. *
  446. * This method mutes all remote streams by the boolean parameter.
  447. * @param muted
  448. * @return Promise<any>
  449. */
  450. static muteAllRemoteVideoStreams(muted) {
  451. return Agora.muteAllRemoteVideoStreams(muted);
  452. }
  453. /**
  454. * @ignore Uint32ToInt32
  455. */
  456. static Uint32ToInt32(num) {
  457. const int32 = new Int32Array(1);
  458. int32[0] = num;
  459. return int32[0];
  460. }
  461. /**
  462. * @ignore Int32ToUint32
  463. */
  464. static Int32ToUint32(num) {
  465. const uint32 = new Uint32Array(1);
  466. uint32[0] = num;
  467. return uint32[0];
  468. }
  469. /**
  470. * mute specified remote video stream.
  471. *
  472. * This method mutes remote video stream by the number of uid and boolean parameter.
  473. * @param uid
  474. * @param muted
  475. * @return Promise<any>
  476. */
  477. static muteRemoteVideoStream(uid, muted) {
  478. let uint32 = react_native_1.Platform.OS === 'android' ? this.Uint32ToInt32(uid) : uid;
  479. return Agora.muteRemoteVideoStream(uint32, muted);
  480. }
  481. /**
  482. * set default mute all remote video stream
  483. *
  484. * This method mutes all remote video stream default by the boolean parameter.
  485. * @param muted
  486. * @return Promise<any>
  487. */
  488. static setDefaultMuteAllRemoteVideoStreams(muted) {
  489. return Agora.setDefaultMuteAllRemoteVideoStreams(muted);
  490. }
  491. /**
  492. * enable audio
  493. *
  494. * This method enables audio
  495. * @return Promise<any>
  496. */
  497. static enableAudio() {
  498. return Agora.enableAudio();
  499. }
  500. /**
  501. * disable audio
  502. *
  503. * This method disables audio
  504. * @return Promise<any>
  505. */
  506. static disableAudio() {
  507. return Agora.disableAudio();
  508. }
  509. /**
  510. * enable local audio
  511. *
  512. * This method enables local audio by the boolean parameter.
  513. * @param enabled
  514. * @return Promise<any>
  515. */
  516. static enableLocalAudio(enabled) {
  517. return Agora.enableLocalAudio(enabled);
  518. }
  519. /**
  520. * mute local audio stream
  521. *
  522. * This method mutes the local audio stream by muted.
  523. * @param muted
  524. * @return Promise<any>
  525. */
  526. static disableLocalAudio(muted) {
  527. return Agora.disableLocalAudio(muted);
  528. }
  529. /**
  530. * mute all remote audio streams
  531. *
  532. * This method mutes all remote audio streams by muted
  533. * @param muted boolean
  534. * @return Promise<any>
  535. */
  536. static muteAllRemoteAudioStreams(muted) {
  537. return Agora.muteAllRemoteAudioStreams(muted);
  538. }
  539. /**
  540. * mute specified remote audio stream by muted
  541. *
  542. * This method mutes specified remote audio stream by number uid and boolean muted.
  543. * @param uid
  544. * @param muted
  545. * @return Promise<any>
  546. */
  547. static muteRemoteAudioStream(uid, muted) {
  548. let uint32 = react_native_1.Platform.OS === 'android' ? this.Uint32ToInt32(uid) : uid;
  549. return Agora.muteRemoteAudioStream(uint32, muted);
  550. }
  551. /**
  552. * adjust recording signal volume
  553. *
  554. * This method adjusts recording your signal by volume.
  555. * @param volume
  556. * @return Promise<any>
  557. */
  558. static adjustRecordingSignalVolume(volume) {
  559. return Agora.adjustRecordingSignalVolume(volume);
  560. }
  561. /**
  562. * adjust playback signal volume
  563. *
  564. * This method adjusts playback signal by volume.
  565. * @param volume
  566. * @return Promise<any>
  567. */
  568. static adjustPlaybackSignalVolume(volume) {
  569. return Agora.adjustPlaybackSignalVolume(volume);
  570. }
  571. /**
  572. * enable audio volume indication
  573. *
  574. * This method enables audio volume by interval and smooth
  575. * @param interval
  576. * @param smooth
  577. * @return Promise<any>
  578. */
  579. static enableAudioVolumeIndication(interval, smooth) {
  580. return Agora.enableAudioVolumeIndication(interval, smooth);
  581. }
  582. /**
  583. * check for mobile phone speaker enabled
  584. *
  585. * This method checks the phone speaker is enabled
  586. * @param callback
  587. * @return any
  588. */
  589. static methodisSpeakerphoneEnabled(callback) {
  590. return Agora.methodisSpeakerphoneEnabled(callback);
  591. }
  592. /**
  593. * enable in-ear monitor
  594. *
  595. * This method enables in-ear monitoring by boolean parameter enabled
  596. *
  597. * @param enabled
  598. * @return Promise<any>
  599. */
  600. static enableInEarMonitoring(enabled) {
  601. return Agora.enableInEarMonitoring(enabled);
  602. }
  603. /**
  604. * set in-ear monitoring volume
  605. *
  606. * This method sets the in-ear-monitoring volume by number parameter volume
  607. *
  608. * @param volume
  609. * @return Promise<any>
  610. */
  611. static setInEarMonitoringVolume(volume) {
  612. return Agora.setInEarMonitoringVolume(volume);
  613. }
  614. /**
  615. * set local voice pitch
  616. *
  617. * This method sets the local voice pitch by float parameter pitch
  618. *
  619. * @param pitch
  620. * @return Promise<any>
  621. */
  622. static setLocalVoicePitch(pitch) {
  623. return Agora.setLocalVoicePitch(pitch);
  624. }
  625. /**
  626. * set local voice equalization
  627. *
  628. * This method set local video equalization of band frequency by enum band number and number of gain
  629. *
  630. * @param band
  631. * @param gain
  632. * @return Promise<any>
  633. */
  634. static setLocalVoiceEqualization(band, gain) {
  635. Agora.setLocalVoiceEqualization(band, gain);
  636. }
  637. /**
  638. * set local voice reverb
  639. *
  640. * This method sets local voice by reverb and value
  641. * @param reverb
  642. * @param value
  643. */
  644. static setLocalVoiceReverb(reverb, value) {
  645. Agora.setLocalVoiceReverb(reverb, value);
  646. }
  647. /**
  648. * start audio mixing
  649. *
  650. * This method will start audio mixing by option config
  651. *
  652. * @param options {@link AudioMixingOption}
  653. */
  654. static startAudioMixing(options) {
  655. Agora.startAudioMixing(options);
  656. }
  657. /**
  658. * stop audio mixing
  659. *
  660. * This methods stops for audio mixing.
  661. */
  662. static stopAudioMixing() {
  663. Agora.stopAudioMixing();
  664. }
  665. /**
  666. * pause audio mixing
  667. *
  668. * This method pauses for audio mixing.
  669. */
  670. static pauseAudioMixing() {
  671. Agora.pauseAudioMixing();
  672. }
  673. /**
  674. * resume audio mixing
  675. *
  676. * This method resumes for audio mixing.
  677. */
  678. static resumeAudioMixing() {
  679. Agora.resumeAudioMixing();
  680. }
  681. /**
  682. * adjust audio mixing volume
  683. *
  684. * This method adjusts audio mixing volume by the volume number parameter
  685. * @param volume
  686. */
  687. static adjustAudioMixingVolume(volume) {
  688. Agora.adjustAudioMixingVolume(volume);
  689. }
  690. /**
  691. * adjust audio mixing playout volume
  692. *
  693. * This method adjusts audio mixing playout by the volume parameter
  694. * @param volume
  695. */
  696. static adjustAudioMixingPlayoutVolume(volume) {
  697. Agora.adjustAudioMixingPlayoutVolume(volume);
  698. }
  699. /**
  700. * adjust audio mixing publish volume
  701. *
  702. * This method adjusts audio mixing publish by the volume paraemter
  703. * @param volume
  704. */
  705. static adjustAudioMixingPublishVolume(volume) {
  706. Agora.adjustAudioMixingPublishVolume(volume);
  707. }
  708. /**
  709. * get audio mixing duration
  710. *
  711. * This method gets the audio mixing duration
  712. * @return Promise<{success, value}>
  713. */
  714. static getAudioMixingDuration() {
  715. return Agora.getAudioMixingDuration();
  716. }
  717. /**
  718. * get audio mixing current position
  719. *
  720. * This method gets audio mixing current position value.
  721. * @return Promise<{success, value}>
  722. */
  723. static getAudioMixingCurrentPosition() {
  724. return Agora.getAudioMixingCurrentPosition();
  725. }
  726. /**
  727. * set audio mixing position
  728. *
  729. * This method sets audio mixing position by the parameter pos
  730. * @param pos
  731. */
  732. static setAudioMixingPosition(pos) {
  733. return Agora.setAudioMixingPosition(pos);
  734. }
  735. /**
  736. * get effects of volume
  737. *
  738. * This methods get audio mixing effects volume value.
  739. * @return Promise<{success, value}>
  740. */
  741. static getEffectsVolume() {
  742. return Agora.getEffectsVolume();
  743. }
  744. /**
  745. * set effects volume
  746. *
  747. * This methods set audio mixing effects volume by float parameter.
  748. * @param volume
  749. * @return Promise<{success, value}>
  750. */
  751. static setEffectsVolume(volume) {
  752. return Agora.setEffectsVolume(volume);
  753. }
  754. /**
  755. * set volume for playing effects.
  756. *
  757. * This methods set for playing audio mixing effects
  758. * @return Promise<{success, value}>
  759. */
  760. static setVolumeOfEffect(volume) {
  761. return Agora.setVolumeOfEffect(volume);
  762. }
  763. /**
  764. * play specified effect for audio mixing
  765. *
  766. * This methos plays the specified effect of audio mixing file by option config.
  767. * @param options {@link PlayEffectOption}
  768. * @return Promise<{success, value}>
  769. */
  770. static playEffect(options) {
  771. return Agora.playEffect(options);
  772. }
  773. /**
  774. * stop play effect for audio mixing
  775. *
  776. * This methods stops the specified effect for audio mixing file by soundid.
  777. * @param sounid
  778. * @return Promise<{success, value}>
  779. */
  780. static stopEffect(soundId) {
  781. return Agora.stopEffect(soundId);
  782. }
  783. /**
  784. * stop play all for effect audio mixing.
  785. *
  786. * This methods stops all effect audio mixing.
  787. * @return Promise<{success, value}>
  788. */
  789. static stopAllEffects() {
  790. return Agora.stopAllEffects();
  791. }
  792. /**
  793. * preload effect for audio mixing file.
  794. *
  795. * This methods preloads the specified audio mixing file to memory by the soundid
  796. * @param soundid
  797. * @param filepath
  798. * @return Promise<{success, value}>
  799. */
  800. static preloadEffect(soundId, filepath) {
  801. return Agora.preloadEffect(soundId, filepath);
  802. }
  803. /**
  804. * unload effect
  805. *
  806. * This methods unload the already loaded audio mixing file from memory by the soundid.
  807. * @param soundid
  808. * @return Promise<{success, value}>
  809. */
  810. static unloadEffect(soundId) {
  811. return Agora.unloadEffect(soundId);
  812. }
  813. /**
  814. * pause the specified effect for audio mixing by soundid
  815. *
  816. * This method pauses the specified effect for audio mixing by soundid.
  817. * @param soundid
  818. * @return Promise<{success, value}>
  819. */
  820. static pauseEffect(soundId) {
  821. return Agora.pauseEffect(soundId);
  822. }
  823. /**
  824. * pause all effects for audio mixing
  825. *
  826. * This method pause all effects for audio mixing.
  827. * @param soundid
  828. * @return Promise<{success, value}>
  829. */
  830. static pauseAllEffects() {
  831. return Agora.pauseAllEffects();
  832. }
  833. /**
  834. * resume audio mixing effect by the specified soundid
  835. *
  836. * This method resumes audio mixing effect by the specified soundid
  837. * @param soundid
  838. * @return Promise<{success, value}>
  839. */
  840. static resumeEffect(soundId) {
  841. return Agora.resumeEffect(soundId);
  842. }
  843. /**
  844. * resume all audio mixing effects.
  845. *
  846. * This method resumes all audio mixing effects.
  847. * @return Promise<{success, value}>
  848. */
  849. static resumeAllEffects() {
  850. return Agora.resumeAllEffects();
  851. }
  852. /**
  853. * start audio recording by quality
  854. *
  855. * This method start audio recording by quality config
  856. * @param options {@link AudioRecordingOption}
  857. * @return Promise<{success, value}>
  858. */
  859. static startAudioRecording(options) {
  860. return Agora.startAudioRecording(options);
  861. }
  862. /**
  863. * stop audio recording
  864. *
  865. * This method stops audio recording.
  866. * @return Promise<{success, value}>
  867. */
  868. static stopAudioRecording() {
  869. return Agora.stopAudioRecording();
  870. }
  871. /**
  872. * set audio session operation restriction
  873. *
  874. * 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.
  875. * You can call this method at any time to return the control of the audio sessions to the SDK.
  876. * 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.
  877. * @notice iOS support only
  878. */
  879. static setAudioSessionOperationRestriction() {
  880. if (react_native_1.Platform.OS != 'ios')
  881. throw Error(`setAudioSessionOperationRestriction is not support on your platform. Please check the details in react-native-agora docs`);
  882. Agora.setAudioSessionOperationRestriction();
  883. }
  884. /**
  885. * @deprecated startEchoTest
  886. * startEchoTest
  887. */
  888. /**
  889. * @deprecated isCameraAutoFocusFaceModeSupported
  890. * @deprecated isCameraExposurePositionSupported
  891. * @deprecated isCameraFocusSupported
  892. * @deprecated isCameraTorchSupported
  893. * @deprecated isCameraZoomSupported
  894. * instead use {@method getCameraInfo}
  895. */
  896. /**
  897. * stop echo test
  898. *
  899. * This method stop launched an audio call test.
  900. * @return Promise<{success, value}>
  901. */
  902. static stopEchoTest() {
  903. return Agora.stopEchoTest();
  904. }
  905. /**
  906. * enable lastmile test
  907. *
  908. * This method enables the network connection qualit test.
  909. *
  910. * @return Promise<{success, value}>
  911. */
  912. static enableLastmileTest() {
  913. return Agora.enableLastmileTest();
  914. }
  915. /**
  916. * disable lastmile test
  917. *
  918. * This method disable the network connection qualit test.
  919. *
  920. * @return Promise<{success, value}>
  921. */
  922. static disableLastmileTest() {
  923. return Agora.disableLastmileTest();
  924. }
  925. /**
  926. * set recording audio frame parameters
  927. *
  928. * This method Sets the audio recording format for the audioFrame callback.
  929. *
  930. * @param options {@link RecordingAudioFrameOption}
  931. * @return Promise<{success, value}>
  932. */
  933. static setRecordingAudioFrameParameters(options) {
  934. return Agora.setRecordingAudioFrameParameters(options);
  935. }
  936. /**
  937. * set playback audio frame parameters
  938. *
  939. * This method Sets the audio frame format for the playbackFrame callback.
  940. *
  941. * @param options {@link AudioFrameOption}
  942. * @return Promise<{success, value}>
  943. */
  944. static setPlaybackAudioFrameParameters(options) {
  945. return Agora.setPlaybackAudioFrameParameters(options);
  946. }
  947. /**
  948. * set mixed audio frame parameters
  949. *
  950. * This method Sets the audio frame format for the mixedAudioFrame callback.
  951. *
  952. * @param options {@link MixedAudioFrameOption}
  953. * @return Promise<{success, value}>
  954. */
  955. static setMixedAudioFrameParameters(options) {
  956. return Agora.setMixedAudioFrameParameters(options);
  957. }
  958. /**
  959. * add video watermark
  960. *
  961. * This method adds video watermark to the local video.
  962. *
  963. * @param options {@link ImageOption}
  964. * @return Promise<{success, value}>
  965. */
  966. static addVideoWatermark(options) {
  967. return Agora.addVideoWatermark(options);
  968. }
  969. /**
  970. * clear video watermarks
  971. *
  972. * This method removes the watermark image from the video stream added by addVideoWatermark.
  973. *
  974. * @return Promise<{success, value}>
  975. */
  976. static removclearVideoWatermarkse() {
  977. return Agora.clearVideoWatermarks();
  978. }
  979. /**
  980. * set local publish fallback
  981. *
  982. * This method sets the fallback option for the locally published video stream based on the network conditions.
  983. *
  984. * @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)
  985. * @return Promise<{success, value}>
  986. */
  987. static setLocalPublishFallbackOption(option) {
  988. return Agora.setLocalPublishFallbackOption(option);
  989. }
  990. /**
  991. * set remote publish fallback
  992. *
  993. * This method sets the fallback option for the remotely subscribed video stream based on the network conditions.
  994. *
  995. * @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)
  996. * @return Promise<{success, value}>
  997. */
  998. static setRemoteSubscribeFallbackOption(option) {
  999. return Agora.setRemoteSubscribeFallbackOption(option);
  1000. }
  1001. /**
  1002. * enable dual stream mode
  1003. *
  1004. * This method enables the dual stream by parameter mode.
  1005. *
  1006. * @param enabled
  1007. * @return Promise<{success, value}>
  1008. */
  1009. static enableDualStreamMode(enabled) {
  1010. return Agora.enableDualStreamMode(enabled);
  1011. }
  1012. /**
  1013. * set remote video stream type
  1014. *
  1015. * This method sets the remote video stream type by uid and streamType.
  1016. *
  1017. * @param options {@link VideoStreamOption}
  1018. * @return Promise<{success, value}>
  1019. */
  1020. static setRemoteVideoStreamType(options) {
  1021. return Agora.setRemoteVideoStreamType(options);
  1022. }
  1023. /**
  1024. * set remote default video stream type
  1025. *
  1026. * This method sets the default video stream type.
  1027. *
  1028. * @param options {@link DefaultVideoStreamOption}
  1029. * @return Promise<{success, value}>
  1030. */
  1031. static setRemoteDefaultVideoStreamType(options) {
  1032. return Agora.setRemoteDefaultVideoStreamType(options);
  1033. }
  1034. /**
  1035. * add inject stream url
  1036. *
  1037. * This method injects an online media stream to a live broadcast.
  1038. *
  1039. * @param options {@link InjectStreamOption}
  1040. * @return Promise<{success, value}>
  1041. */
  1042. static addInjectStreamUrl(options) {
  1043. return Agora.addInjectStreamUrl(options);
  1044. }
  1045. /**
  1046. * remove inject stream url
  1047. *
  1048. * This method removes stream by addInjectsStreamUrl.
  1049. *
  1050. * @param options {@link RemoveInjectStreamOption}
  1051. * @return Promise<{success, value}>
  1052. */
  1053. static removeInjectStreamUrl(options) {
  1054. return Agora.removeInjectStreamUrl(options);
  1055. }
  1056. /**
  1057. * @deprecated sendMessage
  1058. * sendMessage
  1059. */
  1060. static sendMessage() {
  1061. return tslib_1.__awaiter(this, void 0, void 0, function* () {
  1062. return console.warn("sendMessage already deprecated");
  1063. });
  1064. }
  1065. /**
  1066. * @deprecated createDataStream
  1067. * createDataStream
  1068. */
  1069. /**
  1070. * @deprecated setupLocalVideo
  1071. * setupLocalVideo
  1072. */
  1073. /**
  1074. * @deprecated setupRemoteVideo
  1075. * setupRemoteVideo
  1076. */
  1077. /**
  1078. * @deprecated setVideoQualityParameters
  1079. * setVideoQualityParameters
  1080. */
  1081. /**
  1082. * set local video mirror mode
  1083. *
  1084. * This method sets local video mirror mode
  1085. *
  1086. * @param mode
  1087. * @return Promise<{success, value}>
  1088. */
  1089. static setLocalVideoMirrorMode(mode) {
  1090. return Agora.setLocalVideoMirrorMode(mode);
  1091. }
  1092. /**
  1093. * switch camera
  1094. *
  1095. * This method switches camera between front and rear.
  1096. *
  1097. * @return Promise<{success, value}>
  1098. */
  1099. static switchCamera() {
  1100. return Agora.switchCamera();
  1101. }
  1102. /**
  1103. * set camera zoom ratio
  1104. *
  1105. * This method sets the camera zoom ratio.
  1106. *
  1107. * @param zoomFactor
  1108. * @return Promise<{success, value}>
  1109. */
  1110. static setCameraZoomFactor(zoomFactor) {
  1111. return Agora.setCameraZoomFactor(zoomFactor);
  1112. }
  1113. /**
  1114. * get camera max zoom ratio
  1115. *
  1116. * This method gets the camera maximum zoom ratio.
  1117. *
  1118. * @notice Android Only
  1119. * @return Promise<{success, value}>
  1120. */
  1121. static getCameraMaxZoomFactor() {
  1122. return Agora.getCameraMaxZoomFactor();
  1123. }
  1124. /**
  1125. * set camera focus position in preview
  1126. *
  1127. * This method sets the mannual focus position.
  1128. *
  1129. * @param options {@link PositionOption}
  1130. * @return Promise<{success, value}>
  1131. */
  1132. static setCameraFocusPositionInPreview(options) {
  1133. return Agora.setCameraFocusPositionInPreview(options);
  1134. }
  1135. /**
  1136. * set camera exposure position
  1137. *
  1138. * This method sets the mannual exposure position.
  1139. *
  1140. * @param options {@link PositionOption}
  1141. * @return Promise<{success, value}>
  1142. */
  1143. static setCameraExposurePosition(options) {
  1144. return Agora.setCameraExposurePosition(options);
  1145. }
  1146. /**
  1147. * set camera torch on
  1148. *
  1149. * This method enables the camera flash function.
  1150. *
  1151. * @param enabled
  1152. * @return Promise<{success, value}>
  1153. */
  1154. static setCameraTorchOn(enabled) {
  1155. return Agora.setCameraTorchOn(enabled);
  1156. }
  1157. /**
  1158. * set enable auto focus face mode
  1159. *
  1160. * This method enables auto-focus face mode function.
  1161. *
  1162. * @param enabled boolean
  1163. * @return Promise<{success, value}>
  1164. */
  1165. static setCameraAutoFocusFaceModeEnabled(enabled) {
  1166. return Agora.setCameraAutoFocusFaceModeEnabled(enabled);
  1167. }
  1168. /**
  1169. * get call id
  1170. *
  1171. * This method is used to get call id.
  1172. *
  1173. * @return Promise<{success, value}>
  1174. */
  1175. static getCallId() {
  1176. return Agora.getCallId();
  1177. }
  1178. /**
  1179. * set log file and log filter
  1180. *
  1181. * This method sets the log file generated path and specified the log level.
  1182. *
  1183. * @param filepath string
  1184. * @param level enum
  1185. * @param maxfileSize integer (KB)
  1186. * @return Promise<{success, value}>
  1187. */
  1188. static setLog(filepath, level, maxfileSize) {
  1189. return Agora.setLog(filepath, level, maxfileSize);
  1190. }
  1191. /**
  1192. * add publish stream url
  1193. *
  1194. * This method add publish stream by option.
  1195. *
  1196. * @param options {@link PublishStreamOption}
  1197. * @return Promise<{success, value}>
  1198. */
  1199. static addPublishStreamUrl(options) {
  1200. return Agora.addPublishStreamUrl(options);
  1201. }
  1202. /**
  1203. * remove publish stream url
  1204. *
  1205. * This method remove publish stream by options.
  1206. *
  1207. * @param options {@link RemovePublishStreamOption}
  1208. * @return Promise<{success, value}>
  1209. */
  1210. static removePublishStreamUrl(options) {
  1211. return Agora.removePublishStreamUrl(options);
  1212. }
  1213. /**
  1214. * set live transcoding
  1215. *
  1216. * This method sets the video layout and audio settings for CDN live.
  1217. *
  1218. * @param options {@link LiveTranscoding}
  1219. * @return Promise<{success, value}>
  1220. */
  1221. static setLiveTranscoding(options) {
  1222. return Agora.setLiveTranscoding(options);
  1223. }
  1224. /**
  1225. * get sdk version
  1226. *
  1227. * This method gets the sdk version details and passed it into callback function
  1228. *
  1229. * @param callback to handle resolve from getSdkVersion
  1230. * @param errorHandler to handle reject error from getSdkVersion
  1231. * @return any
  1232. */
  1233. static getSdkVersion(callback, errorHandler) {
  1234. return Agora.getSdkVersion().then(callback).catch(errorHandler);
  1235. }
  1236. /**
  1237. * mute local audio stream
  1238. *
  1239. * This method sends/stops sending the local audio.
  1240. *
  1241. * @param enabled
  1242. * @return Promise<any>
  1243. */
  1244. static muteLocalAudioStream(enabled) {
  1245. return Agora.muteLocalAudioStream(enabled);
  1246. }
  1247. /**
  1248. * video pre-process/post-process
  1249. *
  1250. * This method enables/disables image enhancement and sets the options.
  1251. *
  1252. * @param enable boolean
  1253. * @param options {@link BeautyOptions}
  1254. * @return Promise<any>
  1255. */
  1256. static setBeautyEffectOptions(enabled, options) {
  1257. return Agora.setBeautyEffectOptions(enabled, options);
  1258. }
  1259. /**
  1260. * set local voice change
  1261. *
  1262. * This method changes local speaker voice with voiceChanger
  1263. *
  1264. * @param voiceChanger integer
  1265. * @voiceChanger value ranges [
  1266. * 0: "The original voice",
  1267. * 1: "An old man’s voice",
  1268. * 2: "A little boy’s voice.",
  1269. * 3: "A little girl’s voice.",
  1270. * 4: "TBD",
  1271. * 5: "Ethereal vocal effects.",
  1272. * 6: "Hulk’s voice."
  1273. * ]
  1274. * @return Promise<any>
  1275. */
  1276. static setLocalVoiceChanger(voiceChanger) {
  1277. return Agora.setLocalVoiceChanger(voiceChanger);
  1278. }
  1279. /**
  1280. * set the preset local voice reverberation effect.
  1281. *
  1282. * This method sets the preset local voice reverberation effect.
  1283. *
  1284. * @param preset integer
  1285. * @return Promise<any>
  1286. */
  1287. static setLocalVoiceReverbPreset(preset) {
  1288. return Agora.setLocalVoiceReverbPreset(preset);
  1289. }
  1290. /**
  1291. * control stereo panning for remote users
  1292. *
  1293. * This method enables/disables stereo panning for remote users.
  1294. *
  1295. * @param enabled boolean
  1296. * @return Promise<any>
  1297. */
  1298. static enableSoundPositionIndication(enabled) {
  1299. return Agora.enableSoundPositionIndication(enabled);
  1300. }
  1301. /**
  1302. * set the sound position of a remote user
  1303. *
  1304. * This method sets the sound position of a remote user by uid
  1305. *
  1306. * @param uid number | The ID of the remote user
  1307. * @param pan float | The sound position of the remote user. The value ranges from -1.0 to 1.0
  1308. * @pan
  1309. * 0.0: the remote sound comes from the front.
  1310. * -1.0: the remote sound comes from the left.
  1311. * 1.0: the remote sound comes from the right.
  1312. * @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.
  1313. * @return Promise<any>
  1314. */
  1315. static setRemoteVoicePosition(uid, pan, gain) {
  1316. let uint32 = react_native_1.Platform.OS === 'android' ? this.Uint32ToInt32(uid) : uid;
  1317. return Agora.setRemoteVoicePosition(uint32, pan, gain);
  1318. }
  1319. /**
  1320. * start the lastmile probe test
  1321. *
  1322. * 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).
  1323. *
  1324. * @param config LastmileProbeConfig {@link LastmileProbeConfig}
  1325. *
  1326. * 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.
  1327. * 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.
  1328. * @return Promise<any>
  1329. */
  1330. static startLastmileProbeTest(config) {
  1331. return Agora.startLastmileProbeTest(config);
  1332. }
  1333. /**
  1334. * stop the lastmile probe test
  1335. *
  1336. * This method stop the lastmile probe test.
  1337. *
  1338. * @return Promise<any>
  1339. */
  1340. static stopLastmileProbeTest() {
  1341. return Agora.stopLastmileProbeTest();
  1342. }
  1343. /**
  1344. * sets the priority of a remote user's media stream.
  1345. *
  1346. * 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.
  1347. *
  1348. * This method sets the priority of a remote user's media stream.
  1349. * @param uid number
  1350. * @param userPriority number | The value range is [50 is "user's priority is hgih", 100 is "the default user's priority is normal"]
  1351. *
  1352. * @return Promise<any>
  1353. */
  1354. static setRemoteUserPriority(uid, userPrority) {
  1355. let uint32 = react_native_1.Platform.OS === 'android' ? this.Uint32ToInt32(uid) : uid;
  1356. return Agora.setRemoteUserPriority(uint32, userPrority);
  1357. }
  1358. /**
  1359. * start an audio call test.
  1360. *
  1361. * note:
  1362. * Call this method before joining a channel.
  1363. * 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.
  1364. * In the Live-broadcast profile, only a host can call this method.
  1365. * This method will start an audio call test with interval parameter.
  1366. * 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.
  1367. *
  1368. * @param interval number
  1369. *
  1370. * @return Promise<any>
  1371. */
  1372. static startEchoTestWithInterval(interval) {
  1373. return Agora.startEchoTestWithInterval(interval);
  1374. }
  1375. /**
  1376. * set the camera capture preference.
  1377. *
  1378. * note:
  1379. * 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:
  1380. * 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.
  1381. * 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.
  1382. * If you want better quality for the local video preview, we recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PREVIEW(2).
  1383. *
  1384. * This method will set the camera capture preference.
  1385. *
  1386. * @param config {@link CameraCapturerConfiguration}
  1387. *
  1388. * @return Promise<any>
  1389. */
  1390. static setCameraCapturerConfiguration(config) {
  1391. return Agora.setCameraCapturerConfiguration(config);
  1392. }
  1393. /**
  1394. * Gets the audio mixing volume for local playback.
  1395. *
  1396. * note:
  1397. * This method helps troubleshoot audio volume related issues.
  1398. *
  1399. * @return Promise<any>
  1400. */
  1401. static getAudioMixingPlayoutVolume() {
  1402. return Agora.getAudioMixingPlayoutVolume();
  1403. }
  1404. /**
  1405. * Gets the audio mixing volume for publishing.
  1406. *
  1407. * note:
  1408. * This method helps troubleshoot audio volume related issues.
  1409. *
  1410. * @return Promise<any>
  1411. */
  1412. static getAudioMixingPublishVolume() {
  1413. return Agora.getAudioMixingPublishVolume();
  1414. }
  1415. /**
  1416. * sendMediaData for media observer.
  1417. *
  1418. * note:
  1419. * This method needs you invoke registerMediaMetadataObserver success first and you could send media data through interval media observer feature.
  1420. * The data have limit length is 1024 bytes, if you pass data length bigger than limit it will failed.
  1421. * @param data String: 1024 bytes limit
  1422. * @return Promise<any>
  1423. */
  1424. static sendMediaData(data) {
  1425. return Agora.sendMediaData(data);
  1426. }
  1427. /**
  1428. * Registers the metadata observer.
  1429. *
  1430. * note:
  1431. * This method only work in live mode
  1432. * 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.
  1433. * This method trigger 'mediaMetaDataReceived' event, here is example:
  1434. * ```javascript
  1435. * RtcEngine.on("mediaMetaDataReceived", (data) => {
  1436. * console.log("mediaMetaDataReceived", data);
  1437. * })
  1438. * ```
  1439. * @return Promise<any>
  1440. */
  1441. static registerMediaMetadataObserver() {
  1442. return Agora.registerMediaMetadataObserver();
  1443. }
  1444. /**
  1445. * Get local device camera support info
  1446. *
  1447. * note:
  1448. * This method returns your current device camera support info.
  1449. * ```javascript
  1450. * RtcEngine.getCameraInfo().then(info => {
  1451. * console.log("your currrent camera", info);
  1452. * })
  1453. * ```
  1454. * @return Promise{cameraSupportInfo}>
  1455. */
  1456. static getCameraInfo() {
  1457. return tslib_1.__awaiter(this, void 0, void 0, function* () {
  1458. return Agora.getCameraInfo();
  1459. });
  1460. }
  1461. }
  1462. /**
  1463. * @ignore AG_PREFIX
  1464. */
  1465. RtcEngine.AG_PREFIX = 'ag_rtc';
  1466. exports.default = RtcEngine;
  1467. //# sourceMappingURL=RtcEngine.native.js.map