Sfoglia il codice sorgente

feat: add test P2P methods

master
paweldomas 8 anni fa
parent
commit
fb47b6ae21
2 ha cambiato i file con 43 aggiunte e 1 eliminazioni
  1. 33
    0
      conference.js
  2. 10
    1
      config.js

+ 33
- 0
conference.js Vedi File

729
         return this._room
729
         return this._room
730
             && this._room.getConnectionState();
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
      * Checks whether or not our connection is currently in interrupted and
766
      * Checks whether or not our connection is currently in interrupted and
734
      * reconnect attempts are in progress.
767
      * reconnect attempts are in progress.

+ 10
- 1
config.js Vedi File

80
     // disables or enables RTX (RFC 4588) (defaults to false).
80
     // disables or enables RTX (RFC 4588) (defaults to false).
81
     disableRtx: false,
81
     disableRtx: false,
82
     // Sets the preferred resolution (height) for local video. Defaults to 360.
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
 };

Loading…
Annulla
Salva