yirtc-sdk-web
Version:
基于WebRTC的实时音视频SDK
65 lines (64 loc) • 2.19 kB
TypeScript
import { RTCInterface, RTCConfig } from './interface';
/**
* Web RTC适配器
* 实现Web平台的WebRTC功能
*/
export declare class WebRTCAdapter implements RTCInterface {
private logger;
/**
* 构造函数
*/
constructor();
/**
* 创建对等连接
* @param config RTC配置
* @returns RTCPeerConnection
*/
createPeerConnection(config?: RTCConfig): RTCPeerConnection;
/**
* 创建SDP offer
* @param peerConnection 对等连接
* @param options offer选项
* @returns Promise<RTCSessionDescriptionInit>
*/
createOffer(peerConnection: RTCPeerConnection, options?: RTCOfferOptions): Promise<RTCSessionDescriptionInit>;
/**
* 创建SDP answer
* @param peerConnection 对等连接
* @param options answer选项
* @returns Promise<RTCSessionDescriptionInit>
*/
createAnswer(peerConnection: RTCPeerConnection, options?: RTCAnswerOptions): Promise<RTCSessionDescriptionInit>;
/**
* 设置本地描述
* @param peerConnection 对等连接
* @param description 会话描述
* @returns Promise<void>
*/
setLocalDescription(peerConnection: RTCPeerConnection, description: RTCSessionDescriptionInit): Promise<void>;
/**
* 设置远程描述
* @param peerConnection 对等连接
* @param description 会话描述
* @returns Promise<void>
*/
setRemoteDescription(peerConnection: RTCPeerConnection, description: RTCSessionDescriptionInit): Promise<void>;
/**
* 添加ICE候选
* @param peerConnection 对等连接
* @param candidate ICE候选
* @returns Promise<void>
*/
addIceCandidate(peerConnection: RTCPeerConnection, candidate: RTCIceCandidateInit): Promise<void>;
/**
* 获取统计信息
* @param peerConnection 对等连接
* @returns Promise<RTCStatsReport>
*/
getStats(peerConnection: RTCPeerConnection): Promise<RTCStatsReport>;
/**
* 关闭对等连接
* @param peerConnection 对等连接
*/
closePeerConnection(peerConnection: RTCPeerConnection): void;
}