Procházet zdrojové kódy

Fixes example.js

dev1
hristoterezov před 10 roky
rodič
revize
65a3ad3748
2 změnil soubory, kde provedl 7 přidání a 55 odebrání
  1. 7
    49
      doc/example/example.js
  2. 0
    6
      doc/example/index.html

+ 7
- 49
doc/example/example.js Zobrazit soubor

@@ -1,13 +1,3 @@
1
-//var options = {
2
-//    hosts: {
3
-//        domain: "prod-us-east-1-app-xmpp1.internal.meet.hipchat.ninja",
4
-//        focus: "focus.prod-us-east-1-app-xmpp1.internal.meet.hipchat.ninja",
5
-//        muc: "conference.prod-us-east-1-app-xmpp1.internal.meet.hipchat.ninja", // FIXME: use XEP-0030
6
-//    },
7
-//    bosh: "https://xmpp1-meet.hipchat.me/http-bind", // FIXME: use xep-0156 for that
8
-//    clientNode: "http://prod-us-east-1-app-xmpp1.internal.meet.hipchat.ninja/jitsimeet" // The name of client node advertised in XEP-0115 'c' stanza
9
-//};
10
-
11 1
 var options = {
12 2
     hosts: {
13 3
         domain: 'hristo.jitsi.net',
@@ -18,19 +8,6 @@ var options = {
18 8
     clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
19 9
 }
20 10
 
21
-
22
-
23
-// var options = {
24
-//     hosts: {
25
-//         domain: 'whatever.jitsi.net',
26
-//         muc: 'conference.whatever.jitsi.net', // FIXME: use XEP-0030
27
-//         bridge: 'jitsi-videobridge.whatever.jitsi.net', // FIXME: use XEP-0030
28
-//     },
29
-//     bosh: '//whatever.jitsi.net/http-bind?ROOM_NAME=conference2', // FIXME: use xep-0156 for that
30
-//     clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
31
-// }
32
-
33
-
34 11
 var confOptions = {
35 12
     openSctp: true,
36 13
     disableAudioLevels: true
@@ -47,6 +24,7 @@ function onLocalTracks(tracks)
47 24
     tracks[1].attach($("#localVideo"));
48 25
     for(var i = 0; i < localTracks.length; i++)
49 26
     {
27
+            room.addTrack(localTracks[i]);
50 28
         console.log(localTracks[i]);
51 29
     }
52 30
 }
@@ -74,10 +52,7 @@ function onRemoteTrack(track) {
74 52
  */
75 53
 function onConferenceJoined () {
76 54
     console.log("conference joined!");
77
-    for(var i = 0; i < localTracks.length; i++)
78
-    {
79
-        room.addTrack(localTracks[i]);
80
-    }
55
+    JitsiMeetJS.createLocalTracks({}).then(onLocalTracks);
81 56
 }
82 57
 
83 58
 function onUserLeft(id) {
@@ -142,33 +117,16 @@ $(window).bind('unload', unload);
142 117
 
143 118
 JitsiMeetJS.init();
144 119
 
145
-JitsiMeetJS.enumerateDevices(function (devices) {
146
-    for(var i = 0; i < devices.length; i++)
147
-    {
148
-        var device = devices[i];
149
-        if(device.kind === "videoinput")
150
-            $("#videoDevices").append("<option value=\"" + device.deviceId +
151
-                "\">" + device.label + "</option>");
152
-    }
153
-})
154
-
155 120
 var connection = null;
156 121
 var room = null;
157 122
 var localTracks = [];
158 123
 var remoteTracks = {};
159 124
 
160 125
 
161
-/**
162
- * Starts the conference with the selected device
163
- */
164
-function selectDevice() {
165
-    var videoID = $("#videoDevices").val();
166
-    JitsiMeetJS.createLocalTracks({resolution: "720", cameraDeviceId: videoID}).then(onLocalTracks);
167
-    connection = new JitsiMeetJS.JitsiConnection(null, null, options);
126
+connection = new JitsiMeetJS.JitsiConnection(null, null, options);
168 127
 
169
-    connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess);
170
-    connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, onConnectionFailed);
171
-    connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_DISCONNECTED, disconnect);
128
+connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess);
129
+connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, onConnectionFailed);
130
+connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_DISCONNECTED, disconnect);
172 131
 
173
-    connection.connect();
174
-}
132
+connection.connect();

+ 0
- 6
doc/example/index.html Zobrazit soubor

@@ -11,12 +11,6 @@
11 11
     <script src="example.js" ></script>
12 12
 </head>
13 13
 <body>
14
-    <a onclick="room.setDisplayName(Math.random())">Change Display Name</a>
15
-    <div>Select Video device:
16
-        <select id="videoDevices">
17
-        </select>
18
-        <a onclick = "selectDevice();">Select</a>
19
-    </div>
20 14
     <video id="localVideo" autoplay="true"></video>
21 15
     <!--<audio id="localAudio" autoplay="true" muted="true"></audio>-->
22 16
 </body>

Načítá se…
Zrušit
Uložit