1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-22 17:22:22 -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); self.api = window.client = StanzaIO.createClient(config);
xmppEventHandlers(self.api, self); xmppEventHandlers(self.api, self);
self.api.jingle.startLocalMedia();
self.api.once('session:started', function () { self.api.once('session:started', function () {
app.state.hasConnected = true; app.state.hasConnected = true;
cb(); cb();

View File

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

View File

@ -176,11 +176,7 @@ module.exports = HumanModel.define({
if (this.jingleResources.length) { if (this.jingleResources.length) {
var peer = this.jingleResources[0]; var peer = this.jingleResources[0];
this.callState = 'starting'; this.callState = 'starting';
app.api.jingle.startLocalMedia(null, function (err) {
if (!err) {
app.api.call(peer.id); app.api.call(peer.id);
}
});
} else { } else {
logger.error('no jingle resources for this user'); 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:edited', this.refreshModel);
this.listenTo(this.model.messages, 'change:pending', 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(); this.render();
}, },
events: { events: {
@ -226,20 +223,6 @@ module.exports = BasePage.extend(chatHelpers).extend({
this.scrollIfPinned(); 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) { handleEndClick: function (e) {
e.preventDefault(); e.preventDefault();
this.model.jingleCall.end({ this.model.jingleCall.end({

View File

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

View File

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