tonechange
event is sent to an
RTCDTMFSender
通过
WebRTC API
to indicate when
DTMF
tones previously queued for sending (by calling
RTCDTMFSender.insertDTMF()
) begin and end.
| 冒泡 | No |
|---|---|
| 可取消 | No |
| 接口 |
RTCDTMFToneChangeEvent
|
| 事件处理程序特性 |
ontonechange
|
To determine what tone started playing, or if a tone stopped playing, check the value of the event's
tone
特性。
This example establishes a handler for the
tonechange
event which updates an element to display the currently playing tone in its content, or, if all tones have played, the string "<none>".
This can be done using
addEventListener()
:
dtmfSender.addEventListener("tonechange", ev => {
let tone = ev.tone;
if (tone === "") {
tone = "<none>";
}
document.getElementById("playingTone").innerText = tone;
}, false);
You can also just set the
ontonechange
event handler property directly:
dtmfSender.ontonechange = function( ev ) {
let tone = ev.tone;
if (tone === "") {
tone = "<none>"
}
document.getElementById("playingTone").innerText = tone;
};
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'tonechange' in that specification. |
候选推荐 | Definition for the WebRTC API |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
tonechange
event
|
Chrome 27 | Edge ≤79 | Firefox 52 | IE No | Opera Yes | Safari ? | WebView Android Yes | Chrome Android 27 | Firefox Android 52 | Opera Android Yes | Safari iOS ? | Samsung Internet Android 1.5 |
完整支持
不支持
兼容性未知