WebRTC API

The WebRTC API

The public API of the WebRTC library consists of the api/ directory and its subdirectories. No other files should be depended on by webrtc users.

WebRTC库的公共API由API/目录及其子目录组成。webrtc用户不应依赖任何其他文件。

Before starting to code against the API, it is important to understand some basic concepts, such as:

在开始针对API进行编码之前,了解一些基本概念是很重要的,例如:

  • Memory management, including webrtc's reference counted objects
  • 内存管理,包括webrtc的引用计数对象
  • Thread management
  • 线程管理

Using WebRTC through the PeerConnection class

通过PeerConnection类使用WebRTC

The PeerConnectionInterface class is the recommended way to use the WebRTC library.

​PeerConnectionInterface类是使用WebRTC库的推荐方法。

It is closely modeled after the Javascript API documented in the WebRTC specification.

​它是根据WebRTC规范中记录的Javascript API进行紧密建模的。

PeerConnections are created using the PeerConnectionFactoryInterface.

​PeerConnection是使用PeerConnectionFactoryInterface创建的。

There are two levels of customization available:

有两个级别的自定义可用:

  • Pass a PeerConnectionFactoryDependencies object to the function that creates a PeerConnectionFactory. This object defines factories for a lot of internal objects inside the PeerConnection, so that users can override them. All PeerConnections using this interface will have the same options.
  • 将PeerConnectionFactoryDependencies对象传递给创建PeerConnection Factory的函数。这个对象为PeerConnection内部的许多内部对象定义了工厂,这样用户就可以覆盖它们。使用此接口的所有对等连接都将具有相同的选项。
  • Pass a PeerConnectionInterface::RTCConfiguration object to the CreatePeerConnectionOrError() function on the PeerConnectionFactoryInterface. These customizations will apply only to a single PeerConnection.
  • 将PeerConnectionInterface::RTCConfiguration对象传递给PeerConnectionFactoryInterface上的CreatePeerConnectionOrError()函数。这些自定义将仅适用于单个对等连接。

Most functions on the PeerConnection interface are asynchronous, and take a callback that is executed when the function is finished. The callbacks are mostly called on the thread that is passed as the “signaling thread” field of the PeerConnectionFactoryDependencies, or the thread that called PeerConnectionFactory::CreatePeerConnectionOrError() if no thread is given.

PeerConnection接口上的大多数函数都是异步的,并在函数完成时执行回调。回调主要在作为PeerConnectionFactoryDependencies的“信号线程”字段传递的线程上调用,或者在没有给定线程的情况下调用PeerConnection Factory::CreatePeerConnectivationOrError()的线程上。

See each class' module documentation for details.

有关详细信息,请参阅每个类的模块文档。

Using WebRTC components without the PeerConnection class

使用不带PeerConnection类的WebRTC组件

This needs to be done carefully, and in consultation with the WebRTC team. There are non-obvious dependencies between many of the components.

这需要仔细进行,并与WebRTC团队协商。许多组件之间存在不明显的依赖关系。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

꧁白杨树下꧂

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值