index.d.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. // Generated by dts-bundle v0.7.3
  2. declare module 'urtc-sdk' {
  3. import Logger from '__urtc-sdk/logger';
  4. import Client from '__urtc-sdk/client';
  5. import { setServers } from '__urtc-sdk/server';
  6. import { getSupportProfileNames } from '__urtc-sdk/resolutions';
  7. import { version } from '__urtc-sdk/version';
  8. import { genToken } from '__urtc-sdk/token';
  9. import { Codecs, DeviceDetectionOptions, DeviceDetectionResult, GetDevicesOptions } from '__urtc-sdk/types';
  10. export * from '__urtc-sdk/types';
  11. function getDevices(opts: GetDevicesOptions, onSuccess: (data: MediaDeviceInfo[]) => any, onFailure: (data?: any) => any): void;
  12. const generateToken: typeof genToken;
  13. function getSupportedCodec(callback?: (data: Codecs) => any): void;
  14. function isSupportWebRTC(): boolean;
  15. function deviceDetection(options: DeviceDetectionOptions, callback: (result: DeviceDetectionResult) => any): void;
  16. export { Client };
  17. export { Logger };
  18. export { setServers };
  19. export { getDevices };
  20. export { getSupportProfileNames };
  21. export { version };
  22. export { generateToken };
  23. export { getSupportedCodec };
  24. export { isSupportWebRTC };
  25. export { deviceDetection };
  26. const UCloudRTC: {
  27. Client: typeof Client;
  28. setServers: typeof setServers;
  29. getDevices: typeof getDevices;
  30. getSupportProfileNames: typeof getSupportProfileNames;
  31. version: string;
  32. generateToken: typeof genToken;
  33. getSupportedCodec: typeof getSupportedCodec;
  34. isSupportWebRTC: typeof isSupportWebRTC;
  35. deviceDetection: typeof deviceDetection;
  36. };
  37. export default UCloudRTC;
  38. }
  39. declare module '__urtc-sdk/logger' {
  40. export enum ENUM_LOG_LEVEL {
  41. debug = 0,
  42. info = 1,
  43. warn = 2,
  44. error = 3
  45. }
  46. export class Logger {
  47. constructor(level?: ENUM_LOG_LEVEL);
  48. setLogLevel(level: string): void;
  49. debug(...args: any[]): void;
  50. info(...args: any[]): void;
  51. warn(...args: any[]): void;
  52. error(...args: any[]): void;
  53. report(...args: any[]): void;
  54. onLog({}: {}): void;
  55. onWarn({}: {}): void;
  56. onError({}: {}): void;
  57. set onReport(cb: ((...args: any[]) => void) | undefined);
  58. }
  59. const _default: Logger;
  60. export default _default;
  61. }
  62. declare module '__urtc-sdk/client' {
  63. import { UserRole, User, Stream, AudioStats, VideoStats, NetworkStats, LeaveRoomOptions, ClientOptions, DeviceOptions, DeviceDetectionOptions, DeviceDetectionResult, PublishOptions, AudioVolumeOptions, EventType, RecordOptions, Record, SwitchDeviceOptions, SwitchImageOptions, EffectOptions, EffectVolumeOptions, SnapshotOptions, ReplaceTrackOptions, MixOptions, StopMixOptions, MixResult, AddMixStreamsOptions, RemoveMixStreamsOptions, StartRecordOptions, RecordResult, UpdateMixStreamsOptions, StartRelayOptions, RelayResult, UpdateRelayPushURLOptions, UpdateRelayLayoutOptions, PlayOptions, VideoProfileOptions, CustomVideoProfile, GetDevicesOptions, CreateStreamOptions } from '__urtc-sdk/types';
  64. export default class Client {
  65. constructor(appId: string, token: string, options?: ClientOptions);
  66. setRole(role: UserRole): boolean;
  67. joinRoom(roomId: string, userId: string, onSuccess?: (users: Array<User>, streams: Array<Stream>) => void, onFailure?: (data?: any) => void): void;
  68. leaveRoom(options?: LeaveRoomOptions, onSuccess?: () => void, onFailure?: (data?: any) => void): void;
  69. publish(options?: PublishOptions, onFailure?: (err: Error) => void): void;
  70. unpublish(streamId?: string, onSuccess?: (stream: Stream) => void, onFailure?: (err: Error) => void): void;
  71. subscribe(streamId: string, onFailure?: (Error?: any) => void): void;
  72. unsubscribe(streamId: string, onSuccess?: (stream: Stream) => void, onFailure?: (err: Error) => void): void;
  73. on(event: EventType, listener: (data?: any) => void): void;
  74. off(event: EventType, listener: (data?: any) => void): void;
  75. muteAudio(streamId?: string): boolean;
  76. unmuteAudio(streamId?: string): boolean;
  77. muteVideo(streamId?: string): boolean;
  78. unmuteVideo(streamId?: string): boolean;
  79. startRecording(options: RecordOptions, onSuccess?: (data: Record) => void, onFailure?: (data?: any) => void): void;
  80. stopRecording(onSuccess?: () => void, onFailure?: (data?: any) => void): void;
  81. getUser(): User | undefined;
  82. getUsers(): User[];
  83. sync(cb: (err?: Error) => void): void;
  84. getStream(streamId?: string): Stream | undefined;
  85. getLocalStreams(): Stream[];
  86. getRemoteStreams(): Stream[];
  87. getStreams(): Stream[];
  88. getMediaStream(streamId?: string): MediaStream | undefined;
  89. getLocalMediaStream(streamId?: string): MediaStream | undefined;
  90. getRemoteMediaStream(streamId: string): MediaStream | undefined;
  91. play(options: PlayOptions, callback: (err?: Error) => void): void;
  92. resume(streamId: string, callback: (err?: Error) => void): void;
  93. pause(streamId: string, callback: (err?: Error) => void): void;
  94. stop(streamId: string, callback: (err?: Error) => void): void;
  95. getMicrophones(opts?: GetDevicesOptions, onSuccess?: (data: MediaDeviceInfo[]) => void, onFailure?: (data?: any) => void): void;
  96. getCameras(opts?: GetDevicesOptions, onSuccess?: (data: MediaDeviceInfo[]) => void, onFailure?: (data?: any) => void): void;
  97. getLoudspeakers(onSuccess?: (data: MediaDeviceInfo[]) => void, onFailure?: (data?: any) => void): void;
  98. setVideoProfile(options: string | CustomVideoProfile | VideoProfileOptions, onSuccess?: () => void, onFailure?: (data?: any) => void): void;
  99. switchDevice(options: SwitchDeviceOptions, onSuccess?: (data?: any) => void, onFailure?: (data?: any) => void): void;
  100. switchScreen(streamId?: string, onSuccess?: (data?: any) => void, onFailure?: (data?: any) => void): void;
  101. switchImage(options: SwitchImageOptions, onSuccess?: (data?: any) => void, onFailure?: (data?: any) => void): void;
  102. getAudioVolume(streamId?: string): number;
  103. setAudioVolume(options: AudioVolumeOptions, callback?: (data?: any) => void): void;
  104. getAudioStats(streamId?: string, onSuccess?: (data: AudioStats) => void, onFailure?: (data?: any) => void): void;
  105. getVideoStats(streamId?: string, onSuccess?: (data: VideoStats) => void, onFailure?: (data?: any) => void): void;
  106. getNetworkStats(streamId?: string, onSuccess?: (data: NetworkStats) => void, onFailure?: (data?: any) => void): void;
  107. preloadEffect(effectId: number, filePath: string, callback?: (err?: Error) => void): void;
  108. unloadEffect(effectId: number): void;
  109. playEffect(options: EffectOptions, callback?: (err?: Error) => void): void;
  110. pauseEffect(options: EffectOptions, callback?: (data?: any) => void): void;
  111. resumeEffect(options: EffectOptions, callback?: (data?: any) => void): void;
  112. stopEffect(options: EffectOptions, callback?: (data?: any) => void): void;
  113. setEffectVolume(options: EffectVolumeOptions, callback?: (data?: any) => void): void;
  114. snapshot(options?: SnapshotOptions, onSuccess?: (data: string) => void, onFailure?: (data?: any) => void): void;
  115. startPreviewing(options?: DeviceOptions, onSuccess?: (stream: MediaStream) => void, onFailure?: (data?: any) => void): void;
  116. stopPreviewing(): void;
  117. deviceDetection(options: DeviceDetectionOptions, callback: (result: DeviceDetectionResult) => void): void;
  118. replaceTrack(options: ReplaceTrackOptions, callback?: (err?: any, track?: MediaStreamTrack) => void): void;
  119. startMix(options: MixOptions, callback?: (err?: Error, data?: MixResult) => void): void;
  120. stopMix(options: StopMixOptions, callback?: (err?: Error, data?: MixResult) => void): void;
  121. queryMix(callback?: (err?: Error, data?: MixResult) => void): void;
  122. addMixStreams(options: AddMixStreamsOptions, callback?: (err?: Error, data?: MixResult) => void): void;
  123. removeMixStreams(options: RemoveMixStreamsOptions, callback?: (err?: Error, data?: MixResult) => void): void;
  124. startRecord(options: StartRecordOptions, callback?: (err?: Error, data?: RecordResult) => void): void;
  125. stopRecord(callback?: (err?: Error, data?: RecordResult) => void): void;
  126. updateRecordStreams(options: UpdateMixStreamsOptions, callback?: (err?: Error, data?: RecordResult) => void): void;
  127. startRelay(options: StartRelayOptions, callback?: (err?: Error, data?: RelayResult) => void): void;
  128. stopRelay(callback?: (err?: Error, data?: RelayResult) => void): void;
  129. updateRelayStreams(options: UpdateMixStreamsOptions, callback?: (err?: Error, data?: RelayResult) => void): void;
  130. updateRelayPushURL(options: UpdateRelayPushURLOptions, callback?: (err?: Error, data?: RelayResult) => void): void;
  131. updateRelayLayout(options: UpdateRelayLayoutOptions, callback?: (err?: Error, data?: RelayResult) => void): void;
  132. createStream(options: CreateStreamOptions, callback: (err?: Error, stream?: Stream) => void): void;
  133. publishStream(streamId: string, callback: (err?: Error, stream?: Stream) => void): void;
  134. unpublishStream(streamId: string, callback: (err?: Error, stream?: Stream) => void): void;
  135. removeStream(streamId: string, callback: (err?: Error) => void): void;
  136. destroyStream(streamId: string, callback: (err?: Error) => void): void;
  137. enableAudioVolumeIndicator(interval?: number): void;
  138. logoff(action: 'quit' | 'reconnect' | 'switch' | 'refresh', users: string[], callback: (err?: Error) => void): void;
  139. }
  140. }
  141. declare module '__urtc-sdk/server' {
  142. export interface ServerConfig {
  143. api: string;
  144. log: string;
  145. signal: string;
  146. }
  147. export const SERVER_CONFIG: ServerConfig;
  148. export function setServers(conf: ServerConfig): void;
  149. }
  150. declare module '__urtc-sdk/resolutions' {
  151. import { CustomVideoProfile } from '__urtc-sdk/types';
  152. export const SUPPORT_RESOLUTIONS: {
  153. '240*180': {
  154. width: number;
  155. height: number;
  156. minFrameRate: number;
  157. maxFrameRate: number;
  158. minVideoBW: number;
  159. maxVideoBW: number;
  160. };
  161. '320*180': {
  162. width: number;
  163. height: number;
  164. minFrameRate: number;
  165. maxFrameRate: number;
  166. minVideoBW: number;
  167. maxVideoBW: number;
  168. };
  169. '320*240': {
  170. width: number;
  171. height: number;
  172. minFrameRate: number;
  173. maxFrameRate: number;
  174. minVideoBW: number;
  175. maxVideoBW: number;
  176. };
  177. '480*360': {
  178. width: number;
  179. height: number;
  180. minFrameRate: number;
  181. maxFrameRate: number;
  182. minVideoBW: number;
  183. maxVideoBW: number;
  184. };
  185. '640*360': {
  186. width: number;
  187. height: number;
  188. minFrameRate: number;
  189. maxFrameRate: number;
  190. minVideoBW: number;
  191. maxVideoBW: number;
  192. };
  193. '640*480': {
  194. width: number;
  195. height: number;
  196. minFrameRate: number;
  197. maxFrameRate: number;
  198. minVideoBW: number;
  199. maxVideoBW: number;
  200. };
  201. '640*480_1': {
  202. width: number;
  203. height: number;
  204. minFrameRate: number;
  205. maxFrameRate: number;
  206. minVideoBW: number;
  207. maxVideoBW: number;
  208. };
  209. '1280*720': {
  210. width: number;
  211. height: number;
  212. minFrameRate: number;
  213. maxFrameRate: number;
  214. minVideoBW: number;
  215. maxVideoBW: number;
  216. };
  217. '1280*720_1': {
  218. width: number;
  219. height: number;
  220. minFrameRate: number;
  221. maxFrameRate: number;
  222. minVideoBW: number;
  223. maxVideoBW: number;
  224. };
  225. '1280*720_2': {
  226. width: number;
  227. height: number;
  228. minFrameRate: number;
  229. maxFrameRate: number;
  230. minVideoBW: number;
  231. maxVideoBW: number;
  232. };
  233. '1280*720_3': {
  234. width: number;
  235. height: number;
  236. minFrameRate: number;
  237. maxFrameRate: number;
  238. minVideoBW: number;
  239. maxVideoBW: number;
  240. };
  241. '1920*1080': {
  242. width: number;
  243. height: number;
  244. minFrameRate: number;
  245. maxFrameRate: number;
  246. minVideoBW: number;
  247. maxVideoBW: number;
  248. };
  249. '1920*1080_1': {
  250. width: number;
  251. height: number;
  252. minFrameRate: number;
  253. maxFrameRate: number;
  254. minVideoBW: number;
  255. maxVideoBW: number;
  256. };
  257. '1920*1080_2': {
  258. width: number;
  259. height: number;
  260. minFrameRate: number;
  261. maxFrameRate: number;
  262. minVideoBW: number;
  263. maxVideoBW: number;
  264. };
  265. '1920*1080_3': {
  266. width: number;
  267. height: number;
  268. minFrameRate: number;
  269. maxFrameRate: number;
  270. minVideoBW: number;
  271. maxVideoBW: number;
  272. };
  273. };
  274. export const INTERNAL_SUPPORT_RESOLUTIONS: {};
  275. export const DEFAULT_PROFILE = "640*480";
  276. export function getSupportProfileNames(): Array<string>;
  277. export function getInternalSupportProfileNames(): Array<string>;
  278. export interface ResolutionAttributes {
  279. videoWidth: number;
  280. videoHeight: number;
  281. minFrameRate: number;
  282. maxFrameRate: number;
  283. minVideoBW: number;
  284. maxVideoBW: number;
  285. }
  286. export interface Resolution {
  287. profileName: string;
  288. video: MediaTrackConstraints;
  289. attributes: ResolutionAttributes;
  290. }
  291. export function getResolution(profile: string): Resolution;
  292. export function getCustomResolution(profile: CustomVideoProfile): Resolution;
  293. }
  294. declare module '__urtc-sdk/version' {
  295. export const version = "1.8.7";
  296. }
  297. declare module '__urtc-sdk/token' {
  298. export function genToken(appId: string, appKey: string, roomId: string, userId: string): string;
  299. export function decode(token: string): any;
  300. export function encode(data: any): string;
  301. const service: {
  302. genToken: typeof genToken;
  303. decode: typeof decode;
  304. encode: typeof encode;
  305. };
  306. export default service;
  307. }
  308. declare module '__urtc-sdk/types' {
  309. export type VideoCodec = 'vp8' | 'h264' | 'h265';
  310. export type AudioCodec = 'opus';
  311. export type RoomType = 'rtc' | 'live';
  312. export type UserRole = 'pull' | 'push' | 'push-and-pull';
  313. export type DeviceType = 'audio' | 'video';
  314. export type EventType = 'user-added' | 'user-removed' | 'stream-added' | 'stream-removed' | 'stream-published' | 'stream-subscribed' | 'mute-video' | 'unmute-video' | 'mute-audio' | 'unmute-audio' | 'screenshare-stopped' | 'connection-state-change' | 'kick-off' | 'network-quality' | 'stream-reconnecting' | 'stream-reconnected' | 'record-notify' | 'relay-notify' | 'volume-indicator' | 'error-notify' | 'stream-playing' | 'stream-paused' | 'player-status-change' | 'first-key-frame' | 'audio-track-interrupted' | 'audio-track-ended';
  315. export type ConnectionState = 'OPEN' | 'CONNECTING' | 'CLOSING' | 'RECONNECTING' | 'CLOSED';
  316. export type WaterMarkPosition = 'left-top' | 'left-bottom' | 'right-top' | 'right-bottom';
  317. export type WaterMarkType = 'time' | 'image' | 'text';
  318. export type MainViewType = 'desktop' | 'screen' | 'camera';
  319. export type NetworkQuality = '0' | '1' | '2' | '3' | '4' | '5' | '6';
  320. export interface ClientOptions {
  321. type?: RoomType;
  322. role?: UserRole;
  323. codec?: VideoCodec;
  324. }
  325. export interface Codecs {
  326. audio: Array<AudioCodec>;
  327. video: Array<VideoCodec>;
  328. }
  329. export type FacingMode = 'user' | 'environment' | 'left' | 'right';
  330. export interface PublishOptions {
  331. audio: boolean;
  332. video: boolean;
  333. screenAudio?: boolean;
  334. screen: boolean;
  335. facingMode?: FacingMode;
  336. microphoneId?: string;
  337. cameraId?: string;
  338. extensionId?: string;
  339. mediaStream?: MediaStream;
  340. file?: File;
  341. filePath?: string;
  342. }
  343. export interface AudioProcessingOptions {
  344. AEC?: boolean;
  345. AGC?: boolean;
  346. ANS?: boolean;
  347. }
  348. export interface CreateStreamOptions extends PublishOptions {
  349. userId?: string;
  350. streamId?: string;
  351. audioProcessing?: AudioProcessingOptions;
  352. }
  353. export interface DeviceOptions {
  354. audio: boolean;
  355. video: boolean;
  356. facingMode?: FacingMode;
  357. microphoneId?: string;
  358. cameraId?: string;
  359. }
  360. export interface DeviceDetectionOptions {
  361. audio: boolean;
  362. video: boolean;
  363. microphoneId?: string;
  364. cameraId?: string;
  365. }
  366. export interface DeviceDetectionResult {
  367. audio: boolean;
  368. audioError?: string;
  369. video: boolean;
  370. videoError?: string;
  371. }
  372. export interface User {
  373. uid: string;
  374. }
  375. export interface Stream {
  376. sid: string;
  377. uid: string;
  378. type: 'publish' | 'subscribe' | 'preview';
  379. mediaType?: 'camera' | 'screen';
  380. video: boolean;
  381. audio: boolean;
  382. muteAudio: boolean;
  383. muteVideo: boolean;
  384. mediaStream?: MediaStream;
  385. sourceAudioMuted?: boolean;
  386. sourceVideoMuted?: boolean;
  387. audioMuted: boolean;
  388. videoMuted: boolean;
  389. previewId?: string;
  390. }
  391. export interface LeaveRoomOptions {
  392. keepRecording: boolean;
  393. }
  394. export interface AudioVolumeOptions {
  395. streamId?: string;
  396. element?: HTMLMediaElement;
  397. volume: number;
  398. }
  399. export interface WaterMarkOptions {
  400. position?: WaterMarkPosition;
  401. type?: WaterMarkType;
  402. remarks?: string;
  403. }
  404. export interface MixStreamOptions {
  405. width?: number;
  406. height?: number;
  407. template?: number;
  408. isAverage?: boolean;
  409. }
  410. export interface RelayOptions {
  411. time?: number;
  412. fragment: number;
  413. }
  414. export interface RecordOptions {
  415. bucket: string;
  416. region: string;
  417. uid?: string;
  418. mainViewType?: MainViewType;
  419. mixStream?: MixStreamOptions;
  420. waterMark?: WaterMarkOptions;
  421. relay?: RelayOptions;
  422. }
  423. export interface Record {
  424. FileName: string;
  425. RecordId: string;
  426. }
  427. export interface EffectOptions {
  428. streamId?: string;
  429. effectId: number;
  430. filePath?: string;
  431. loop?: boolean;
  432. playTime?: number;
  433. replace?: boolean;
  434. onEnd?: () => void;
  435. }
  436. export interface EffectVolumeOptions {
  437. streamId?: string;
  438. effectId: number;
  439. volume: number;
  440. }
  441. export interface SwitchDeviceOptions {
  442. streamId?: string;
  443. type: DeviceType;
  444. deviceId: string;
  445. }
  446. export interface SwitchImageOptions {
  447. streamId?: string;
  448. file?: File;
  449. filePath?: string;
  450. }
  451. export interface SnapshotOptions {
  452. streamId?: string;
  453. download?: string | boolean;
  454. }
  455. export interface AudioStats {
  456. br: number;
  457. lostpre: number;
  458. vol: number;
  459. mime: string;
  460. }
  461. export interface VideoStats {
  462. br: number;
  463. lostpre: number;
  464. frt: number;
  465. w: number;
  466. h: number;
  467. mime: string;
  468. }
  469. export interface NetworkStats {
  470. rtt: number;
  471. }
  472. export interface ReplaceTrackOptions {
  473. streamId?: string;
  474. track: MediaStreamTrack;
  475. retain?: boolean;
  476. }
  477. export type MixType = 'relay' | 'record' | 'relay-and-record' | 'update-config';
  478. export type MixLayoutType = 'flow' | 'main' | 'custom' | 'customMain' | 'customFlow' | 'single';
  479. export type MixAudioCodec = 'aac';
  480. export type MixVideoCodec = 'h264' | 'h265';
  481. export type H264Quality = 'B' | 'CB' | 'M' | 'E' | 'H';
  482. export type MixOutputMode = 'audio-video' | 'audio';
  483. export type MixStreamAddMode = 'automatic' | 'manual';
  484. export interface MixLayoutOptions {
  485. type: MixLayoutType;
  486. standbyTypes?: MixLayoutType[];
  487. custom?: Array<object>;
  488. mainViewUId?: string;
  489. mainViewType?: MainViewType;
  490. }
  491. export interface MixAudioOptions {
  492. codec: MixAudioCodec;
  493. }
  494. export interface MixVideoOptions {
  495. codec: MixVideoCodec;
  496. quality?: H264Quality;
  497. frameRate?: number;
  498. bitRate?: number;
  499. }
  500. export interface BackgroundColorOptions {
  501. r: number;
  502. g: number;
  503. b: number;
  504. }
  505. export interface MixOptions {
  506. type?: MixType;
  507. bucket?: string;
  508. region?: string;
  509. pushURL?: string[];
  510. layout?: MixLayoutOptions;
  511. audio?: MixAudioOptions;
  512. video?: MixVideoOptions;
  513. outputMode?: MixOutputMode;
  514. width?: number;
  515. height?: number;
  516. backgroundColor?: BackgroundColorOptions;
  517. waterMark?: WaterMarkOptions;
  518. streams?: MixStream[];
  519. streamAddMode?: MixStreamAddMode;
  520. timeoutPeriod?: number;
  521. keyUser?: string;
  522. }
  523. export interface StopMixOptions {
  524. type?: MixType;
  525. pushURL?: string[];
  526. }
  527. export interface MixResult {
  528. MixId?: string;
  529. FileName?: string;
  530. Type?: MixType;
  531. PushURL?: string[];
  532. }
  533. export interface MixStream {
  534. uid: string;
  535. mediaType: 'camera' | 'screen';
  536. }
  537. export interface AddMixStreamsOptions {
  538. streams: MixStream[];
  539. }
  540. export interface RemoveMixStreamsOptions {
  541. streams: MixStream[];
  542. }
  543. export interface StartRecordOptions {
  544. bucket: string;
  545. region: string;
  546. layout?: MixLayoutOptions;
  547. audio?: MixAudioOptions;
  548. video?: MixVideoOptions;
  549. width?: number;
  550. height?: number;
  551. backgroundColor?: BackgroundColorOptions;
  552. waterMark?: WaterMarkOptions;
  553. streams?: MixStream[];
  554. outputMode?: MixOutputMode;
  555. streamAddMode?: MixStreamAddMode;
  556. keyUser?: string;
  557. }
  558. export interface RecordResult {
  559. Id?: string;
  560. FileName?: string;
  561. }
  562. export type UpdateMixStreamsType = 'add' | 'remove' | 'replace';
  563. export interface UpdateMixStreamsOptions {
  564. type: UpdateMixStreamsType;
  565. streams: MixStream[];
  566. }
  567. export interface StartRelayOptions {
  568. pushURL?: string[];
  569. layout?: MixLayoutOptions;
  570. audio?: MixAudioOptions;
  571. video?: MixVideoOptions;
  572. width?: number;
  573. height?: number;
  574. backgroundColor?: BackgroundColorOptions;
  575. waterMark?: WaterMarkOptions;
  576. streams?: MixStream[];
  577. outputMode?: MixOutputMode;
  578. streamAddMode?: MixStreamAddMode;
  579. keyUser?: string;
  580. }
  581. export interface RelayResult {
  582. Id?: string;
  583. PushURL?: string[];
  584. }
  585. export type UpdateRelayPushURLType = 'add' | 'remove' | 'replace';
  586. export interface UpdateRelayPushURLOptions {
  587. type: UpdateRelayPushURLType;
  588. pushURL: string[];
  589. }
  590. export interface UpdateRelayLayoutOptions {
  591. layout: MixLayoutOptions;
  592. }
  593. export interface UpdateRelayWaterMarkOptions {
  594. waterMark: WaterMarkOptions;
  595. }
  596. export type VideoFitType = 'cover' | 'contain';
  597. export type PlayControlsOption = 'show' | 'hide' | 'auto';
  598. export interface PlayOptions {
  599. streamId: string;
  600. container: HTMLElement | string;
  601. mute?: boolean;
  602. mirror?: boolean;
  603. fit?: VideoFitType;
  604. controls?: PlayControlsOption;
  605. }
  606. export interface CustomVideoProfile {
  607. width: number;
  608. height: number;
  609. framerate: number;
  610. bitrate: number;
  611. }
  612. export interface VideoProfileOptions {
  613. streamId?: string;
  614. previewId?: string;
  615. profile: string | CustomVideoProfile;
  616. }
  617. export interface MixNotification {
  618. code: string;
  619. message: string;
  620. }
  621. export interface ErrorNotification {
  622. code: string;
  623. message: string;
  624. }
  625. export interface AudioVolume {
  626. sid: string;
  627. uid: string;
  628. mediaType: 'camera' | 'screen';
  629. volume: number;
  630. }
  631. export interface PlayerStatusEvent {
  632. type: 'audio' | 'video';
  633. status: 'playing' | 'paused';
  634. stream: Stream;
  635. }
  636. export interface GetDevicesOptions {
  637. microphone?: boolean;
  638. camera?: boolean;
  639. }
  640. }