Re: DTMF v4

On 12/14/2012 11:39 AM, Harald Alvestrand wrote:
> Appropriate changes from on-call discussion and subsequent email 
> exchanges have been applied.
> I think there's now consensus to take this to the editors.
>
> Harald
I forgot to include the examples I promised....

Examples
======

Examples assume that “pc” is a connected PeerConnection, and “track” is 
an audio track on that connection.

Sending the DTMF signal “1234” with 500 ms per tone:

sender = pc.createDTMFSender(track);
if (sender.canSendDTMF) {
sender.insertDTMF(“1234”, 500);
} else {
alert(‘DTMF function not available’);
}

Sending the DTMF signal “1234”, and lighting up a key using 
“lightKey(x)” while the tone is playing (assuming that lightKey(‘’) will 
darken all the keys):

sender = pc.createDTMFSender(track);
sender.ontonechange = function(e) {
lightKey(e.tone);
}
sender.insertDTMF(‘1234’);

Sending an 1-second “1” tone followed by a 2-second “2” tone:

sender = pc.createDTMFSender(track);
sender.ontonechange = function(e) {
if (e.tone == ‘’) {
sender.insertDTMF(‘2’, 2000);
}
}
sender.insertDTMF(‘1’, 1000);

Sending the tone string ‘12345’, and appending the tone string ‘6789’ 
before the tone finishes playing:

sender = pc.createDTMFSender(track);
sender.insertDTMF(‘12345’);
// Other things happen.....
sender.insertDTMF(sender.toneBuffer + ‘6789’);

This is safe due to the Javascript threading model.

Received on Friday, 14 December 2012 13:53:46 UTC