1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-12 04:25:05 -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) { client.on('jingle:incoming', function (session) {
var contact = me.getContact(session.peer); var contact = me.getContact(session.peer);
contact.callState = 'incoming'; contact.callState = 'incomingCall';
contact.jingleCall = session; contact.jingleCall = session;
}); });
client.on('jingle:outgoing', function (session) { client.on('jingle:outgoing', function (session) {
var contact = me.getContact(session.peer); var contact = me.getContact(session.peer);
contact.callState = 'outgoing'; contact.callState = 'outgoingCall';
contact.jingleCall = session; contact.jingleCall = session;
}); });
@ -354,7 +354,7 @@ module.exports = function (client, app) {
client.on('jingle:accepted', function (session) { client.on('jingle:accepted', function (session) {
var contact = me.getContact(session.peer); var contact = me.getContact(session.peer);
contact.callState = 'active'; contact.callState = 'activeCall';
}); });
client.on('jingle:localstream:added', function (stream) { client.on('jingle:localstream:added', function (stream) {
@ -368,11 +368,13 @@ module.exports = function (client, app) {
client.on('jingle:remotestream:added', function (session) { client.on('jingle:remotestream:added', function (session) {
var contact = me.getContact(session.peer); var contact = me.getContact(session.peer);
contact.stream = session.stream; contact.stream = session.stream;
contact.trigger('change:stream');
}); });
client.on('jingle:remotestream:removed', function (session) { client.on('jingle:remotestream:removed', function (session) {
var contact = me.getContact(session.peer); var contact = me.getContact(session.peer);
contact.stream = null; contact.stream = null;
contact.trigger('change:stream');
}); });
client.on('jingle:ringing', function (session) { client.on('jingle:ringing', function (session) {

View File

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

View File

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

View File

@ -160,7 +160,7 @@ exports.misc.growlMessage = function anonymous(locals) {
exports.pages.chat = function anonymous(locals) { exports.pages.chat = function anonymous(locals) {
var buf = []; var buf = [];
with (locals || {}) { 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(""); return buf.join("");
}; };

View File

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

View File

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

View File

@ -652,6 +652,16 @@ h3 {
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
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 { .conversation header {
padding: 5px; padding: 5px;
border-bottom: 2px solid #e4e4e4; border-bottom: 2px solid #e4e4e4;
@ -689,7 +699,7 @@ h3 {
.conversation header .tzo:not(:empty) { .conversation header .tzo:not(:empty) {
position: absolute; position: absolute;
right: 15px; right: 15px;
top: 50%; top: 25px;
height: 20px; height: 20px;
margin-top: -10px; margin-top: -10px;
padding: 0 5px; padding: 0 5px;

View File

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