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

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
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

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

元数据

  • 最后修改: