Bläddra i källkod

feat: add test P2P methods

master
paweldomas 8 år sedan
förälder
incheckning
fb47b6ae21
2 ändrade filer med 43 tillägg och 1 borttagningar
  1. 33
    0
      conference.js
  2. 10
    1
      config.js

+ 33
- 0
conference.js Visa fil

@@ -729,6 +729,39 @@ export default {
729 729
         return this._room
730 730
             && this._room.getConnectionState();
731 731
     },
732
+    /**
733
+     * Obtains current P2P ICE connection state.
734
+     * @return {string|null} ICE connection state or <tt>null</tt> if there's no
735
+     * P2P connection
736
+     */
737
+    getP2PConnectionState () {
738
+        return this._room
739
+            && this._room.getP2PConnectionState();
740
+    },
741
+    /**
742
+     * Starts P2P (for tests only)
743
+     * @private
744
+     */
745
+    _startP2P () {
746
+        try {
747
+            this._room && this._room.startP2PSession();
748
+        } catch (error) {
749
+            logger.error("Start P2P failed", error);
750
+            throw error;
751
+        }
752
+    },
753
+    /**
754
+     * Stops P2P (for tests only)
755
+     * @private
756
+     */
757
+    _stopP2P () {
758
+        try {
759
+            this._room && this._room.stopP2PSession();
760
+        } catch (error) {
761
+            logger.error("Stop P2P failed", error);
762
+            throw error;
763
+        }
764
+    },
732 765
     /**
733 766
      * Checks whether or not our connection is currently in interrupted and
734 767
      * reconnect attempts are in progress.

+ 10
- 1
config.js Visa fil

@@ -80,5 +80,14 @@ var config = { // eslint-disable-line no-unused-vars
80 80
     // disables or enables RTX (RFC 4588) (defaults to false).
81 81
     disableRtx: false,
82 82
     // Sets the preferred resolution (height) for local video. Defaults to 360.
83
-    resolution: 720
83
+    resolution: 720,
84
+    // Enables peer to peer mode. When enabled system will try to establish
85
+    // direct connection given that there are exactly 2 participants in
86
+    // the room. If that succeeds the conference will stop sending data through
87
+    // the JVB and use the peer to peer connection instead. When 3rd participant
88
+    // joins the conference will be moved back to the JVB connection.
89
+    //enableP2P: true
90
+    // How long we're going to wait, before going back to P2P after
91
+    // the 3rd participant has left the conference (to filter out page reload)
92
+    //backToP2PDelay: 5
84 93
 };

Laddar…
Avbryt
Spara