No Description

RtcEngine.native.js 37KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216
  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. * @deprecated
  663. * start echo test
  664. *
  665. * 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.
  666. * @returns Promise<{success, value}>
  667. */
  668. // public static startEchoTest(): Promise<any> {
  669. // return Agora.startEchoTest();
  670. // }
  671. /**
  672. * stop echo test
  673. *
  674. * This method stop launched an audio call test.
  675. * @returns Promise<{success, value}>
  676. */
  677. static stopEchoTest() {
  678. return Agora.stopEchoTest();
  679. }
  680. /**
  681. * enable lastmile test
  682. *
  683. * This method enables the network connection qualit test.
  684. *
  685. * @returns Promise<{success, value}>
  686. */
  687. static enableLastmileTest() {
  688. return Agora.enableLastmileTest();
  689. }
  690. /**
  691. * disable lastmile test
  692. *
  693. * This method disable the network connection qualit test.
  694. *
  695. * @returns Promise<{success, value}>
  696. */
  697. static disableLastmileTest() {
  698. return Agora.disableLastmileTest();
  699. }
  700. /**
  701. * set recording audio frame parameters
  702. *
  703. * This method Sets the audio recording format for the audioFrame callback.
  704. *
  705. * @param options {@link RecordingAudioFrameOption}
  706. * @returns Promise<{success, value}>
  707. */
  708. static setRecordingAudioFrameParameters(options) {
  709. return Agora.setRecordingAudioFrameParameters(options);
  710. }
  711. /**
  712. * set playback audio frame parameters
  713. *
  714. * This method Sets the audio frame format for the playbackFrame callback.
  715. *
  716. * @param options {@link AudioFrameOption}
  717. * @returns Promise<{success, value}>
  718. */
  719. static setPlaybackAudioFrameParameters(options) {
  720. return Agora.setPlaybackAudioFrameParameters(options);
  721. }
  722. /**
  723. * set mixed audio frame parameters
  724. *
  725. * This method Sets the audio frame format for the mixedAudioFrame callback.
  726. *
  727. * @param options {@link MixedAudioFrameOption}
  728. * @returns Promise<{success, value}>
  729. */
  730. static setMixedAudioFrameParameters(options) {
  731. return Agora.setMixedAudioFrameParameters(options);
  732. }
  733. /**
  734. * add video watermark
  735. *
  736. * This method adds video watermark to the local video.
  737. *
  738. * @param options {@link ImageOption}
  739. * @returns Promise<{success, value}>
  740. */
  741. static addVideoWatermark(options) {
  742. return Agora.addVideoWatermark(options);
  743. }
  744. /**
  745. * clear video watermarks
  746. *
  747. * This method removes the watermark image from the video stream added by addVideoWatermark.
  748. *
  749. * @returns Promise<{success, value}>
  750. */
  751. static removclearVideoWatermarkse() {
  752. return Agora.clearVideoWatermarks();
  753. }
  754. /**
  755. * set local publish fallback
  756. *
  757. * This method sets the fallback option for the locally published video stream based on the network conditions.
  758. *
  759. * @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)
  760. * @returns Promise<{success, value}>
  761. */
  762. static setLocalPublishFallbackOption(option) {
  763. return Agora.setLocalPublishFallbackOption(option);
  764. }
  765. /**
  766. * set remote publish fallback
  767. *
  768. * This method sets the fallback option for the remotely subscribed video stream based on the network conditions.
  769. *
  770. * @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)
  771. * @returns Promise<{success, value}>
  772. */
  773. static setRemoteSubscribeFallbackOption(option) {
  774. return Agora.setRemoteSubscribeFallbackOption(option);
  775. }
  776. /**
  777. * enable dual stream mode
  778. *
  779. * This method enables the dual stream by parameter mode.
  780. *
  781. * @param enabled
  782. * @returns Promise<{success, value}>
  783. */
  784. static enableDualStreamMode(enabled) {
  785. return Agora.enableDualStreamMode(enabled);
  786. }
  787. /**
  788. * set remote video stream type
  789. *
  790. * This method sets the remote video stream type by uid and streamType.
  791. *
  792. * @param options {@link VideoStreamOption}
  793. * @returns Promise<{success, value}>
  794. */
  795. static setRemoteVideoStreamType(options) {
  796. return Agora.setRemoteVideoStreamType(options);
  797. }
  798. /**
  799. * set remote default video stream type
  800. *
  801. * This method sets the default video stream type.
  802. *
  803. * @param options {@link DefaultVideoStreamOption}
  804. * @returns Promise<{success, value}>
  805. */
  806. static setRemoteDefaultVideoStreamType(options) {
  807. return Agora.setRemoteDefaultVideoStreamType(options);
  808. }
  809. /**
  810. * add inject stream url
  811. *
  812. * This method injects an online media stream to a live broadcast.
  813. *
  814. * @param options {@link InjectStreamOption}
  815. * @returns Promise<{success, value}>
  816. */
  817. static addInjectStreamUrl(options) {
  818. return Agora.addInjectStreamUrl(options);
  819. }
  820. /**
  821. * remove inject stream url
  822. *
  823. * This method removes stream by addInjectsStreamUrl.
  824. *
  825. * @param options {@link RemoveInjectStreamOption}
  826. * @returns Promise<{success, value}>
  827. */
  828. static removeInjectStreamUrl(options) {
  829. return Agora.removeInjectStreamUrl(options);
  830. }
  831. /**
  832. * @deprecated
  833. * set video quality
  834. *
  835. * This method sets the preferences for the video quality. (Live broadcast only).
  836. *
  837. * @param quality boolean
  838. * @returns Promise<{success, value}>
  839. */
  840. // public static setVideoQualityParameters(quality: boolean): Promise<any> {
  841. // return Agora.setVideoQualityParameters(quality);
  842. // }
  843. /**
  844. * set local video mirror mode
  845. *
  846. * This method sets local video mirror mode
  847. *
  848. * @param mode
  849. * @returns Promise<{success, value}>
  850. */
  851. static setLocalVideoMirrorMode(mode) {
  852. return Agora.setLocalVideoMirrorMode(mode);
  853. }
  854. /**
  855. * switch camera
  856. *
  857. * This method switches camera between front and rear.
  858. *
  859. * @returns Promise<{success, value}>
  860. */
  861. static switchCamera() {
  862. return Agora.switchCamera();
  863. }
  864. /**
  865. * is camera zoom supported
  866. *
  867. * This method checks whether the camera zoom function is supported.
  868. *
  869. * @returns Promise<{success, value}>
  870. */
  871. static isCameraZoomSupported() {
  872. return Agora.isCameraZoomSupported();
  873. }
  874. /**
  875. * is camera torch supported
  876. *
  877. * This method checks whether the camera flash function is supported.
  878. *
  879. * @returns Promise<{success, value}>
  880. */
  881. static isCameraTorchSupported() {
  882. return Agora.isCameraTorchSupported();
  883. }
  884. /**
  885. * is camera focus supported
  886. *
  887. * This method checks whether the camera mannual focus function is supported.
  888. *
  889. * @returns Promise<{success, value}>
  890. */
  891. static isCameraFocusSupported() {
  892. return Agora.isCameraFocusSupported();
  893. }
  894. /**
  895. * is camera exposure position supported
  896. *
  897. * This method checks whether the camera mannual exposure function is supported.
  898. *
  899. * @returns Promise<{success, value}>
  900. */
  901. static isCameraExposurePositionSupported() {
  902. return Agora.isCameraExposurePositionSupported();
  903. }
  904. /**
  905. * is camera auto focus face mode supported
  906. *
  907. * This method checks whether the camera mannual auto-face focus function is supported.
  908. *
  909. * @returns Promise<{success, value}>
  910. */
  911. static isCameraAutoFocusFaceModeSupported() {
  912. return Agora.isCameraAutoFocusFaceModeSupported();
  913. }
  914. /**
  915. * set camera zoom ratio
  916. *
  917. * This method sets the camera zoom ratio.
  918. *
  919. * @param zoomFactor
  920. * @returns Promise<{success, value}>
  921. */
  922. static setCameraZoomFactor(zoomFactor) {
  923. return Agora.setCameraZoomFactor(zoomFactor);
  924. }
  925. /**
  926. * get camera max zoom ratio
  927. *
  928. * This method gets the camera maximum zoom ratio.
  929. *
  930. * @notice Android Only
  931. * @returns Promise<{success, value}>
  932. */
  933. static getCameraMaxZoomFactor() {
  934. return Agora.getCameraMaxZoomFactor();
  935. }
  936. /**
  937. * set camera focus position in preview
  938. *
  939. * This method sets the mannual focus position.
  940. *
  941. * @param options {@link PositionOption}
  942. * @returns Promise<{success, value}>
  943. */
  944. static setCameraFocusPositionInPreview(options) {
  945. return Agora.setCameraFocusPositionInPreview(options);
  946. }
  947. /**
  948. * set camera exposure position
  949. *
  950. * This method sets the mannual exposure position.
  951. *
  952. * @param options {@link PositionOption}
  953. * @returns Promise<{success, value}>
  954. */
  955. static setCameraExposurePosition(options) {
  956. return Agora.setCameraExposurePosition(options);
  957. }
  958. /**
  959. * set camera torch on
  960. *
  961. * This method enables the camera flash function.
  962. *
  963. * @param enabled
  964. * @returns Promise<{success, value}>
  965. */
  966. static setCameraTorchOn(enabled) {
  967. return Agora.setCameraTorchOn(enabled);
  968. }
  969. /**
  970. * set enable auto focus face mode
  971. *
  972. * This method enables auto-focus face mode function.
  973. *
  974. * @param enabled boolean
  975. * @returns Promise<{success, value}>
  976. */
  977. static setCameraAutoFocusFaceModeEnabled(enabled) {
  978. return Agora.setCameraAutoFocusFaceModeEnabled(enabled);
  979. }
  980. /**
  981. * get call id
  982. *
  983. * This method is used to get call id.
  984. *
  985. * @returns Promise<{success, value}>
  986. */
  987. static getCallId() {
  988. return Agora.getCallId();
  989. }
  990. /**
  991. * set log file and log filter
  992. *
  993. * This method sets the log file generated path and specified the log level.
  994. *
  995. * @param filepath string
  996. * @param level enum
  997. * @param maxfileSize integer (KB)
  998. * @returns Promise<{success, value}>
  999. */
  1000. static setLog(filepath, level, maxfileSize) {
  1001. return Agora.setLog(filepath, level, maxfileSize);
  1002. }
  1003. /**
  1004. * send stream message
  1005. *
  1006. * This method sends stream message by specified uid
  1007. *
  1008. * @param uid
  1009. * @param data
  1010. * @returns Promise<{success, value}>
  1011. */
  1012. static sendMessage(streamID, data, reliable, ordered) {
  1013. return Agora.sendMessage({ streamID, data, reliable, ordered });
  1014. }
  1015. /**
  1016. * add publish stream url
  1017. *
  1018. * This method add publish stream by option.
  1019. *
  1020. * @param options {@link PublishStreamOption}
  1021. * @returns Promise<{success, value}>
  1022. */
  1023. static addPublishStreamUrl(options) {
  1024. return Agora.addPublishStreamUrl(options);
  1025. }
  1026. /**
  1027. * remove publish stream url
  1028. *
  1029. * This method remove publish stream by options.
  1030. *
  1031. * @param options {@link RemovePublishStreamOption}
  1032. * @returns Promise<{success, value}>
  1033. */
  1034. static removePublishStreamUrl(options) {
  1035. return Agora.removePublishStreamUrl(options);
  1036. }
  1037. /**
  1038. * set live transcoding
  1039. *
  1040. * This method sets the video layout and audio settings for CDN live.
  1041. *
  1042. * @param options {@link LiveTranscoding}
  1043. * @returns Promise<{success, value}>
  1044. */
  1045. static setLiveTranscoding(options) {
  1046. return Agora.setLiveTranscoding(options);
  1047. }
  1048. /**
  1049. * get sdk version
  1050. *
  1051. * This method gets the sdk version details and passed it into callback function
  1052. *
  1053. * @param callback to handle resolve from getSdkVersion
  1054. * @param errorHandler to handle reject error from getSdkVersion
  1055. */
  1056. static getSdkVersion(callback, errorHandler) {
  1057. return Agora.getSdkVersion().then(callback).catch(errorHandler);
  1058. }
  1059. /**
  1060. * mute local audio stream
  1061. *
  1062. * This method sends/stops sending the local audio.
  1063. *
  1064. * @param enabled
  1065. */
  1066. static muteLocalAudioStream(enabled) {
  1067. Agora.muteLocalAudioStream(enabled);
  1068. }
  1069. /**
  1070. * video pre-process/post-process
  1071. *
  1072. * This method enables/disables image enhancement and sets the options.
  1073. *
  1074. * @param enable boolean
  1075. * @param options {@link BeautyOptions}
  1076. * @returns Promise<{success, value}>
  1077. */
  1078. static setBeautyEffectOptions(enabled, options) {
  1079. return Agora.setBeautyEffectOptions(enabled, options);
  1080. }
  1081. /**
  1082. * set local voice change
  1083. *
  1084. * This method changes local speaker voice with voiceChanger
  1085. *
  1086. * @param voiceChanger integer
  1087. * @voiceChanger value ranges [
  1088. * 0: "The original voice",
  1089. * 1: "An old man’s voice",
  1090. * 2: "A little boy’s voice.",
  1091. * 3: "A little girl’s voice.",
  1092. * 4: "TBD",
  1093. * 5: "Ethereal vocal effects.",
  1094. * 6: "Hulk’s voice."
  1095. * ]
  1096. * @returns Promise<{success, value}>
  1097. */
  1098. static setLocalVoiceChanger(voiceChanger) {
  1099. return Agora.setLocalVoiceChanger(voiceChanger);
  1100. }
  1101. /**
  1102. * set the preset local voice reverberation effect.
  1103. *
  1104. * This method sets the preset local voice reverberation effect.
  1105. *
  1106. * @param preset integer
  1107. * @returns Promise<{success, value}>
  1108. */
  1109. static setLocalVoiceReverbPreset(preset) {
  1110. return Agora.setLocalVoiceReverbPreset(preset);
  1111. }
  1112. /**
  1113. * control stereo panning for remote users
  1114. *
  1115. * This method enables/disables stereo panning for remote users.
  1116. *
  1117. * @param enabled boolean
  1118. * @returns Promise<{success, value}>
  1119. */
  1120. static enableSoundPositionIndication(enabled) {
  1121. return Agora.enableSoundPositionIndication(enabled);
  1122. }
  1123. /**
  1124. * set the sound position of a remote user
  1125. *
  1126. * This method sets the sound position of a remote user by uid
  1127. *
  1128. * @param uid number | The ID of the remote user
  1129. * @param pan float | The sound position of the remote user. The value ranges from -1.0 to 1.0
  1130. * @pan
  1131. * 0.0: the remote sound comes from the front.
  1132. * -1.0: the remote sound comes from the left.
  1133. * 1.0: the remote sound comes from the right.
  1134. * @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.
  1135. * @returns Promise<{success, value}>
  1136. */
  1137. static setRemoteVoicePosition(uid, pan, gain) {
  1138. return Agora.setRemoteVoicePosition(uid, pan, gain);
  1139. }
  1140. /**
  1141. * start the lastmile probe test
  1142. *
  1143. * 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).
  1144. *
  1145. * @param config LastmileProbeConfig {@link LastmileProbeConfig}
  1146. *
  1147. * @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.
  1148. * @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.
  1149. * @returns Promise<{success, value}>
  1150. */
  1151. static startLastmileProbeTest(config) {
  1152. return Agora.startLastmileProbeTest(config);
  1153. }
  1154. /**
  1155. * stop the lastmile probe test
  1156. *
  1157. * This method stop the lastmile probe test.
  1158. *
  1159. * @returns Promise<{success, value}>
  1160. */
  1161. static stopLastmileProbeTest() {
  1162. return Agora.stopLastmileProbeTest();
  1163. }
  1164. /**
  1165. * sets the priority of a remote user's media stream.
  1166. *
  1167. * 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.
  1168. *
  1169. * This method sets the priority of a remote user's media stream.
  1170. * @param uid number
  1171. * @param userPriority number | The value range is [50 is "user's priority is hgih", 100 is "the default user's priority is normal"]
  1172. *
  1173. * @returns Promise<{success, value}>
  1174. */
  1175. static setRemoteUserPriority(uid, userPrority) {
  1176. return Agora.setRemoteUserPriority(uid, userPrority);
  1177. }
  1178. /**
  1179. * start an audio call test.
  1180. *
  1181. * note:
  1182. * Call this method before joining a channel.
  1183. * 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.
  1184. * In the Live-broadcast profile, only a host can call this method.
  1185. * This method will start an audio call test with interval parameter.
  1186. * 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.
  1187. *
  1188. * @param interval number
  1189. *
  1190. * @returns Promise<{success, value}>
  1191. */
  1192. static startEchoTestWithInterval(interval) {
  1193. return Agora.startEchoTestWithInterval(interval);
  1194. }
  1195. /**
  1196. * set the camera capture preference.
  1197. *
  1198. * note:
  1199. * 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:
  1200. * 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.
  1201. * 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.
  1202. * If you want better quality for the local video preview, we recommend setting config as CAPTURER_OUTPUT_PREFERENCE_PREVIEW(2).
  1203. *
  1204. * This method will set the camera capture preference.
  1205. *
  1206. * @param config {@link CameraCapturerConfiguration}
  1207. *
  1208. * @returns Promise<{success, value}>
  1209. */
  1210. static setCameraCapturerConfiguration(config) {
  1211. return Agora.setCameraCapturerConfiguration(config);
  1212. }
  1213. }
  1214. RtcEngine.eventTypes = new Set();
  1215. exports.default = RtcEngine;
  1216. //# sourceMappingURL=RtcEngine.native.js.map