-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(statistics): add pre call test API
- Loading branch information
1 parent
8940b5c
commit dbb76bf
Showing
5 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import PreCallTest from '@jitsi/precall-test'; | ||
|
||
|
||
export interface PreCallResult { | ||
throughput: number; // Maximum bandwidth reached in kbps (kilo bits per second). | ||
fractionalLoss: number; // Packet loss percentage over all the test traffic. | ||
rtt: number; // Round trip time in milliseconds. | ||
jitter: number; // Variation in packet arrival times during the transmission of media. | ||
mediaConnectivity: boolean; // Whether the data channel was able to send data or not. | ||
} | ||
|
||
// Same interface as a PeerConnection configuration object. | ||
export interface IceServer { | ||
urls: Array<string> | string; | ||
username?: string; | ||
credential?: string; | ||
} | ||
|
||
/** | ||
* Run a pre-call test to check the network conditions. It uses a TURN server to establish | ||
* a connection between two PeerConnections using the server as a relay. Afterwards it sends | ||
* some test traffic through a data channel to measure the network conditions, these are | ||
* recorded and returned through a Promise. | ||
* | ||
* @param {Array<IceServer>} - The ICE servers to use for the test, these are passes to the PeerConnection constructor. | ||
* @returns {Promise<PreCallResult | any>} - A Promise that resolves with the test results or rejects with an error. | ||
*/ | ||
export default async function runPreCallTest(iceServers: Array<IceServer>): Promise<PreCallResult | string> { | ||
return new PreCallTest().start(iceServers); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters