为RTP(实时传输协议)提供API,允许应用程序管理按需或交互式数据流。 特别是,提供VOIP,即按即说,会议和音频流的应用可以使用这些API发起会话,并通过任何可用的网络传输或接收数据流。
为了支持音频会议和类似的用法,你需要实例化两个类作为流的端点:
AudioStream specifies a remote endpoint and consists of network mapping and a configured AudioCodec.AudioGroup represents the local endpoint for one or more AudioStreams. The AudioGroup mixes all the AudioStreams and optionally interacts with the device speaker and the microphone at the same time.最简单的用法涉及单个远程端点和本地端点。 有关更复杂的用法,请参阅AudioGroup描述的限制。
注意:要使用RTP API,您必须在清单文件中请求 INTERNET和 RECORD_AUDIO权限。
| AudioCodec | 这个类定义了一组与 AudioStream一起使用的音频编解码器。 |
| AudioGroup | AudioGroup是扬声器,麦克风和 AudioStream的音频中心。 |
| AudioStream | AudioStream是一个 RtpStream ,它通过实时传输协议(RTP)提供音频有效载荷。 |
| RtpStream | RtpStream表示通过实时传输协议(RTP)发送和接收包含媒体载荷的网络数据包的流的基类。 |