説明なし

RtcEngine.native.js 38KB

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