Michelle Bu 11 жил өмнө
parent
commit
e0db22305e
4 өөрчлөгдсөн 22 нэмэгдсэн , 15 устгасан
  1. 1 2
      dist/peer.js
  2. 0 0
      dist/peer.min.js
  3. 20 11
      examples/chat.html
  4. 1 2
      lib/negotiator.js

+ 1 - 2
dist/peer.js

@@ -1969,8 +1969,7 @@ Negotiator._startPeerConnection = function(connection) {
   var id = Negotiator._idPrefix + util.randomToken();
   pc = new RTCPeerConnection(connection.provider.options.config, {
     optional: [{
-      RtpDataChannels: true,
-      DtlsSrtpKeyAgreement: true /* Firefox interop */
+      RtpDataChannels: true
     }]
   });
   Negotiator.pcs[connection.type][connection.peer][id] = pc;

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/peer.min.js


+ 20 - 11
examples/chat.html

@@ -6,21 +6,26 @@
 <meta http-equiv="Content-Language" content="en-us"> 
 
 <link href="fancy.css" rel="stylesheet" type="text/css">
-<script>
-  // Just for demo.
-  /*console._log = console.log;
-  console.log = function() {
-    var copy = Array.prototype.slice.call(arguments).join(' ');
-    $('.log').append(copy + '<br>');
-    console._log(copy);
-  };*/
-</script>
 
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script> 
 <script type="text/javascript" src="../dist/peer.js"></script>
 <script>
 // Connect to PeerJS, have server assign an ID instead of providing one
-var peer = new Peer({key: 'lwjd5qra8257b9', debug: 3});
+// Showing off some of the configs available with PeerJS :).
+var peer = new Peer({
+  // Set API key for cloud server (you don't need this if you're running your
+  // own.
+  key: 'lwjd5qra8257b9',
+
+  // Set highest debug level (log everything!).
+  debug: 3,
+
+  // Set a logging function:
+  logFunction: function() {
+    var copy = Array.prototype.slice.call(arguments).join(' ');
+    $('.log').append(copy + '<br>');
+  }
+});
 var connectedPeers = {};
 
 // Show this peer's ID.
@@ -103,7 +108,11 @@ $(document).ready(function() {
     requestedPeer = $('#rid').val();
     if (!connectedPeers[requestedPeer]) {
       // Create 2 connections, one labelled chat and another labelled file.
-      var c = peer.connect(requestedPeer, { label: 'chat' });
+      var c = peer.connect(requestedPeer, {
+        label: 'chat',
+        serialization: 'none',
+        metadata: {message: 'hi i want to chat with you!'}
+      });
       c.on('open', function() {
         connect(c);
       });

+ 1 - 2
lib/negotiator.js

@@ -90,8 +90,7 @@ Negotiator._startPeerConnection = function(connection) {
   var id = Negotiator._idPrefix + util.randomToken();
   pc = new RTCPeerConnection(connection.provider.options.config, {
     optional: [{
-      RtpDataChannels: true,
-      DtlsSrtpKeyAgreement: true /* Firefox interop */
+      RtpDataChannels: true
     }]
   });
   Negotiator.pcs[connection.type][connection.peer][id] = pc;

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно