Fix a problem with accessing peerconnection, use duration and pause in the API.

This commit is contained in:
Boris Grozev 2015-04-12 14:23:50 +02:00
parent 0efcbdcd37
commit 134d89a3d6
1 changed files with 8 additions and 5 deletions

View File

@ -13,11 +13,12 @@ var initDtmfSender = function() {
var localAudio = APP.RTC.localAudio;
if (localAudio && localAudio.getTracks().length > 0)
{
var peerconnection =
APP.xmpp.getConnection().jingle.activecall.peerconnection.peerconnection;
var peerconnection
= APP.xmpp.getConnection().jingle.activecall.peerconnection;
if (peerconnection) {
DTMFSender =
peerconnection.createDTMFSender(localAudio.getTracks()[0]);
peerconnection.peerconnection
.createDTMFSender(localAudio.getTracks()[0]);
console.log("Initialized DTMFSender");
}
else {
@ -30,12 +31,14 @@ var initDtmfSender = function() {
};
var DTMF = {
sendTones: function (tones) {
sendTones: function (tones, duration, pause) {
if (!DTMFSender)
initDtmfSender();
if (DTMFSender){
DTMFSender.insertDTMF(tones);
DTMFSender.insertDTMF(tones,
(duration || 200),
(pause || 200));
}
}
};