浏览代码

document path-to-room

j8
Philipp Hancke 11 年前
父节点
当前提交
8f46d961ef
共有 1 个文件被更改,包括 20 次插入11 次删除
  1. 20
    11
      app.js

+ 20
- 11
app.js 查看文件

13
 function init() {
13
 function init() {
14
     RTC = setupRTC();
14
     RTC = setupRTC();
15
     if (RTC === null) {
15
     if (RTC === null) {
16
-        window.location.href = '/webrtcrequired.html';
16
+        window.location.href = 'webrtcrequired.html';
17
         return;
17
         return;
18
     } else if (RTC.browser != 'chrome') {
18
     } else if (RTC.browser != 'chrome') {
19
-        window.location.href = '/chromeonly.html';
19
+        window.location.href = 'chromeonly.html';
20
         return;
20
         return;
21
     }
21
     }
22
     RTCPeerconnection = RTC.peerconnection;
22
     RTCPeerconnection = RTC.peerconnection;
23
 
23
 
24
     connection = new Strophe.Connection(document.getElementById('boshURL').value || config.bosh || '/http-bind');
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
     connection.jingle.pc_constraints = RTC.pc_constraints;
28
     connection.jingle.pc_constraints = RTC.pc_constraints;
30
 
29
 
31
     var jid = document.getElementById('jid').value || config.hosts.domain || window.location.hostname;
30
     var jid = document.getElementById('jid').value || config.hosts.domain || window.location.hostname;
49
     var roomnode = null;
48
     var roomnode = null;
50
     var path = window.location.pathname;
49
     var path = window.location.pathname;
51
     var roomjid;
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
     if (path.length > 1) {
59
     if (path.length > 1) {
53
         roomnode = path.substr(1).toLowerCase();
60
         roomnode = path.substr(1).toLowerCase();
54
     } else {
61
     } else {
100
     }
107
     }
101
     var sess = connection.jingle.sessions[sid];
108
     var sess = connection.jingle.sessions[sid];
102
     var vid = document.createElement('video');
109
     var vid = document.createElement('video');
103
-    console.log(sess);
110
+    // FIXME: the span should not be created here but on muc join
104
     var span = document.createElement('span');
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
     span.className = 'videocontainer';
116
     span.className = 'videocontainer';
109
     var id = 'remoteVideo_' + sid + '_' + data.stream.id;
117
     var id = 'remoteVideo_' + sid + '_' + data.stream.id;
110
     vid.id = id;
118
     vid.id = id;
123
     data.stream.onended = function () {
131
     data.stream.onended = function () {
124
         console.log('stream ended', this.id);
132
         console.log('stream ended', this.id);
125
         var src = $('#' + id).attr('src');
133
         var src = $('#' + id).attr('src');
134
+        // FIXME: likewise, the parent should not be removed here
135
+        // but on MUC part
126
         $('#' + id).parent().remove();
136
         $('#' + id).parent().remove();
127
         if (src === $('#largeVideo').attr('src')) {
137
         if (src === $('#largeVideo').attr('src')) {
128
             // this is currently displayed as large
138
             // this is currently displayed as large
159
 });
169
 });
160
 
170
 
161
 $(document).bind('callactive.jingle', function (event, videoelem, sid) {
171
 $(document).bind('callactive.jingle', function (event, videoelem, sid) {
162
-    console.log('call active');
163
     if (videoelem.attr('id').indexOf('mixedmslabel') == -1) {
172
     if (videoelem.attr('id').indexOf('mixedmslabel') == -1) {
164
         // ignore mixedmslabela0 and v0
173
         // ignore mixedmslabela0 and v0
165
         videoelem.show();
174
         videoelem.show();

正在加载...
取消
保存