Philipp Hancke 11 лет назад
Родитель
Сommit
8f46d961ef
1 измененных файлов: 20 добавлений и 11 удалений
  1. 20
    11
      app.js

+ 20
- 11
app.js Просмотреть файл

@@ -13,19 +13,18 @@ window.onbeforeunload = closePageWarning;
13 13
 function init() {
14 14
     RTC = setupRTC();
15 15
     if (RTC === null) {
16
-        window.location.href = '/webrtcrequired.html';
16
+        window.location.href = 'webrtcrequired.html';
17 17
         return;
18 18
     } else if (RTC.browser != 'chrome') {
19
-        window.location.href = '/chromeonly.html';
19
+        window.location.href = 'chromeonly.html';
20 20
         return;
21 21
     }
22 22
     RTCPeerconnection = RTC.peerconnection;
23 23
 
24 24
     connection = new Strophe.Connection(document.getElementById('boshURL').value || config.bosh || '/http-bind');
25
-    /*
26
-    connection.rawInput = function (data) { console.log('RECV: ' + data); };
27
-    connection.rawOutput = function (data) { console.log('SEND: ' + data); };
28
-    */
25
+    if (connection.disco) {
26
+        // for chrome, add multistream cap
27
+    }
29 28
     connection.jingle.pc_constraints = RTC.pc_constraints;
30 29
 
31 30
     var jid = document.getElementById('jid').value || config.hosts.domain || window.location.hostname;
@@ -49,6 +48,14 @@ function doJoin() {
49 48
     var roomnode = null;
50 49
     var path = window.location.pathname;
51 50
     var roomjid;
51
+    /*
52
+     * this is making assumptions about how the URL->room mapping happens.
53
+     * It currently assumes deployment at root, with a rewrite like the
54
+     * following one (for nginx):
55
+    location ~ ^/([a-zA-Z0-9]+)$ {
56
+        rewrite ^/(.*)$ / break;
57
+    }
58
+     */
52 59
     if (path.length > 1) {
53 60
         roomnode = path.substr(1).toLowerCase();
54 61
     } else {
@@ -100,11 +107,12 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
100 107
     }
101 108
     var sess = connection.jingle.sessions[sid];
102 109
     var vid = document.createElement('video');
103
-    console.log(sess);
110
+    // FIXME: the span should not be created here but on muc join
104 111
     var span = document.createElement('span');
105
-    // FIXME: how to name this span? sess.peerjid is not right for jingle clients
106
-    //console.log('peer: ', Strophe.getResourceFromJid(sess.peerjid));
107
-    //span.id = 'remoteVideocontainer_' + Strophe.getResourceFromJid(sess.peerjid);
112
+    if (data.peerjid) {
113
+        // FIXME: how to name this span? data.peerjid is not set for jingle clients
114
+        span.id = 'participant_' + Strophe.getResourceFromJid(data.peerjid);
115
+    }
108 116
     span.className = 'videocontainer';
109 117
     var id = 'remoteVideo_' + sid + '_' + data.stream.id;
110 118
     vid.id = id;
@@ -123,6 +131,8 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
123 131
     data.stream.onended = function () {
124 132
         console.log('stream ended', this.id);
125 133
         var src = $('#' + id).attr('src');
134
+        // FIXME: likewise, the parent should not be removed here
135
+        // but on MUC part
126 136
         $('#' + id).parent().remove();
127 137
         if (src === $('#largeVideo').attr('src')) {
128 138
             // this is currently displayed as large
@@ -159,7 +169,6 @@ $(document).bind('callincoming.jingle', function (event, sid) {
159 169
 });
160 170
 
161 171
 $(document).bind('callactive.jingle', function (event, videoelem, sid) {
162
-    console.log('call active');
163 172
     if (videoelem.attr('id').indexOf('mixedmslabel') == -1) {
164 173
         // ignore mixedmslabela0 and v0
165 174
         videoelem.show();

Загрузка…
Отмена
Сохранить