Geen omschrijving

RtcEngine.native.js 48KB

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