The read-only property
RTCDTMFToneChangeEvent.tone
returns the DTMF character which has just begun to play, or an empty string (
""
). if all queued tones have finished playing (that is,
RTCDTMFSender.toneBuffer
is empty).
var tone = dtmfToneChangeEvent.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>".
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 'RTCDTMFToneChangeEvent.tone' in that specification. |
候选推荐 | 最初的规范。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
tone
|
Chrome 27 | Edge 12 | Firefox 52 | IE No | Opera Yes | Safari ? | WebView Android 4.4 | Chrome Android 27 | Firefox Android 52 | Opera Android Yes | Safari iOS ? | Samsung Internet Android 1.5 |
完整支持
不支持
兼容性未知
RTCDTMFToneChangeEvent
tone
MediaDevices.getUserMedia()
Navigator.mediaDevices
RTCCertificate
RTCDTMFSender
RTCDataChannel
RTCDataChannelEvent
RTCDtlsTransport
RTCErrorEvent
RTCIceCandidate
RTCIceTransport
RTCPeerConnection
RTCPeerConnectionIceErrorEvent
RTCPeerConnectionIceEvent
RTCRtpReceiver
RTCRtpSender
RTCRtpTransceiver
RTCSctpTransport
RTCSessionDescription
RTCStatsEvent
RTCStatsReport
RTCTrackEvent