No Description

types.d.ts 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. import { ViewProps } from 'react-native';
  2. /**
  3. * AgoraViewMode
  4. * @mode hidden Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents.
  5. * @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.
  6. */
  7. export declare enum AgoraViewMode {
  8. HIDDEN = 1,
  9. FIT = 2
  10. }
  11. /**
  12. * VideoEncoderConfig details
  13. * @property width: number | The encoder video's width
  14. * @property height: number | The encoder video's height
  15. * @property bitrate: number | The encoder video's bitrate
  16. * @property frameRate: number | The frameRate of encoder video
  17. * @property orientationMode: number | The video orientation mode of the video
  18. * @orientationMode value range is [0 is "mode adapative", 1 is "mode fixed landscape", 2 is "mode fixed portrait"]
  19. */
  20. export interface VideoEncoderConfig {
  21. width: number;
  22. height: number;
  23. bitrate: number;
  24. frameRate: number;
  25. orientationMode: number;
  26. }
  27. /**
  28. * Option is used to {@link init}
  29. * @member {@link appid} Sets the appid
  30. * @member {@link channelProfile} Number channelProfile Sets the channel mode. 0 is communication mode, 1 is broadcasting mode
  31. * @member {@link VideoEncoderConfig} sets video encoding config
  32. * @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)
  33. * @member {@link mode} is optional sets only enable video / audio, 0 is audio mode, 1 is video mode
  34. * @member {@link clientRole} is only work in live mode, 1 is host, 2 is audience
  35. * @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)
  36. * @member {@link audioScenario} Sets audio scenario to agora rtc sdk more [details](https://docs.agora.io/en/Video/API%20Reference/oc/Constants/AgoraAudioScenario.html)
  37. * @member {@link beauty} {@link BeautyOption}
  38. * @member {@link voice} {@link VoiceDecorator}
  39. */
  40. export interface Option {
  41. appid: String;
  42. channelProfile: number;
  43. videoEncoderConfig: VideoEncoderConfig;
  44. dualStream: boolean;
  45. mode: number;
  46. clientRole: number;
  47. audioProfile: number;
  48. audioScenario: number;
  49. beauty?: BeautyOption;
  50. voice?: VoiceDecorator;
  51. }
  52. /**
  53. * VoiceDecorator is decorate local audio voice
  54. *
  55. * @description
  56. * 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"]
  57. * 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"]
  58. * @member type: string | the range values ['changer' | 'reverbPreset'] This property is the identifier for audio voice decorator
  59. * @member value: number | the value for voice parameter option.
  60. */
  61. export interface VoiceDecorator {
  62. type: string;
  63. value: number;
  64. }
  65. export interface PublisherConfig {
  66. width: number;
  67. height: number;
  68. framerate: number;
  69. bitrate: number;
  70. defaultLayout: number;
  71. lifeCycle: number;
  72. pubishUrl: string;
  73. rawStreamUrl: string;
  74. extraInfo: String;
  75. owner: boolean;
  76. }
  77. export interface BackgroundImage {
  78. url: string;
  79. x: number;
  80. y: number;
  81. width: number;
  82. height: number;
  83. }
  84. export interface Size {
  85. width: number;
  86. height: number;
  87. }
  88. export interface TranscodingUser {
  89. uid: number;
  90. x: number;
  91. y: number;
  92. width: number;
  93. height: number;
  94. alpha: number;
  95. zOrder: number;
  96. audioChannel: number;
  97. }
  98. export interface Color {
  99. red: number;
  100. green: number;
  101. blue: number;
  102. alpha: number;
  103. }
  104. export declare enum VideoCodecProfile {
  105. BASELINE = 66,
  106. MAIN = 77,
  107. HIGH = 100
  108. }
  109. export declare enum AudioCodecProfile {
  110. LC_AAC = 0,
  111. HE_AAC = 1
  112. }
  113. export declare enum AudioSampleRate {
  114. TYPE_32000 = 32000,
  115. TYPE_44100 = 44100,
  116. TYPE_48000 = 48000
  117. }
  118. /**
  119. * AgoraChannelStereo
  120. * @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:
  121. */
  122. export declare enum AudioChannelStereo {
  123. ONE = 1,
  124. TWO = 2,
  125. TRHEE = 3,
  126. FOUR = 4,
  127. FIVE = 5
  128. }
  129. /**
  130. * @member {@link size} {@link Size}
  131. * @member {@link videoBitrate} integer number
  132. * @member {@link videoFramerate} integer number
  133. * @member {@link lowLatency} boolean
  134. * @member {@link videoGop} number
  135. * @member {@link videoCodecProfile} {@link VideoCodecProfile}
  136. * @member {@link audioCodecProfile} {@link AudioCodecProfile}
  137. * @member {@link audioSampleRate} {@link AudioSampleRate}
  138. * @member {@link watermark} {@link BackgroundImage}
  139. * @member {@link backgroundImage} {@link BackgroundImage}
  140. * @member {@link backgroundColor} Standard RGB hex number: e.g. 0xffffff
  141. * @member {@link audioBitrate} number
  142. * @member {@link audioChannels} {@link AudioChannelStereo}
  143. * @member {@link transcodingUsers} Array,{@link TranscodingUser}>,
  144. * @member {@link transcodingExtraInfo} string
  145. */
  146. export interface LiveTranscodingOption {
  147. size: Size;
  148. videoBitrate: number;
  149. videoFramerate: number;
  150. lowLatency: boolean;
  151. videoGop: number;
  152. videoCodecProfile: VideoCodecProfile;
  153. audioCodecProfile: AudioCodecProfile;
  154. audioSampleRate: AudioSampleRate;
  155. watermark: BackgroundImage;
  156. backgroundImage: BackgroundImage;
  157. backgroundColor: number;
  158. audioBitrate: number;
  159. audioChannels: AudioChannelStereo;
  160. transcodingUsers: Array<TranscodingUser>;
  161. transcodingExtraInfo: string;
  162. }
  163. export interface VideoOption {
  164. uid: number;
  165. renderMode: number;
  166. reactTag: number;
  167. }
  168. export interface AudioRecordingOption {
  169. filepath: String;
  170. quality: number;
  171. }
  172. export declare type Callback<T> = (err: any, data: any) => T;
  173. export declare type Nullable<T> = T | null | undefined;
  174. export declare type String = Nullable<string>;
  175. export declare type Number = Nullable<number> | 0;
  176. export interface AgoraViewProps extends ViewProps {
  177. mode: number;
  178. showLocalVideo: boolean;
  179. remoteUid: number;
  180. zOrderMediaOverlay: boolean;
  181. [key: string]: any;
  182. }
  183. export interface DataStreamOption {
  184. streamId: number;
  185. ordered: boolean;
  186. reliable: boolean;
  187. }
  188. export interface AudioMixingOption {
  189. filepath: String;
  190. loopback: boolean;
  191. replace: boolean;
  192. cycle: number;
  193. }
  194. export interface PlayEffectOption {
  195. soundId: number;
  196. filepath: String;
  197. loopcount: number;
  198. pitch: number;
  199. pan: number;
  200. gain: number;
  201. publish: boolean;
  202. }
  203. export interface AudioFrameOption {
  204. sampleRate: number;
  205. channel: number;
  206. mode: number;
  207. samplesPerCall: number;
  208. }
  209. export interface MixedAudioFrameOption {
  210. sampleRate: number;
  211. samplesPerCall: number;
  212. }
  213. export interface ImageOption {
  214. url: String;
  215. height: number;
  216. width: number;
  217. x: number;
  218. y: number;
  219. }
  220. export interface VideoStreamOption {
  221. uid: number;
  222. streamType: number;
  223. }
  224. export interface DefaultVideoStreamOption {
  225. streamType: number;
  226. }
  227. export interface InjectStreamOption {
  228. url: String;
  229. config: {
  230. size: {
  231. width: number;
  232. height: number;
  233. };
  234. videoGop: number;
  235. videoBitrate: number;
  236. videoFramerate: number;
  237. audioBitrate: number;
  238. audioSampleRate: number;
  239. audioChannels: number;
  240. };
  241. }
  242. export interface RemoveInjectStreamOption {
  243. url: String;
  244. }
  245. export interface PublishStreamOption {
  246. url: String;
  247. enable: boolean;
  248. }
  249. export interface RemovePublishStreamOption {
  250. url: String;
  251. }
  252. export interface PositionOption {
  253. x: number;
  254. y: number;
  255. }
  256. /**
  257. * BeautyOption is setBeautyEffectOptions's option parameter
  258. * @property lighteningContrastLevel: integer | lightening contrast level and the value ranges is low: 0, normal: 1, high: 2
  259. * @property lighteningLevel: float | brightness level and the value ranges between 0.0 (original) and 1.0.
  260. * @property smoothnessLevel: float | The sharpness level. The value ranges between 0.0 (original) and 1.0. This parameter is usually used to remove blemishes.
  261. * @property rednessLevel: float | The redness level. The value ranges between 0.0 (original) and 1.0. This parameter adjusts the red saturation level.
  262. */
  263. export interface BeautyOption {
  264. lighteningContrastLevel: number;
  265. lighteningLevel: number;
  266. smoothnessLevel: number;
  267. rednessLevel: number;
  268. }
  269. /**
  270. * LastmileProbeConfig is startLastmileProbeTest's config parameter
  271. * @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.
  272. * @property probeDownlink: boolean | sets whether or not to probe the downlink network. true: enables the probe test. false: disables the probe test.
  273. * @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.
  274. * @property expectedDownlinkBitrate: integer | The expected maximum receiving bitrate (Kbps) of the local user. The value ranges between 100 and 5000.
  275. */
  276. export interface LastmileProbeConfig {
  277. probeUplink: boolean;
  278. probeDownlink: boolean;
  279. expectedUplinkBitrate: number;
  280. expectedDownlinkBitrate: number;
  281. }
  282. /**
  283. * CameraCapturerConfiguration is setCameraCapturerConfiguration's config parameter
  284. * @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."]
  285. */
  286. export interface CameraCapturerConfiguration {
  287. preference: number;
  288. }