1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-22 09:12:19 -05:00

Auto answer calls so that it works for now

This commit is contained in:
Lance Stout 2013-10-16 13:02:03 -07:00
parent 7e2268f2c5
commit 92c37b3235
6 changed files with 9 additions and 29 deletions

View File

@ -62,6 +62,8 @@ module.exports = {
self.api = window.client = StanzaIO.createClient(config);
xmppEventHandlers(self.api, self);
self.api.jingle.startLocalMedia();
self.api.once('session:started', function () {
app.state.hasConnected = true;
cb();

View File

@ -355,6 +355,7 @@ module.exports = function (client, app) {
state: 'incoming',
jingleSession: session
});
session.accept();
contact.jingleCall = call;
me.calls.add(call);
});

View File

@ -176,11 +176,7 @@ module.exports = HumanModel.define({
if (this.jingleResources.length) {
var peer = this.jingleResources[0];
this.callState = 'starting';
app.api.jingle.startLocalMedia(null, function (err) {
if (!err) {
app.api.call(peer.id);
}
});
app.api.call(peer.id);
} else {
logger.error('no jingle resources for this user');
}

View File

@ -23,9 +23,6 @@ module.exports = BasePage.extend(chatHelpers).extend({
this.listenTo(this.model.messages, 'change:edited', this.refreshModel);
this.listenTo(this.model.messages, 'change:pending', this.refreshModel);
this.listenTo(this.model, 'change:onCall', this.handleCall);
this.listenTo(this.model, 'change:stream', this.handleStream);
this.render();
},
events: {
@ -226,20 +223,6 @@ module.exports = BasePage.extend(chatHelpers).extend({
this.scrollIfPinned();
},
handleCall: function () {
if (this.model.onCall) {
/*
attachMediaStream(me.stream, this.$('video.local')[0], {
mirror: true,
muted: true
});
*/
}
},
handleStream: function (model, stream) {
console.log(arguments);
attachMediaStream(stream, this.$('video.remote')[0]);
},
handleEndClick: function (e) {
e.preventDefault();
this.model.jingleCall.end({

View File

@ -37,12 +37,10 @@ module.exports = HumanView.extend({
handleAnswerClick: function (e) {
e.preventDefault();
var self = this;
app.api.jingle.startLocalMedia(null, function () {
self.model.jingleSession.accept();
self.model.state = 'active';
app.navigate('/chat/' + self.model.contact.jid);
self.model.contact.onCall = true;
});
self.model.state = 'active';
app.navigate('/chat/' + self.model.contact.jid);
self.model.contact.onCall = true;
self.model.jingleSession.accept();
return false;
},
handleIgnoreClick: function (e) {

View File

@ -23,7 +23,7 @@
"templatizer": "0.1.2",
"underscore": "1.5.1",
"raf-component": "1.1.1",
"stanza.io": "2.5.12",
"stanza.io": "2.5.14",
"notify.js": "0.0.3",
"wildemitter": "0.0.5",
"attachmediastream": "1.0.1",