repo: janusweb
action: commit
revision: 
path_from: 
revision_from: e927cf731a4ecb86dd307413e3215f0f146edc5d:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit e927cf731a4ecb86dd307413e3215f0f146edc5d
Author: James Baicoianu 
Date:   Tue Apr 19 20:50:49 2016 -0700

    VOIP buffer fix, show animations for typing and running

diff --git a/scripts/janusweb.js b/scripts/janusweb.js
index 131a65fe02c5463e991bf24aff3bff1528ed1de1..
index ..3721077170750ce394bf67e841a171539ff0825b 100644
--- a/scripts/janusweb.js
+++ b/scripts/janusweb.js
@@ -304,9 +304,9 @@ console.log('new player!', userId);
         this.sentUpdates = 0;
       }

-      if (player.VOIPbuffers && player.VOIPbuffers.length > 4) {
+      if (player.VOIPbuffers && player.VOIPbuffers.length > 0) {
         var binary = '';
-        while (player.VOIPbuffers.length > 4) {
+        while (player.VOIPbuffers.length > 0) {
           var buf = player.VOIPbuffers.shift();
           var bytes = new Uint8Array(buf.buffer);
           for (var i = 0; i < bytes.byteLength; i++) {
@@ -317,7 +317,12 @@ console.log('new player!', userId);
         moveData.audio = window.btoa(binary);
         moveData.anim_id = "speak";
       }
-      if (player.controlstate.move_forward) {
+      if (document.activeElement && document.activeElement === this.chat.input.inputelement) {
+        moveData.anim_id = 'type';
+      }
+      if (player.controlstate.run) {
+        moveData.anim_id = 'run';
+      } else if (player.controlstate.move_forward) {
         moveData.anim_id = 'walk';
       } else if (player.controlstate.move_left) {
         moveData.anim_id = 'walk_left';

-----END OF PAGE-----