RTCDTMFSender.insertDTMF() - Web APIs 编辑

The insertDTMF() method on the RTCDTMFSender interface starts sending DTMF tones to the remote peer over the RTCPeerConnection. Sending of the tones is performed asynchronously, with tonechange events sent to the RTCDTMFSender every time a tone starts or ends.

As long as the connection is active, you can send tones at any time. Calling insertDTMF() will append the specified tones to the end of the current tone buffer, so that those tones play after the previously-enqueued tones.

Syntax

RTCDTMFSender.insertDTMF(tones[, duration[, interToneGap]]);

Parameters

tones
A DOMString containing the DTMF codes to be transmitted to the recipient. Specifying an empty string as the tones parameter clears the tone buffer, aborting any currently queued tones. A "," character inserts a two second delay.
duration Optional
The amount of time, in milliseconds, that each DTMF tone should last. This value must be between 40 ms and 6000 ms (6 seconds), inclusive. The default is 100 ms.
interToneGap Optional
The length of time, in milliseconds, to wait between tones. The browser will enforce a minimum value of 30 ms (that is, if you specify a lower value, 30 ms will be used instead); the default is 70 ms.

Return value

undefined

Exceptions

InvalidStateError
The DTMF tones couldn't be sent because the track has been stopped, or is in a read-only or inactive state.
InvalidCharacterError
One or more of the characters in tones is not valid DTMF.

Example

tbd

Specifications

SpecificationStatusComment
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCDTMFSender.insertDTMF()' in that specification.
Candidate Recommendation

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:81 次

字数:4043

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文