No Description

RtcEngine.native.js 52KB

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