No Description

types.d.ts 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. import { ViewProps } from 'react-native';
  2. /**
  3. * ChannelMediaInfo
  4. * @property channelName: string
  5. * @property token: string
  6. * @property uid: number
  7. */
  8. export interface ChannelMediaInfo {
  9. channelName: string;
  10. token?: string;
  11. uid?: number;
  12. }
  13. /**
  14. * ChannelMediaConfiguration
  15. * @property src: {
  16. * @member channelName,
  17. * @member token,
  18. * @member uid,
  19. * }
  20. * @property channels: {@link Array<ChannelMediaInfo>}
  21. */
  22. export interface ChannelMediaConfiguration {
  23. src?: {
  24. channelName: string;
  25. token?: string;
  26. uid?: number;
  27. };
  28. channels: Array<ChannelMediaInfo>;
  29. }
  30. /**
  31. * AgoraViewMode
  32. * @mode hidden Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents.
  33. * @mode FIT Uniformly scale the video until one of its dimension fits the boundary (zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio are filled with black.
  34. */
  35. export declare enum AgoraViewMode {
  36. HIDDEN = 1,
  37. FIT = 2
  38. }
  39. /**
  40. * AgoraUserInfo
  41. * @property uid: number
  42. * @property userAccount: string
  43. */
  44. export interface AgoraUserInfo {
  45. uid: number;
  46. userAccount: string;
  47. }
  48. /**
  49. * VideoEncoderConfig details
  50. * @property width: number | The encoder video's width
  51. * @property height: number | The encoder video's height
  52. * @property bitrate: number | The encoder video's bitrate
  53. * @property frameRate: number | The frameRate of encoder video
  54. * @property orientationMode: number | The video orientation mode of the video
  55. * @orientationMode value range is [0 is "mode adapative", 1 is "mode fixed landscape", 2 is "mode fixed portrait"]
  56. */
  57. export interface VideoEncoderConfig {
  58. width: number;
  59. height: number;
  60. bitrate: number;
  61. frameRate: number;
  62. orientationMode: number;
  63. }
  64. /**
  65. * Option is used to {@link init}
  66. * @member {@link appid} Sets the appid
  67. * @member {@link channelProfile} Number channelProfile Sets the channel mode. 0 is communication mode, 1 is broadcasting mode
  68. * @member {@link VideoEncoderConfig} sets video encoding config
  69. * @member {@link dualStream} is optional parameter only for enable for detail see [more](https://docs.agora.io/en/Video/API%20Reference/oc/Classes/AgoraRtcEngineKit.html#//api/name/enableDualStreamMode)
  70. * @member {@link mode} is optional sets only enable video / audio, 0 is audio mode, 1 is video mode
  71. * @member {@link clientRole} is only work in live mode, 1 is host, 2 is audience
  72. * @member {@link audioProfile} Sets audio profile to agora rtc sdk See more [details](https://docs.agora.io/en/Video/API%20Reference/oc/Constants/AgoraAudioProfile.html)
  73. * @member {@link audioScenario} Sets audio scenario to agora rtc sdk more [details](https://docs.agora.io/en/Video/API%20Reference/oc/Constants/AgoraAudioScenario.html)
  74. * @member {@link beauty} {@link BeautyOption}
  75. * @member {@link voice} {@link VoiceDecorator}
  76. */
  77. export interface Option {
  78. appid: String;
  79. channelProfile: number;
  80. videoEncoderConfig: VideoEncoderConfig;
  81. dualStream: boolean;
  82. mode: number;
  83. clientRole: number;
  84. audioProfile: number;
  85. audioScenario: number;
  86. beauty?: BeautyOption;
  87. voice?: VoiceDecorator;
  88. }
  89. /**
  90. * VoiceDecorator is decorate local audio voice
  91. *
  92. * @description
  93. * type 'reverbPreset' range values: [0 is "off", 1 is "popular", 2 is "rnb", 3 is "rock", 4 is "hiphop", 5 is "vocal concert", 6 is "KTV", 7 is "studio"]
  94. * type 'changer' range values: [0 is "off", 1 is "old man", 2 is "baby boy", 3 is "baby girl", 4 is "zhubajie", 5 is "ethereal", 6 is "hulk"]
  95. * @member type: string | the range values ['changer' | 'reverbPreset'] This property is the identifier for audio voice decorator
  96. * @member value: number | the value for voice parameter option.
  97. */
  98. export interface VoiceDecorator {
  99. type: string;
  100. value: number;
  101. }
  102. export interface PublisherConfig {
  103. width: number;
  104. height: number;
  105. framerate: number;
  106. bitrate: number;
  107. defaultLayout: number;
  108. lifeCycle: number;
  109. pubishUrl: string;
  110. rawStreamUrl: string;
  111. extraInfo: String;
  112. owner: boolean;
  113. }
  114. export interface BackgroundImage {
  115. url: string;
  116. x: number;
  117. y: number;
  118. width: number;
  119. height: number;
  120. }
  121. export interface Size {
  122. width: number;
  123. height: number;
  124. }
  125. export interface TranscodingUser {
  126. uid: number;
  127. x: number;
  128. y: number;
  129. width: number;
  130. height: number;
  131. alpha: number;
  132. zOrder: number;
  133. audioChannel: number;
  134. }
  135. export interface Color {
  136. red: number;
  137. green: number;
  138. blue: number;
  139. alpha: number;
  140. }
  141. export declare enum VideoCodecProfile {
  142. BASELINE = 66,
  143. MAIN = 77,
  144. HIGH = 100
  145. }
  146. export declare enum AudioCodecProfile {
  147. LC_AAC = 0,
  148. HE_AAC = 1
  149. }
  150. export declare enum AudioSampleRate {
  151. TYPE_32000 = 32000,
  152. TYPE_44100 = 44100,
  153. TYPE_48000 = 48000
  154. }
  155. /**
  156. * AgoraChannelStereo
  157. * @note Agora’s self-defined audio channel type. We recommend choosing ONE or TWO. Special players are required if you choose TRHEE, FOUR or FIVE:
  158. */
  159. export declare enum AudioChannelStereo {
  160. ONE = 1,
  161. TWO = 2,
  162. TRHEE = 3,
  163. FOUR = 4,
  164. FIVE = 5
  165. }
  166. /**
  167. * @member {@link size} {@link Size}
  168. * @member {@link videoBitrate} integer number
  169. * @member {@link videoFramerate} integer number
  170. * @member {@link lowLatency} boolean
  171. * @member {@link videoGop} number
  172. * @member {@link videoCodecProfile} {@link VideoCodecProfile}
  173. * @member {@link audioCodecProfile} {@link AudioCodecProfile}
  174. * @member {@link audioSampleRate} {@link AudioSampleRate}
  175. * @member {@link watermark} {@link BackgroundImage}
  176. * @member {@link backgroundImage} {@link BackgroundImage}
  177. * @member {@link backgroundColor} Standard RGB hex number: e.g. 0xffffff
  178. * @member {@link audioBitrate} number
  179. * @member {@link audioChannels} {@link AudioChannelStereo}
  180. * @member {@link transcodingUsers} Array,{@link TranscodingUser}>,
  181. * @member {@link transcodingExtraInfo} string
  182. */
  183. export interface LiveTranscodingOption {
  184. size: Size;
  185. videoBitrate: number;
  186. videoFramerate: number;
  187. lowLatency: boolean;
  188. videoGop: number;
  189. videoCodecProfile: VideoCodecProfile;
  190. audioCodecProfile: AudioCodecProfile;
  191. audioSampleRate: AudioSampleRate;
  192. watermark: BackgroundImage;
  193. backgroundImage: BackgroundImage;
  194. backgroundColor: number;
  195. audioBitrate: number;
  196. audioChannels: AudioChannelStereo;
  197. transcodingUsers: Array<TranscodingUser>;
  198. transcodingExtraInfo: string;
  199. }
  200. export interface VideoOption {
  201. uid: number;
  202. renderMode: number;
  203. reactTag: number;
  204. }
  205. export interface AudioRecordingOption {
  206. filepath: String;
  207. sampleRate: number;
  208. quality: number;
  209. }
  210. export declare type Callback<T> = (err: any, data: any) => T;
  211. export declare type Nullable<T> = T | null | undefined;
  212. export declare type String = Nullable<string>;
  213. export declare type Number = Nullable<number> | 0;
  214. export interface AgoraViewProps extends ViewProps {
  215. mode: number;
  216. showLocalVideo: boolean;
  217. remoteUid: number;
  218. zOrderMediaOverlay: boolean;
  219. [key: string]: any;
  220. }
  221. export interface DataStreamOption {
  222. streamId: number;
  223. ordered: boolean;
  224. reliable: boolean;
  225. }
  226. export interface AudioMixingOption {
  227. filepath: String;
  228. loopback: boolean;
  229. replace: boolean;
  230. cycle: number;
  231. }
  232. export interface PlayEffectOption {
  233. soundId: number;
  234. filepath: String;
  235. loopcount: number;
  236. pitch: number;
  237. pan: number;
  238. gain: number;
  239. publish: boolean;
  240. }
  241. export interface AudioFrameOption {
  242. sampleRate: number;
  243. channel: number;
  244. mode: number;
  245. samplesPerCall: number;
  246. }
  247. export interface MixedAudioFrameOption {
  248. sampleRate: number;
  249. samplesPerCall: number;
  250. }
  251. export interface ImageOption {
  252. visibleInPreview: boolean;
  253. positionInPortraitMode: {
  254. x: number;
  255. y: number;
  256. width: number;
  257. height: number;
  258. };
  259. positionInLandscapeMode: {
  260. x: number;
  261. y: number;
  262. width: number;
  263. height: number;
  264. };
  265. }
  266. export interface VideoStreamOption {
  267. uid: number;
  268. streamType: number;
  269. }
  270. export interface DefaultVideoStreamOption {
  271. streamType: number;
  272. }
  273. export interface InjectStreamOption {
  274. url: String;
  275. config: {
  276. size: {
  277. width: number;
  278. height: number;
  279. };
  280. videoGop: number;
  281. videoBitrate: number;
  282. videoFramerate: number;
  283. audioBitrate: number;
  284. audioSampleRate: number;
  285. audioChannels: number;
  286. };
  287. }
  288. export interface RemoveInjectStreamOption {
  289. url: String;
  290. }
  291. export interface PublishStreamOption {
  292. url: String;
  293. enable: boolean;
  294. }
  295. export interface RemovePublishStreamOption {
  296. url: String;
  297. }
  298. export interface PositionOption {
  299. x: number;
  300. y: number;
  301. }
  302. /**
  303. * BeautyOption is setBeautyEffectOptions's option parameter
  304. * @property lighteningContrastLevel: integer | lightening contrast level and the value ranges is low: 0, normal: 1, high: 2
  305. * @property lighteningLevel: float | brightness level and the value ranges between 0.0 (original) and 1.0.
  306. * @property smoothnessLevel: float | The sharpness level. The value ranges between 0.0 (original) and 1.0. This parameter is usually used to remove blemishes.
  307. * @property rednessLevel: float | The redness level. The value ranges between 0.0 (original) and 1.0. This parameter adjusts the red saturation level.
  308. */
  309. export interface BeautyOption {
  310. lighteningContrastLevel: number;
  311. lighteningLevel: number;
  312. smoothnessLevel: number;
  313. rednessLevel: number;
  314. }
  315. /**
  316. * LastmileProbeConfig is startLastmileProbeTest's config parameter
  317. * @property probeUplink: boolean | sets whether or not to test the uplink networks. some users, for example, the audience in a Live-broadcast channel, do not need such a test. true: enables the probe test. false: disables the probe test.
  318. * @property probeDownlink: boolean | sets whether or not to probe the downlink network. true: enables the probe test. false: disables the probe test.
  319. * @property expectedUplinkBitrate: integer | The expected maximum sending bitrate (Kbps) of the local user. The value ranges between 100 and 5000. We recommend setting this parameter according to the bitrate value set by setVideoEncoderConfiguration.
  320. * @property expectedDownlinkBitrate: integer | The expected maximum receiving bitrate (Kbps) of the local user. The value ranges between 100 and 5000.
  321. */
  322. export interface LastmileProbeConfig {
  323. probeUplink: boolean;
  324. probeDownlink: boolean;
  325. expectedUplinkBitrate: number;
  326. expectedDownlinkBitrate: number;
  327. }
  328. /**
  329. * CameraCapturerConfiguration is setCameraCapturerConfiguration's config parameter
  330. * @property preference: number | The Camera capture preference and the value range is [0 is "(default) self-adapts the camera output parameters to the system performance and network conditions to balance CPU consumption and video preview quality.", 1 is "prioritizes the system performance. The SDK chooses the dimension and frame rate of the local camera capture closest to those set by setVideoEncoderConfiguration.", 2 is "prioritizes the local preview quality. The SDK chooses higher camera output parameters to improve the local video preview quality. This option requires extra CPU and RAM usage for video pre-processing."]
  331. */
  332. export interface CameraCapturerConfiguration {
  333. preference: number;
  334. cameraDirection: number;
  335. }