Sin descripción

RtcEngine.native.js 36KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const react_native_1 = require("react-native");
  4. const { Agora } = react_native_1.NativeModules;
  5. const AgoraEventEmitter = new react_native_1.NativeEventEmitter(Agora);
  6. /**
  7. * RtcEngine is the javascript object for control agora native sdk through react native bridge.
  8. *
  9. * You can use the RtcEngine methods to create {@link init}
  10. *
  11. * Other methods of the RtcEngine object serve for agora native sdk and set up error logging.
  12. */
  13. class RtcEngine {
  14. /**
  15. * Creates a RtcEngine Object internal.
  16. *
  17. * This method creates and start event observer. You should call this method once.
  18. * @example `RtcEngine.init(option)`
  19. * @param options Defines the property of the client, see {@link Option} for details.
  20. */
  21. static init(options) {
  22. Agora.init(options);
  23. }
  24. /**
  25. * join specified channel
  26. *
  27. * This method joins and begin rendering the video stream. when join succeeds.
  28. * Otherwise, it will invoke error by the event
  29. * @param channelName
  30. * @param uid
  31. * @param token
  32. * @param info
  33. */
  34. static joinChannel(channelName, uid, token, info) {
  35. return Agora.joinChannel({ channelName, uid, token, info });
  36. }
  37. /**
  38. * add event listener
  39. *
  40. * This method subscribes specified eventType and run listener. You should call this method at first.
  41. * @param eventType
  42. * @param listener
  43. */
  44. static on(eventType, listener) {
  45. this.eventTypes.add(eventType);
  46. AgoraEventEmitter.addListener(eventType, listener);
  47. }
  48. /**
  49. * remove event listeners
  50. *
  51. * This method unsubscribes specified eventType related all listeners. You should call this method when you want to unsubscribe some eventType.
  52. * @param eventType
  53. */
  54. static off(eventType) {
  55. AgoraEventEmitter.removeAllListeners(eventType);
  56. this.eventTypes.delete(eventType);
  57. }
  58. /**
  59. * remove all events listeners
  60. *
  61. * This method unsubscribes all eventTypes related listeners.
  62. *
  63. * @param token
  64. */
  65. static removeAllListeners() {
  66. for (let eventType of this.eventTypes) {
  67. AgoraEventEmitter.removeAllListeners(eventType);
  68. }
  69. this.eventTypes.clear();
  70. }
  71. /**
  72. * renew token
  73. *
  74. * This method renews a new token.
  75. * @param token
  76. */
  77. static renewToken(token) {
  78. return Agora.renewToken(token);
  79. }
  80. /**
  81. * enable websdk interoperability
  82. *
  83. * This method used to enable websdk interoperability, so that it can connect with agora websdk apps.
  84. *
  85. * @param enabled
  86. * @returns Promise<{success, value}>
  87. */
  88. static enableWebSdkInteroperability(enabled) {
  89. return Agora.enableWebSdkInteroperability(enabled);
  90. }
  91. /**
  92. * get agora native sdk connection state
  93. *
  94. * This method gets agora native sdk connection state
  95. * @returns Promise<{success: true, state: (connection state)}>
  96. */
  97. static getConnectionState() {
  98. return Agora.getConnectionState();
  99. }
  100. /**
  101. * change the client role
  102. *
  103. * This method changes the client of role.
  104. * @param role (audience: 0, host: 1)
  105. */
  106. static setClientRole(role) {
  107. Agora.setClientRole(role);
  108. }
  109. /**
  110. * leave channel
  111. *
  112. * This method leaves the joined channel, then your video view will not render ever.
  113. * You should call it, when you dont need render video stream.
  114. *
  115. * @returns Promise<{success, value}>
  116. */
  117. static leaveChannel() {
  118. return Agora.leaveChannel();
  119. }
  120. /**
  121. * destroy
  122. *
  123. * This method stops event subscribe and destroy the RtcEngine instance's.
  124. * You should call it, when you want to destroy the engine.
  125. *
  126. * @returns Promise<{success, value}>
  127. */
  128. static destroy() {
  129. return Agora.destroy();
  130. }
  131. /**
  132. * show local video
  133. *
  134. * This method calls native sdk render canvas for local video.
  135. * @param options {@link VideoOption}
  136. */
  137. static setupLocalVideo(options) {
  138. Agora.setupLocalVideo(options);
  139. }
  140. /**
  141. * show remote video
  142. *
  143. * This method calls native sdk render canvas for remote video.
  144. * @param options {@link VideoOption}
  145. */
  146. static setupRemoteVideo(options) {
  147. Agora.setupRemoteVideo(options);
  148. }
  149. /**
  150. * set local video render mode
  151. *
  152. * This method calls native sdk render mode for local video.
  153. * @param mode
  154. */
  155. static setLocalRenderMode(mode) {
  156. Agora.setLocalRenderMode(mode);
  157. }
  158. /**
  159. * set the specified remote video render mode
  160. *
  161. * This method calls native sdk render mode for the specified remote video.
  162. *
  163. * @param uid
  164. * @param mode
  165. */
  166. static setRemoteRenderMode(uid, mode) {
  167. Agora.setRemoteRenderMode(uid, mode);
  168. }
  169. /**
  170. * start video preview
  171. *
  172. * This method start video preview for video.
  173. */
  174. static startPreview() {
  175. Agora.startPreview();
  176. }
  177. /**
  178. * stop video preview
  179. *
  180. * This method stops video preview for video.
  181. */
  182. static stopPreview() {
  183. Agora.stopPreview();
  184. }
  185. /**
  186. * set enable speaker phone
  187. *
  188. * This method set the speaker phone enable or disable by pass boolean parameter.
  189. * @param enabled
  190. */
  191. static setEnableSpeakerphone(enabled) {
  192. Agora.setEnableSpeakerphone(enabled);
  193. }
  194. /**
  195. * set default audio speaker
  196. *
  197. * This method set the default audio speaker enable or disable by pass boolean parameter.
  198. * @param enabled
  199. */
  200. static setDefaultAudioRouteToSpeakerphone(enabled) {
  201. Agora.setDefaultAudioRouteToSpeakerphone(enabled);
  202. }
  203. /**
  204. * set default mute all remote audio streams
  205. *
  206. * This method set default mute all remote audio streams enable or not by pass boolean parameter.
  207. * @param enabled
  208. */
  209. static setDefaultMuteAllRemoteAudioStreams(enabled) {
  210. Agora.setDefaultMuteAllRemoteAudioStreams(enabled);
  211. }
  212. /**
  213. * enable video
  214. *
  215. * This method enables video.
  216. */
  217. static enableVideo() {
  218. Agora.enableVideo();
  219. }
  220. /**
  221. * disable video
  222. *
  223. * This method disables video.
  224. */
  225. static disableVideo() {
  226. Agora.disableVideo();
  227. }
  228. /**
  229. * enable local video
  230. *
  231. * This method enables the local video by the boolean parameter.
  232. * @param enabled
  233. */
  234. static enableLocalVideo(enabled) {
  235. Agora.enableLocalVideo(enabled);
  236. }
  237. /**
  238. * mute local video stream
  239. *
  240. * This method mutes video stream by the boolean parameter.
  241. * @param muted
  242. */
  243. static muteLocalVideoStream(muted) {
  244. Agora.muteLocalVideoStream(muted);
  245. }
  246. /**
  247. * mute all remote video streams
  248. *
  249. * This method mutes all remote streams by the boolean parameter.
  250. * @param muted
  251. */
  252. static muteAllRemoteVideoStreams(muted) {
  253. Agora.muteAllRemoteVideoStreams(muted);
  254. }
  255. /**
  256. * mute specified remote video stream.
  257. *
  258. * This method mutes remote video stream by the number of uid and boolean parameter.
  259. * @param uid
  260. * @param muted
  261. */
  262. static muteRemoteVideoStream(uid, muted) {
  263. Agora.muteRemoteVideoStream(uid, muted);
  264. }
  265. /**
  266. * set default mute all remote video stream
  267. *
  268. * This method mutes all remote video stream default by the boolean parameter.
  269. * @param muted
  270. */
  271. static setDefaultMuteAllRemoteVideoStreams(muted) {
  272. Agora.setDefaultMuteAllRemoteVideoStreams(muted);
  273. }
  274. /**
  275. * enable audio
  276. *
  277. * This method enables audio
  278. */
  279. static enableAudio() {
  280. Agora.enableAudio();
  281. }
  282. /**
  283. * disable audio
  284. *
  285. * This method disables audio
  286. */
  287. static disableAudio() {
  288. Agora.disableAudio();
  289. }
  290. /**
  291. * enable local audio
  292. *
  293. * This method enables local audio by the boolean parameter.
  294. * @param enabled
  295. */
  296. static enableLocalAudio(enabled) {
  297. Agora.enableLocalAudio(enabled);
  298. }
  299. /**
  300. * mute local audio stream
  301. *
  302. * This method mutes the local audio stream by muted.
  303. * @param muted
  304. */
  305. static disableLocalAudio(muted) {
  306. Agora.disableLocalAudio(muted);
  307. }
  308. /**
  309. * mute all remote audio streams
  310. *
  311. * This method mutes all remote audio streams by muted
  312. */
  313. static muteAllRemoteAudioStreams(muted) {
  314. Agora.muteAllRemoteAudioStreams(muted);
  315. }
  316. /**
  317. * mute specified remote audio stream by muted
  318. *
  319. * This method mutes specified remote audio stream by number uid and boolean muted.
  320. * @param uid
  321. * @param muted
  322. */
  323. static muteRemoteAudioStream(uid, muted) {
  324. Agora.muteRemoteAudioStream(uid, muted);
  325. }
  326. /**
  327. * adjust recording signal volume
  328. *
  329. * This method adjusts recording your signal by volume.
  330. * @param volume
  331. */
  332. static adjustRecordingSignalVolume(volume) {
  333. Agora.adjustRecordingSignalVolume(volume);
  334. }
  335. /**
  336. * adjust playback signal volume
  337. *
  338. * This method adjusts playback signal by volume.
  339. * @param volume
  340. */
  341. static adjustPlaybackSignalVolume(volume) {
  342. Agora.adjustPlaybackSignalVolume(volume);
  343. }
  344. /**
  345. * enable audio volume indication
  346. *
  347. * This method enables audio volume by interval and smooth
  348. * @param interval
  349. * @param smooth
  350. */
  351. static enableAudioVolumeIndication(interval, smooth) {
  352. Agora.enableAudioVolumeIndication(interval, smooth);
  353. }
  354. /**
  355. * create data stream
  356. *
  357. * This method creates data stream with options
  358. *
  359. * @param options {@link DataStreamOption}
  360. */
  361. static createDataStream(options) {
  362. return Agora.createDataStream(options);
  363. }
  364. /**
  365. * check for mobile phone speaker enabled
  366. *
  367. * This method checks the phone speaker is enabled
  368. * @param callback
  369. */
  370. static methodisSpeakerphoneEnabled(callback) {
  371. Agora.methodisSpeakerphoneEnabled(callback);
  372. }
  373. /**
  374. * enable in-ear monitor
  375. *
  376. * This method enables in-ear monitoring by boolean parameter enabled
  377. *
  378. * @param enabled
  379. */
  380. static enableInEarMonitoring(enabled) {
  381. Agora.enableInEarMonitoring(enabled);
  382. }
  383. /**
  384. * set in-ear monitoring volume
  385. *
  386. * This method sets the in-ear-monitoring volume by number parameter volume
  387. *
  388. * @param volume
  389. */
  390. static setInEarMonitoringVolume(volume) {
  391. Agora.setInEarMonitoringVolume(volume);
  392. }
  393. /**
  394. * set local voice pitch
  395. *
  396. * This method sets the local voice pitch by float parameter pitch
  397. *
  398. * @param pitch
  399. */
  400. static setLocalVoicePitch(pitch) {
  401. Agora.setLocalVoicePitch(pitch);
  402. }
  403. /**
  404. * set local voice equalization
  405. *
  406. * This method set local video equalization of band frequency by enum band number and number of gain
  407. *
  408. * @param band
  409. * @param gain
  410. */
  411. static setLocalVoiceEqualization(band, gain) {
  412. Agora.setLocalVoiceEqualization(band, gain);
  413. }
  414. /**
  415. * set local voice reverb
  416. *
  417. * This method sets local voice by reverb and value
  418. * @param reverb
  419. * @param value
  420. */
  421. static setLocalVoiceReverb(reverb, value) {
  422. Agora.setLocalVoiceReverb(reverb, value);
  423. }
  424. /**
  425. * start audio mixing
  426. *
  427. * This method will start audio mixing by option config
  428. *
  429. * @param options {@link AudioMixingOption}
  430. */
  431. static startAudioMixing(options) {
  432. Agora.startAudioMixing(options);
  433. }
  434. /**
  435. * stop audio mixing
  436. *
  437. * This methods stops for audio mixing.
  438. */
  439. static stopAudioMixing() {
  440. Agora.stopAudioMixing();
  441. }
  442. /**
  443. * pause audio mixing
  444. *
  445. * This method pauses for audio mixing.
  446. */
  447. static pauseAudioMixing() {
  448. Agora.pauseAudioMixing();
  449. }
  450. /**
  451. * resume audio mixing
  452. *
  453. * This method resumes for audio mixing.
  454. */
  455. static resumeAudioMixing() {
  456. Agora.resumeAudioMixing();
  457. }
  458. /**
  459. * adjust audio mixing volume
  460. *
  461. * This method adjusts audio mixing volume by the volume number parameter
  462. * @param volume
  463. */
  464. static adjustAudioMixingVolume(volume) {
  465. Agora.adjustAudioMixingVolume(volume);
  466. }
  467. /**
  468. * adjust audio mixing playout volume
  469. *
  470. * This method adjusts audio mixing playout by the volume parameter
  471. * @param volume
  472. */
  473. static adjustAudioMixingPlayoutVolume(volume) {
  474. Agora.adjustAudioMixingPlayoutVolume(volume);
  475. }
  476. /**
  477. * adjust audio mixing publish volume
  478. *
  479. * This method adjusts audio mixing publish by the volume paraemter
  480. * @param volume
  481. */
  482. static adjustAudioMixingPublishVolume(volume) {
  483. Agora.adjustAudioMixingPublishVolume(volume);
  484. }
  485. /**
  486. * get audio mixing duration
  487. *
  488. * This method gets the audio mixing duration
  489. * @returns Promise<{success, value}>
  490. */
  491. static getAudioMixingDuration() {
  492. return Agora.getAudioMixingDuration();
  493. }
  494. /**
  495. * get audio mixing current position
  496. *
  497. * This method gets audio mixing current position value.
  498. * @returns Promise<{success, value}>
  499. */
  500. static getAudioMixingCurrentPosition() {
  501. return Agora.getAudioMixingCurrentPosition();
  502. }
  503. /**
  504. * set audio mixing position
  505. *
  506. * This method sets audio mixing position by the parameter pos
  507. * @param pos
  508. */
  509. static setAudioMixingPosition(pos) {
  510. return Agora.setAudioMixingPosition(pos);
  511. }
  512. /**
  513. * get effects of volume
  514. *
  515. * This methods get audio mixing effects volume value.
  516. * @returns Promise<{success, value}>
  517. */
  518. static getEffectsVolume() {
  519. return Agora.getEffectsVolume();
  520. }
  521. /**
  522. * set effects volume
  523. *
  524. * This methods set audio mixing effects volume by float parameter.
  525. * @param volume
  526. * @returns Promise<{success, value}>
  527. */
  528. static setEffectsVolume(volume) {
  529. return Agora.setEffectsVolume(volume);
  530. }
  531. /**
  532. * set volume for playing effects.
  533. *
  534. * This methods set for playing audio mixing effects
  535. * @returns Promise<{success, value}>
  536. */
  537. static setVolumeOfEffect(volume) {
  538. return Agora.setVolumeOfEffect(volume);
  539. }
  540. /**
  541. * play specified effect for audio mixing
  542. *
  543. * This methos plays the specified effect of audio mixing file by option config.
  544. * @param options {@link PlayEffectOption}
  545. * @returns Promise<{success, value}>
  546. */
  547. static playEffect(options) {
  548. return Agora.playEffect(options);
  549. }
  550. /**
  551. * stop play effect for audio mixing
  552. *
  553. * This methods stops the specified effect for audio mixing file by soundid.
  554. * @param sounid
  555. * @returns Promise<{success, value}>
  556. */
  557. static stopEffect(soundId) {
  558. return Agora.stopEffect(soundId);
  559. }
  560. /**
  561. * stop play all for effect audio mixing.
  562. *
  563. * This methods stops all effect audio mixing.
  564. * @returns Promise<{success, value}>
  565. */
  566. static stopAllEffects() {
  567. return Agora.stopAllEffects();
  568. }
  569. /**
  570. * preload effect for audio mixing file.
  571. *
  572. * This methods preloads the specified audio mixing file to memory by the soundid
  573. * @param soundid
  574. * @param filepath
  575. * @returns Promise<{success, value}>
  576. */
  577. static preloadEffect(soundId, filepath) {
  578. return Agora.preloadEffect(soundId, filepath);
  579. }
  580. /**
  581. * unload effect
  582. *
  583. * This methods unload the already loaded audio mixing file from memory by the soundid.
  584. * @param soundid
  585. * @returns Promise<{success, value}>
  586. */
  587. static unloadEffect(soundId) {
  588. return Agora.unloadEffect(soundId);
  589. }
  590. /**
  591. * pause the specified effect for audio mixing by soundid
  592. *
  593. * This method pauses the specified effect for audio mixing by soundid.
  594. * @param soundid
  595. * @returns Promise<{success, value}>
  596. */
  597. static pauseEffect(soundId) {
  598. return Agora.pauseEffect(soundId);
  599. }
  600. /**
  601. * pause all effects for audio mixing
  602. *
  603. * This method pause all effects for audio mixing.
  604. * @param soundid
  605. * @returns Promise<{success, value}>
  606. */
  607. static pauseAllEffects() {
  608. return Agora.pauseAllEffects();
  609. }
  610. /**
  611. * resume audio mixing effect by the specified soundid
  612. *
  613. * This method resumes audio mixing effect by the specified soundid
  614. * @param soundid
  615. * @returns Promise<{success, value}>
  616. */
  617. static resumeEffect(soundId) {
  618. return Agora.resumeEffect(soundId);
  619. }
  620. /**
  621. * resume all audio mixing effects.
  622. *
  623. * This method resumes all audio mixing effects.
  624. * @returns Promise<{success, value}>
  625. */
  626. static resumeAllEffects() {
  627. return Agora.resumeAllEffects();
  628. }
  629. /**
  630. * start audio recording by quality
  631. *
  632. * This method start audio recording by quality config
  633. * @param options {@link AudioRecordingOption}
  634. * @returns Promise<{success, value}>
  635. */
  636. static startAudioRecording(options) {
  637. return Agora.startAudioRecording(options);
  638. }
  639. /**
  640. * stop audio recording
  641. *
  642. * This method stops audio recording.
  643. * @returns Promise<{success, value}>
  644. */
  645. static stopAudioRecording() {
  646. return Agora.stopAudioRecording();
  647. }
  648. /**
  649. * set audio session operation restriction
  650. *
  651. * 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.
  652. * You can call this method at any time to return the control of the audio sessions to the SDK.
  653. * 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.
  654. * @notice iOS support only
  655. */
  656. static setAudioSessionOperationRestriction() {
  657. if (react_native_1.Platform.OS != 'ios')
  658. throw Error(`setAudioSessionOperationRestriction is not support on your platform. Please check the details in react-native-agora docs`);
  659. Agora.setAudioSessionOperationRestriction();
  660. }
  661. /**
  662. * start echo test
  663. *
  664. * This method launches an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly.
  665. * @returns Promise<{success, value}>
  666. */
  667. static startEchoTest() {
  668. return Agora.startEchoTest();
  669. }
  670. /**
  671. * stop echo test
  672. *
  673. * This method stop launched an audio call test.
  674. * @returns Promise<{success, value}>
  675. */
  676. static stopEchoTest() {
  677. return Agora.stopEchoTest();
  678. }
  679. /**
  680. * enable lastmile test
  681. *
  682. * This method enables the network connection qualit test.
  683. *
  684. * @returns Promise<{success, value}>
  685. */
  686. static enableLastmileTest() {
  687. return Agora.enableLastmileTest();
  688. }
  689. /**
  690. * disable lastmile test
  691. *
  692. * This method disable the network connection qualit test.
  693. *
  694. * @returns Promise<{success, value}>
  695. */
  696. static disableLastmileTest() {
  697. return Agora.disableLastmileTest();
  698. }
  699. /**
  700. * set recording audio frame parameters
  701. *
  702. * This method Sets the audio recording format for the audioFrame callback.
  703. *
  704. * @param options {@link RecordingAudioFrameOption}
  705. * @returns Promise<{success, value}>
  706. */
  707. static setRecordingAudioFrameParameters(options) {
  708. return Agora.setRecordingAudioFrameParameters(options);
  709. }
  710. /**
  711. * set playback audio frame parameters
  712. *
  713. * This method Sets the audio frame format for the playbackFrame callback.
  714. *
  715. * @param options {@link AudioFrameOption}
  716. * @returns Promise<{success, value}>
  717. */
  718. static setPlaybackAudioFrameParameters(options) {
  719. return Agora.setPlaybackAudioFrameParameters(options);
  720. }
  721. /**
  722. * set mixed audio frame parameters
  723. *
  724. * This method Sets the audio frame format for the mixedAudioFrame callback.
  725. *
  726. * @param options {@link MixedAudioFrameOption}
  727. * @returns Promise<{success, value}>
  728. */
  729. static setMixedAudioFrameParameters(options) {
  730. return Agora.setMixedAudioFrameParameters(options);
  731. }
  732. /**
  733. * add video watermark
  734. *
  735. * This method adds video watermark to the local video.
  736. *
  737. * @param options {@link ImageOption}
  738. * @returns Promise<{success, value}>
  739. */
  740. static addVideoWatermark(options) {
  741. return Agora.addVideoWatermark(options);
  742. }
  743. /**
  744. * clear video watermarks
  745. *
  746. * This method removes the watermark image from the video stream added by addVideoWatermark.
  747. *
  748. * @returns Promise<{success, value}>
  749. */
  750. static removclearVideoWatermarkse() {
  751. return Agora.clearVideoWatermarks();
  752. }
  753. /**
  754. * set local publish fallback
  755. *
  756. * This method sets the fallback option for the locally published video stream based on the network conditions.
  757. *
  758. * @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)
  759. * @returns Promise<{success, value}>
  760. */
  761. static setLocalPublishFallbackOption(option) {
  762. return Agora.setLocalPublishFallbackOption(option);
  763. }
  764. /**
  765. * set remote publish fallback
  766. *
  767. * This method sets the fallback option for the remotely subscribed video stream based on the network conditions.
  768. *
  769. * @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)
  770. * @returns Promise<{success, value}>
  771. */
  772. static setRemoteSubscribeFallbackOption(option) {
  773. return Agora.setRemoteSubscribeFallbackOption(option);
  774. }
  775. /**
  776. * enable dual stream mode
  777. *
  778. * This method enables the dual stream by parameter mode.
  779. *
  780. * @param enabled
  781. * @returns Promise<{success, value}>
  782. */
  783. static enableDualStreamMode(enabled) {
  784. return Agora.enableDualStreamMode(enabled);
  785. }
  786. /**
  787. * set remote video stream type
  788. *
  789. * This method sets the remote video stream type by uid and streamType.
  790. *
  791. * @param options {@link VideoStreamOption}
  792. * @returns Promise<{success, value}>
  793. */
  794. static setRemoteVideoStreamType(options) {
  795. return Agora.setRemoteVideoStreamType(options);
  796. }
  797. /**
  798. * set remote default video stream type
  799. *
  800. * This method sets the default video stream type.
  801. *
  802. * @param options {@link DefaultVideoStreamOption}
  803. * @returns Promise<{success, value}>
  804. */
  805. static setRemoteDefaultVideoStreamType(options) {
  806. return Agora.setRemoteDefaultVideoStreamType(options);
  807. }
  808. /**
  809. * add inject stream url
  810. *
  811. * This method injects an online media stream to a live broadcast.
  812. *
  813. * @param options {@link InjectStreamOption}
  814. * @returns Promise<{success, value}>
  815. */
  816. static addInjectStreamUrl(options) {
  817. return Agora.addInjectStreamUrl(options);
  818. }
  819. /**
  820. * remove inject stream url
  821. *
  822. * This method removes stream by addInjectsStreamUrl.
  823. *
  824. * @param options {@link RemoveInjectStreamOption}
  825. * @returns Promise<{success, value}>
  826. */
  827. static removeInjectStreamUrl(options) {
  828. return Agora.removeInjectStreamUrl(options);
  829. }
  830. /**
  831. * set video quality
  832. *
  833. * This method sets the preferences for the video quality. (Live broadcast only).
  834. *
  835. * @param quality boolean
  836. * @returns Promise<{success, value}>
  837. */
  838. static setVideoQualityParameters(quality) {
  839. return Agora.setVideoQualityParameters(quality);
  840. }
  841. /**
  842. * set local video mirror mode
  843. *
  844. * This method sets local video mirror mode
  845. *
  846. * @param mode
  847. * @returns Promise<{success, value}>
  848. */
  849. static setLocalVideoMirrorMode(mode) {
  850. return Agora.setLocalVideoMirrorMode(mode);
  851. }
  852. /**
  853. * switch camera
  854. *
  855. * This method switches camera between front and rear.
  856. *
  857. * @returns Promise<{success, value}>
  858. */
  859. static switchCamera() {
  860. return Agora.switchCamera();
  861. }
  862. /**
  863. * is camera zoom supported
  864. *
  865. * This method checks whether the camera zoom function is supported.
  866. *
  867. * @returns Promise<{success, value}>
  868. */
  869. static isCameraZoomSupported() {
  870. return Agora.isCameraZoomSupported();
  871. }
  872. /**
  873. * is camera torch supported
  874. *
  875. * This method checks whether the camera flash function is supported.
  876. *
  877. * @returns Promise<{success, value}>
  878. */
  879. static isCameraTorchSupported() {
  880. return Agora.isCameraTorchSupported();
  881. }
  882. /**
  883. * is camera focus supported
  884. *
  885. * This method checks whether the camera mannual focus function is supported.
  886. *
  887. * @returns Promise<{success, value}>
  888. */
  889. static isCameraFocusSupported() {
  890. return Agora.isCameraFocusSupported();
  891. }
  892. /**
  893. * is camera exposure position supported
  894. *
  895. * This method checks whether the camera mannual exposure function is supported.
  896. *
  897. * @returns Promise<{success, value}>
  898. */
  899. static isCameraExposurePositionSupported() {
  900. return Agora.isCameraExposurePositionSupported();
  901. }
  902. /**
  903. * is camera auto focus face mode supported
  904. *
  905. * This method checks whether the camera mannual auto-face focus function is supported.
  906. *
  907. * @returns Promise<{success, value}>
  908. */
  909. static isCameraAutoFocusFaceModeSupported() {
  910. return Agora.isCameraAutoFocusFaceModeSupported();
  911. }
  912. /**
  913. * set camera zoom ratio
  914. *
  915. * This method sets the camera zoom ratio.
  916. *
  917. * @param zoomFactor
  918. * @returns Promise<{success, value}>
  919. */
  920. static setCameraZoomFactor(zoomFactor) {
  921. return Agora.setCameraZoomFactor(zoomFactor);
  922. }
  923. /**
  924. * get camera max zoom ratio
  925. *
  926. * This method gets the camera maximum zoom ratio.
  927. *
  928. * @notice Android Only
  929. * @returns Promise<{success, value}>
  930. */
  931. static getCameraMaxZoomFactor() {
  932. return Agora.getCameraMaxZoomFactor();
  933. }
  934. /**
  935. * set camera focus position in preview
  936. *
  937. * This method sets the mannual focus position.
  938. *
  939. * @param options {@link PositionOption}
  940. * @returns Promise<{success, value}>
  941. */
  942. static setCameraFocusPositionInPreview(options) {
  943. return Agora.setCameraFocusPositionInPreview(options);
  944. }
  945. /**
  946. * set camera exposure position
  947. *
  948. * This method sets the mannual exposure position.
  949. *
  950. * @param options {@link PositionOption}
  951. * @returns Promise<{success, value}>
  952. */
  953. static setCameraExposurePosition(options) {
  954. return Agora.setCameraExposurePosition(options);
  955. }
  956. /**
  957. * set camera torch on
  958. *
  959. * This method enables the camera flash function.
  960. *
  961. * @param enabled
  962. * @returns Promise<{success, value}>
  963. */
  964. static setCameraTorchOn(enabled) {
  965. return Agora.setCameraTorchOn(enabled);
  966. }
  967. /**
  968. * set enable auto focus face mode
  969. *
  970. * This method enables auto-focus face mode function.
  971. *
  972. * @param enabled boolean
  973. * @returns Promise<{success, value}>
  974. */
  975. static setCameraAutoFocusFaceModeEnabled(enabled) {
  976. return Agora.setCameraAutoFocusFaceModeEnabled(enabled);
  977. }
  978. /**
  979. * get call id
  980. *
  981. * This method is used to get call id.
  982. *
  983. * @returns Promise<{success, value}>
  984. */
  985. static getCallId() {
  986. return Agora.getCallId();
  987. }
  988. /**
  989. * set log file and log filter
  990. *
  991. * This method sets the log file generated path and specified the log level.
  992. *
  993. * @param filepath
  994. * @param level
  995. * @returns Promise<{success, value}>
  996. */
  997. static setLog(filepath, level) {
  998. return Agora.setLog(filepath, level);
  999. }
  1000. /**
  1001. * send stream message
  1002. *
  1003. * This method sends stream message by specified uid
  1004. *
  1005. * @param uid
  1006. * @param data
  1007. * @returns Promise<{success, value}>
  1008. */
  1009. static sendMessage(streamID, data, reliable, ordered) {
  1010. return Agora.sendMessage({ streamID, data, reliable, ordered });
  1011. }
  1012. /**
  1013. * add publish stream url
  1014. *
  1015. * This method add publish stream by option.
  1016. *
  1017. * @param options {@link PublishStreamOption}
  1018. * @returns Promise<{success, value}>
  1019. */
  1020. static addPublishStreamUrl(options) {
  1021. return Agora.addPublishStreamUrl(options);
  1022. }
  1023. /**
  1024. * remove publish stream url
  1025. *
  1026. * This method remove publish stream by options.
  1027. *
  1028. * @param options {@link RemovePublishStreamOption}
  1029. * @returns Promise<{success, value}>
  1030. */
  1031. static removePublishStreamUrl(options) {
  1032. return Agora.removePublishStreamUrl(options);
  1033. }
  1034. /**
  1035. * set live transcoding
  1036. *
  1037. * This method sets the video layout and audio settings for CDN live.
  1038. *
  1039. * @param options {@link LiveTranscoding}
  1040. * @returns Promise<{success, value}>
  1041. */
  1042. static setLiveTranscoding(options) {
  1043. return Agora.setLiveTranscoding(options);
  1044. }
  1045. /**
  1046. * get sdk version
  1047. *
  1048. * This method gets the sdk version details and passed it into callback function
  1049. *
  1050. * @param callback to handle resolve from getSdkVersion
  1051. * @param errorHandler to handle reject error from getSdkVersion
  1052. */
  1053. static getSdkVersion(callback, errorHandler) {
  1054. return Agora.getSdkVersion().then(callback).catch(errorHandler);
  1055. }
  1056. /**
  1057. * mute local audio stream
  1058. *
  1059. * This method sends/stops sending the local audio.
  1060. *
  1061. * @param enabled
  1062. */
  1063. static muteLocalAudioStream(enabled) {
  1064. Agora.muteLocalAudioStream(enabled);
  1065. }
  1066. /**
  1067. * video pre-process/post-process
  1068. *
  1069. * This method enables/disables image enhancement and sets the options.
  1070. *
  1071. * @param enable boolean
  1072. * @param options {@link BeautyOptions}
  1073. * @returns operate result boolean
  1074. */
  1075. static setBeautyEffectOptions(enabled, options) {
  1076. return Agora.setBeautyEffectOptions(enabled, options);
  1077. }
  1078. /**
  1079. * set local voice change
  1080. *
  1081. * This method changes local speaker voice with voiceChanger
  1082. *
  1083. * @param voiceChanger integer
  1084. * @voiceChanger value ranges [
  1085. * 0: "The original voice",
  1086. * 1: "An old man’s voice",
  1087. * 2: "A little boy’s voice.",
  1088. * 3: "A little girl’s voice.",
  1089. * 4: "TBD",
  1090. * 5: "Ethereal vocal effects.",
  1091. * 6: "Hulk’s voice."
  1092. * ]
  1093. * @returns result boolean
  1094. */
  1095. static setLocalVoiceChanger(voiceChanger) {
  1096. return Agora.setLocalVoiceChanger(voiceChanger);
  1097. }
  1098. /**
  1099. * set the preset local voice reverberation effect.
  1100. *
  1101. * This method sets the preset local voice reverberation effect.
  1102. *
  1103. * @param preset integer
  1104. * @returns result boolean
  1105. */
  1106. static setLocalVoiceReverbPreset(preset) {
  1107. return Agora.setLocalVoiceReverbPreset(preset);
  1108. }
  1109. /**
  1110. * control stereo panning for remote users
  1111. *
  1112. * This method enables/disables stereo panning for remote users.
  1113. *
  1114. * @param enabled boolean
  1115. * @returns result boolean
  1116. */
  1117. static enableSoundPositionIndication(enabled) {
  1118. return Agora.enableSoundPositionIndication(enabled);
  1119. }
  1120. /**
  1121. * set the sound position of a remote user
  1122. *
  1123. * This method sets the sound position of a remote user by uid
  1124. *
  1125. * @param uid number | The ID of the remote user
  1126. * @param pan float | The sound position of the remote user. The value ranges from -1.0 to 1.0
  1127. * @pan
  1128. * 0.0: the remote sound comes from the front.
  1129. * -1.0: the remote sound comes from the left.
  1130. * 1.0: the remote sound comes from the right.
  1131. * @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.
  1132. * @returns result boolean
  1133. */
  1134. static setRemoteVoicePosition(uid, pan, gain) {
  1135. return Agora.setRemoteVoicePosition(uid, pan, gain);
  1136. }
  1137. /**
  1138. * start the lastmile probe test
  1139. *
  1140. * 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).
  1141. *
  1142. * @param config LastmileProbeConfig {@link LastmileProbeConfig}
  1143. *
  1144. * @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.
  1145. * @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.
  1146. * @returns result boolean
  1147. */
  1148. static startLastmileProbeTest(config) {
  1149. return Agora.startLastmileProbeTest(config);
  1150. }
  1151. /**
  1152. * stop the lastmile probe test
  1153. *
  1154. * This method stop the lastmile probe test.
  1155. *
  1156. * @returns result boolean
  1157. */
  1158. static stopLastmileProbeTest() {
  1159. return Agora.stopLastmileProbeTest();
  1160. }
  1161. /**
  1162. * sets the priority of a remote user's media stream.
  1163. *
  1164. * 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.
  1165. *
  1166. * This method sets the priority of a remote user's media stream.
  1167. * @param uid number
  1168. * @param userPriority number | The value range is [50 is "user's priority is hgih", 100 is "the default user's priority is normal"]
  1169. *
  1170. * @returns result boolean
  1171. */
  1172. static setRemoteUserPriority(uid, userPrority) {
  1173. return Agora.setRemoteUserPriority(uid, userPrority);
  1174. }
  1175. /**
  1176. * start an audio call test.
  1177. *
  1178. * note:
  1179. * Call this method before joining a channel.
  1180. * 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.
  1181. * In the Live-broadcast profile, only a host can call this method.
  1182. * This method will start an audio call test with interval parameter.
  1183. * 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.
  1184. *
  1185. * @param interval number
  1186. *
  1187. * @returns result boolean
  1188. */
  1189. static startEchoTestWithInterval(interval) {
  1190. return Agora.startEchoTestWithInterval(interval);
  1191. }
  1192. /**
  1193. * set the camera capture preference.
  1194. *
  1195. * note:
  1196. * 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:
  1197. * 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.
  1198. * 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.
  1199. * If you want better quality for the local video preview, we recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PREVIEW(2).
  1200. *
  1201. * This method will set the camera capture preference.
  1202. *
  1203. * @param config {@link CameraCapturerConfiguration}
  1204. *
  1205. * @returns result boolean
  1206. */
  1207. static setCameraCapturerConfiguration(config) {
  1208. return Agora.setCameraCapturerConfiguration(config);
  1209. }
  1210. }
  1211. RtcEngine.eventTypes = new Set();
  1212. exports.default = RtcEngine;
  1213. //# sourceMappingURL=RtcEngine.native.js.map