玩 WebRTC 的时候发现它居然内置支持了 DTMF 拨号音。这里就简单科普一下,DTMF 就是手机电话拨号音,数字按键按下去嘟嘟嘟响那个。具体就2个频率调谐:DTMF1209Hz1336Hz1477Hz1633Hz697Hz123A770Hz456B852Hz789C941Hz*0#D于是兴趣来了想做一个 demo 玩玩,写了半天调试不通,报错VM987:1 Uncaught DOMException: Failed to execute 'insertDTMF' on 'RTCDTMFSender': The 'canInsertDTMF' attribute is false: this sender cannot send DTMF.仔细研究了下这玩意,原来 WebRTC 不直接传音频,而是发一个控制信号,由接收方播放出音频,所以你需要本地创建一个真实的双工 RTC 并打开麦克风权限,才能播放DTMF音频。WebRTC doesn't send DTMF codes as audio data. Instead, they're sent out-of-band, as RTP payloads. Note, however, that although it's possible to send DTMF using WebRTC, there is currently
...
继续阅读
(73)