1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-12-24 08:28:56 -05:00

Make things mostly work

This commit is contained in:
Lance Stout 2013-10-15 01:01:49 -07:00
parent 1963bcebe1
commit 4022b53a86
8 changed files with 38 additions and 10 deletions

View File

@ -336,13 +336,13 @@ module.exports = function (client, app) {
client.on('jingle:incoming', function (session) {
var contact = me.getContact(session.peer);
contact.callState = 'incoming';
contact.callState = 'incomingCall';
contact.jingleCall = session;
});
client.on('jingle:outgoing', function (session) {
var contact = me.getContact(session.peer);
contact.callState = 'outgoing';
contact.callState = 'outgoingCall';
contact.jingleCall = session;
});
@ -354,7 +354,7 @@ module.exports = function (client, app) {
client.on('jingle:accepted', function (session) {
var contact = me.getContact(session.peer);
contact.callState = 'active';
contact.callState = 'activeCall';
});
client.on('jingle:localstream:added', function (stream) {
@ -368,11 +368,13 @@ module.exports = function (client, app) {
client.on('jingle:remotestream:added', function (session) {
var contact = me.getContact(session.peer);
contact.stream = session.stream;
contact.trigger('change:stream');
});
client.on('jingle:remotestream:removed', function (session) {
var contact = me.getContact(session.peer);
contact.stream = null;
contact.trigger('change:stream');
});
client.on('jingle:ringing', function (session) {

View File

@ -46,7 +46,7 @@ module.exports = HumanModel.define({
topResource: 'string',
unreadCount: ['number', true, 0],
_forceUpdate: ['number', true, 0],
callState: 'string',
callState: ['string', true, ''],
stream: 'object'
},
derived: {

View File

@ -39,6 +39,9 @@ module.exports = BasePage.extend(chatHelpers).extend({
displayName: 'header .name',
formattedTZO: 'header .tzo'
},
classBindings: {
callState: '.conversation'
},
show: function (animation) {
BasePage.prototype.show.apply(this, [animation]);
client.sendMessage({
@ -196,8 +199,9 @@ module.exports = BasePage.extend(chatHelpers).extend({
this.$('button.call').prop('disabled', !resources.length);
},
handleStream: function () {
if (this.model.stream) {
attachMediaStream(this.model.stream, this.$('.remoteVideo'));
this.attach = attachMediaStream;
if (!!this.model.stream) {
attachMediaStream(this.model.stream, this.$('.remoteVideo')[0]);
}
},
appendModel: function (model, preload) {

View File

@ -160,7 +160,7 @@ exports.misc.growlMessage = function anonymous(locals) {
exports.pages.chat = function anonymous(locals) {
var buf = [];
with (locals || {}) {
buf.push('<section class="page chat"><section class="conversation"><header><img class="avatar"/><h1 class="name"></h1><div class="tzo"></div><button class="call">call</button></header><ul class="messages scroll-container"></ul><div class="chatBox"><form><textarea name="chatInput" type="text" placeholder="Send a message..." autocomplete="off"></textarea></form></div></section></section>');
buf.push('<section class="page chat"><section class="conversation"><header><img class="avatar"/><h1 class="name"></h1><div class="tzo"></div><button class="call">call</button><video class="remoteVideo"></video></header><ul class="messages scroll-container"></ul><div class="chatBox"><form><textarea name="chatInput" type="text" placeholder="Send a message..." autocomplete="off"></textarea></form></div></section></section>');
}
return buf.join("");
};

View File

@ -5,6 +5,7 @@ section.page.chat
h1.name
.tzo
button.call call
video.remoteVideo
ul.messages.scroll-container
.chatBox
form

View File

@ -16,6 +16,17 @@
width: 100%
borderbox()
.remoteVideo
display: none
&.activeCall
.remoteVideo
width: 100%
display: block
.messages
padding-top: 630px
header
padding: 5px
border-bottom: 2px solid $grayOutline
@ -44,7 +55,7 @@
.tzo:not(:empty)
position: absolute
right: 15px
top: 50%
top: 25px
height: 20px
margin-top: -10px
padding: 0 5px

View File

@ -652,6 +652,16 @@ h3 {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.conversation .remoteVideo {
display: none;
}
.conversation.activeCall .remoteVideo {
width: 100%;
display: block;
}
.conversation.activeCall .messages {
padding-top: 630px;
}
.conversation header {
padding: 5px;
border-bottom: 2px solid #e4e4e4;
@ -689,7 +699,7 @@ h3 {
.conversation header .tzo:not(:empty) {
position: absolute;
right: 15px;
top: 50%;
top: 25px;
height: 20px;
margin-top: -10px;
padding: 0 5px;

View File

@ -1,5 +1,5 @@
CACHE MANIFEST
# 0.0.1 1381820535074
# 0.0.1 1381823999689
CACHE:
/app.js