Global

Members

(constant) BANDWIDTH_QUALITY_LEVEL :number

Enumeration of the bandwidth quality level.

Type:
  • number
Properties:
Name Type Description
VERY_LOW number

bandwidth quality is very low. Default value is 0.

LOW number

bandwidth quality is low. Default value is 1.

NORMAL number

bandwidth quality is normal. Default value is 2.

UNDEFINED number

bandwidth quality is unknown. If get this value, means the network diagnostic is not started yet or gets some exceptions. Default value is 255.

(constant) BASIC_INFO_ATTR_INDEX :number

Enumeration of attribute index of the basic information.

Type:
  • number
Properties:
Name Type Description
BROWSER_NAME number

represents the name of the browser. Default value is 0.

BROWSER_VERSION number

represents the version of the browser. Default value is 1.

OS_NAME number

represents the name of the OS. Default value is 2.

USER_AGENT number

represents the user agent. Default value is 3.

HW_CONCURRENCY number

represents the hardware concurrency. Default value is 4.

GPU_VENDOR number

represents the GPU vendor. Default value is 5.

GPU_RENDERER number

represents the GPU renderer information. Default value is 6.

VIDEOFRAME number

represents the VideoFrame API. Default value is 7.

OFFSCREENCANVAS number

represents the OffscreenCanvas API. Default value is 8.

SIMD number

represents the SIMD feature. Default value is 9.

WEB_CODEC number

represents the web codec feature. Default value is 10.

HW_ACC number

represents the hardware acceleration. Default value is 11.

GRAPHICS_ACC number

represents the graphics acceleration in chromium system settings. Default value is 12.

MIN_BROWSER_VERSION number

represents the minimum browser version. Default value is 13.

SHARED_ARRAY_BUFFER number

represents the SharedArrayBuffer. Default value is 14.

BUILD_BITNESS number

represents the build bitness(32bit or 64bit). Default value is 15.

(constant) DEF_CONNECT_TIMEOUT

The default connection timeout, 20 seconds.

(constant) DEF_PROBE_DURATION

The default probing duration, 120 seconds.

(constant) ERR_CODE :number

Enumeration of a collection of customized error codes defined and used by ProberSDK.

Type:
  • number
Properties:
Name Type Description
OK number

Indicates a successful operation. Default value is 0.

INVALID_ARGS number

Indicates invalid arguments passed to a function. Default value is -1.

API_NOT_SUPPORTED number

Indicates that a specific API is not supported. Default value is -2.

(constant) NETWORK_QUALITY_LEVEL :number

Enumeration of the network quality level.

Type:
  • number
Properties:
Name Type Description
VERY_BAD number

network quality is very bad. Default value is 0.

BAD number

network quality is bad. Default value is 1.

NOT_GOOD number

network quality is not good enough. Default value is 2.

FAIR number

network quality is fine. Default value is 3.

GOOD number

network quality is good. Default value is 4.

EXCELLENT number

network quality is excellent. Default value is 5.

UNDEFINED number

network quality is unknown. If get this value, means the network diagnostic is not started yet or gets some exceptions. Default value is 255.

(constant) NET_PROBING_DATA_TYPE :number

Enumeration of the data type of the network diagnostic. It will be used to determine the type of data you received and how to handle them.

Type:
  • number
Properties:
Name Type Description
STATS number

indicates the realtime statistics of the network diagnostic. Default value is 1.

REPORT number

indicates the final report of diagnostic, basic information and supported features. Default value is 2.

(constant) PROTOCOL_TYPE :number

Enumeration of the protocol type that ProbeSDK checks in a network diagnostic.

Type:
  • number
Properties:
Name Type Description
HTTPS number

https(https://) protocol. Default value is 1.

WEB_SOCKET number

WebSocket(wss:// ws://) protocol. Default value is 2.

DATA_CHANNEL number

the data channel which is used for media communication. Default value is 3.

WEB_TRANSPORT number

WebTransport protocol(not supported now). Default value is 4.

(constant) RENDERER_TYPE :number

Enumeration of the rendering types supported by ProbeSDK.

Type:
  • number
Properties:
Name Type Description
VIDEO_TAG number

a video stream will be rendered on the video tag. Default value is 1.

WEBGL number

a video stream will be rendered on a canvas with a WebGL renderer. Default value is 2.

WEBGL_2 number

a video stream will be rendered on a canvas with a WebGL2 renderer. Default value is 3.

WEBGPU number

a video stream will be rendered on a canvas with a WebGPU renderer. Default value is 4.

(constant) SUPPORTED_FEATURE_INDEX :number

Enumeration of index of the supported features.

Type:
  • number
Properties:
Name Type Description
AUDIO_DENOISE number

feature index of audio denoise. Default value is 0.

AEC number

feature index of audio echo cancellation. Default value is 1.

AUDIO_STEREO number

feature index of audio stereo. Default value is 2.

VIRTUAL_BACKGROUND number

feature index of video virtual background. Default value is 3.

VIDEO_MASK number

feature index of video mask. Default value is 4.

WEBGPU number

feature index of video WebGPU rendering. Default value is 5.

VIDEO_SEND_HD number

feature index of video sending HD. Default value is 6.

VIDEO_SEND_FULL_HD number

feature index of video sending full HD. Default value is 7.

DT_GALLERY_VIEW_3x3 number

feature index of desktop supporting 3x3 gallery view. Default value is 8.

DT_GALLERY_VIEW_5x5 number

feature index of desktop supporting 5x5 gallery view. Default value is 9.

SCREEN_SHARING number

feature index of screen sharing. Default value is 10.

Methods

canSupportStringLength(len) → {boolean}

Test whether can allocate a string of a given length.

Parameters:
Name Type Description
len Number

a length of string to be allocated.

Returns:

true if the string can be allocated, false otherwise.

Type
boolean

cleanup()

Cleanup the resources created in ProbeSDK, like network connections, rendering resources, etc.

Example
prober.cleanup();

(async) diagnoseAudio(inputConstraints, outputConstraints, durationopt, mimeTypeopt) → {Promise.<DiagnosticResult>}

Performs an asynchronous audio diagnostic by recording audio from a specified input device and playing it back through a specified output device. Supports custom recording duration, MIME type selection, and captures all errors, returning them as a DiagnosticResult.

Parameters:
Name Type Attributes Default Description
inputConstraints MediaStreamConstraints
  • Constraints for capturing audio input, e.g. { audio: { deviceId: 'xxx' }, video: false }.
outputConstraints Object
Properties
Name Type Description
audio Object
Properties
Name Type Description
deviceId string
  • The deviceId of the audio output device; required.
duration number <optional>
0
  • Recording duration in milliseconds. If 0 or unspecified, defaults to 5000 ms. Maximum allowed is 60000 ms.
mimeType string <optional>
''
  • MIME type for recording. If empty or undefined, attempts "audio/webm;codecs=opus", then "audio/mp4", then "audio/mp3".
Returns:
  • Resolves to a DiagnosticResult object:
    • On success: { code: ERR_CODE.OK, message: "audio diagnostic complete!" }
    • On failure: contains the appropriate error code and message (e.g. permission denied, initialization failure, AudioContext/MediaRecorder creation failure, etc.).
Type
Promise.<DiagnosticResult>
Example
(async () => {
  const input = { audio: { deviceId: 'default' }, video: false };
  const output = { audio: { deviceId: 'xxxxxx' }, video: false };
  const result = await diagnoseAudio(input, output, 10000, '');
  if (result.code === ERR_CODE.OK) {
    console.log('Diagnostic completed successfully');
  } else {
    console.error('Diagnostic failed:', result.message);
  }
})();

(async) diagnoseVideo(constraints, options) → {DiagnosticResult}

Diagnose video device like camera and show the result on a renderable object. You can select a camera by setting constraints and different renderer type by setting the parameter options. Four renderer types are supported by ProbeSDK. Please refer to the documentation of RENDERER_TYPE.

Once the video diagnostic is launched, a MediaStream object is saved to the field stream of DiagnosticResult. It is necessary when you want to stop the video diagnostic, if not stopping it, the camera capturing currently is always working.

Different renderer types require different RendererOptions:

  • VIDEO_TAG requires a video element(HTMLMediaElement)
  • WebGL/WebGL2/WebGPU requires a canvas(HTMLCanvasElement) or an OffscreenCanvas(OffscreenCanvas)
Parameters:
Name Type Description
constraints MediaStreamConstraints

A camera constraints which is diagnosed.

options RendererOptions

The options of how to render a video stream, includes the a renderer type and a target where to render.

Throws:

If any parameters are invalid, a customized Error will be thrown, or some standard exceptions like DOMException will be thrown during the diagnostic

Type
Error
Returns:

Indicates the result of the video diagnostic.

Type
DiagnosticResult
Example
// for video tag case, you can:
// in your html file, to define a video tag
<video id="local_preview_video" width="640" height="480" autoplay hidden></video>

const preview_video = document.getElementById('local_preview_video');
const constraints = {
 video: {
   width: preview_video.width,
   height: preview_video.height,
   deviceId: document.getElementById("camera_list").value, // need a deviceId of a camera
 },
};

const options = {
  rendererType: 1, // 1 for video_tag
  target: preview_video,
};

const diagnosticResult = await prober.diagnoseVideo(constraints, options);
console.log(diagnosticResult);

// for WebGL/WebGL2/WebGPU case, you can:
// in your html file, to define a canvas
<canvas id="local_preview_canvas" width="640" height="480"></canvas></br>

const preview_canvas = document.getElementById('local_preview_canvas');
const constraints = {
  video: {
    width: preview_canvas.width,
    height: preview_canvas.height,
    deviceId: document.getElementById("camera_list").value, // need a deviceId of a camera
  },
};

const options = {
  rendererType: 2, // WebGL
  target: preview_canvas,
};

const result = await prober.diagnoseVideo(constraints, options);
console.log(result);

queryRid() → {string}

Query the trackingId(rid) of last round of probing.

Returns:

rid a string is used to track the last round of network diagnosis. If the result is an empty string or undefined, it means that the last round of network diagnosis fails.

Type
string
Example
const rid = prober.queryRid();
console.log(rid);

releaseMediaStream(stream) → {boolean}

Releases the resources associated with a given MediaStream.

This function stops all tracks in the provided MediaStream to release the hardware resources (e.g., camera, microphone) and removes them from the stream. It ensures that no resources are left in use after the MediaStream is no longer needed.

Note that ProbeSDK is not responsible for setting the stream you pass to null. So, the caller should maintain its lifecycle.

Parameters:
Name Type Description
stream MediaStream

The MediaStream object to release.

Returns:
  • Returns true if the stream was successfully released, or false if the input was invalid (e.g., null or undefined).
Type
boolean
Example
const stream = await navigator.mediaDevices.getUserMedia({ video: true });
let result = releaseMediaStream(stream);
console.log(result);

(async) reportBasicInfo(navigator) → {Promise.<{Array.<BasicInfoEntry>}>}

Report basic information of the target device, like browser information, OS, etc.

Parameters:
Name Type Description
navigator object

the state and the identity of the user agent.

Returns:

A promise that resolves to an array of basic information entries.

Type
Promise.<{Array.<BasicInfoEntry>}>
Example
const reporter = new Reporter();
reporter.reportBasicInfo(navigator).then((info) => {
 console.log(JSON.stringify(info));
});

(async) reportFeatures() → {Promise.<{Array.<FeatureEntry>}>}

Report whether the advanced features are supported or not on the target device.

Returns:

A promise that resolves to an array of advanced media features.

Type
Promise.<{Array.<FeatureEntry>}>
Example
const reporter = new Reporter();
reporter.reportFeatures().then((features) => {
 console.log(JSON.stringify(features));
});

(async) requestMediaDevicePermission(constraints) → {Promise.<{stream: MediaStream, error: Error}>}

Requests media device permission asynchronously.

Parameters:
Name Type Description
constraints MediaStreamConstraints

The constraints for the requested media stream.

Throws:

If the constraint argument is undefined.

Type
Error
Returns:

A promise that resolves to an object containing either the requested media stream or an error object. The error object may be an instance of DOMException or other standard system exceptions.

Type
Promise.<{stream: MediaStream, error: Error}>
Example
import { Prober } from "@zoom/probesdk";
const prober = new Prober();
function getMediaDevices() {
 prober.requestMediaDevices().then((result) => {
   console.log(`error:${result.error}, devices=${result.devices}`);
 });
}

(async) requestMediaDevices() → {Promise.<{devices: Array.<MediaDeviceInfo>, error: {code: number, message: string}}>}

Requests the media devices asynchronously.

This function checks if the enumerateDevices method is supported the browser's navigator.mediaDevices object. If supported, it retrieves a list of available media devices. If not, it returns an object of PSDKError indicating the lack of support.

Returns:

a promise that resolves to an object containing an array of available media devices or an error object. The error object may be an instance of DOMException or other standard system exceptions.

Type
Promise.<{devices: Array.<MediaDeviceInfo>, error: {code: number, message: string}}>
Example
prober.requestMediaDevices().then((result) => {
 console.log(`error:${result.error}, devices=${result.devices}`);
});

startToDiagnose(jsUrlopt, wasmUrlopt, config, networkStatsListeneropt) → {Promise.<DiagnosticReport>}

Start a full diagnostic that includes the network diagnostic, basic information, and supported features report . It depends on the network diagnostic. Once it is called, the network diagnostic begins, and a report will be generated automatically after it ends.

Before the diagnosis starts, you need to specify the detection time, connection timeout time and other parameters. For the detection time, we recommend setting it at more than 2 minutes. This is because in network diagnosis, if a server is not connected, we will try to connect to an alternative server, which will lead to a connection timeout wait. It takes up most of the detection time, resulting in less detection time after the connection, resulting in inaccurate data. Therefore, we recommend that the detection time be set relatively large, more than 2 minutes, such as 3-5 minutes is OK. If you set the time too short, the results of the network diagnosis will not be very accurate and will not help you diagnose the problem.

Parameters:
Name Type Attributes Default Description
jsUrl string <optional>
prober.js

a URL of javascript file used for a network diagnostic.

wasmUrl string <optional>
prober.wasm

a URL of WebAssembly file used for a network diagnostic.

config NetworkDiagnosticConfig

indicates the configuration of a network diagnostic.

networkStatsListener NetworkStatsListener | undefined <optional>

the listener to receive network diagnostic statistics, the listener can be set to undefined if you only care about the final network diagnostic.

Returns:

a diagnostic report in a promise which includes a set of basic information, supported features, and a final network diagnostic report.

Type
Promise.<DiagnosticReport>
Example
const jsUrl = 'prober.js';
const wasmUrl = 'prober.wasm';
const config = { probeDuration: 120 * 1000, connectTimeout: 20 * 1000, domain: '[a Zoom or custom domain]' };
prober.startToDiagnose(jsUrl, wasmUrl, config, (stats) => {
 console.log(stats);
}).then((report) => {
 console.log(report);
});

(async) stopToDiagnose() → {Promise.<(DiagnosticReport|null)>}

Stop the ongoing network diagnostic that was initiated by the startToDiagnose method.

This function will immediately stop all network probing activities, cleanup all resources including network connections, timers, and WebAssembly instances. If a diagnostic is currently running, it will generate a final report with the data collected up to the point of stopping.

Returns:

A promise that resolves to a diagnostic report with the data collected before stopping, or null if no diagnostic was running.

Type
Promise.<(DiagnosticReport|null)>
Example
// Start diagnostic
const diagnosticPromise = prober.startToDiagnose(jsUrl, wasmUrl, config, (stats) => {
  console.log(stats);
});

// Stop diagnostic after 30 seconds
setTimeout(async () => {
  const partialReport = await prober.stopToDiagnose();
  console.log('Diagnostic stopped, partial report:', partialReport);
}, 30000);

stopToDiagnoseVideo(streamopt) → {boolean}

Stops the video diagnostic that was started by the diagnoseVideo method.

The frontend or any caller can pass the MediaStream of DiagnosticResult to stop video diagnostic, like removing the video element or the canvas on the screen are necessary actions too. Note that, you can still call releaseMediaStream to manually destroy the MediaStream.

Parameters:
Name Type Attributes Default Description
stream MediaStream <optional>
null

The MediaStream which will be destroyed.

Returns:

Returns true if the video diagnostic is stopped successfully, otherwise returns false.

Type
boolean
Example
document.getElementById("btn_stop_preview").addEventListener("click", () =>{
 let result = prober.stopToDiagnoseVideo(stream); // stream saved in the result of calling diagnoseVideo()
 console.log(`stopToDiagnoseVideo() result: ${result}`);
});

Type Definitions

AffectedFeatureEntry

An object describes an entry of an affected feature.

Type:
  • object
Properties:
Name Type Description
featureName string

the name of an affected feature.

AffectedFeatureEntry

An object describes an entry of an affected feature.

Type:
  • object
Properties:
Name Type Description
featureName string

the name of an affected feature.

BasicInfoEntry

An object describes an entry of basic information.

Type:
  • object
Properties:
Name Type Description
index number

index of an attribute added to the basic information, refer to BASIC_INFO_ATTR_INDEX.

attr string

name/label of an attribute.

val string

value of an attribute.

critical boolean

whether the attribute is critical or not. If true, the attribute is critical and a list of affected features will be attached to the affectedFeatures field.

affectedFeatures Array.<AffectedFeatureEntry>

an array of affected features if the critical value is true, that is, a group of features might be affected if this attribute is not matched.

BasicInfoEntry

An object describes an entry of basic information.

Type:
  • object
Properties:
Name Type Description
index number

index of an attribute added to the basic information, refer to BASIC_INFO_ATTR_INDEX.

attr string

name/label of an attribute.

val string

value of an attribute.

critical boolean

whether the attribute is critical or not. If true, the attribute is critical and a list of affected features will be attached to the affectedFeatures field.

affectedFeatures Array.<AffectedFeatureEntry>

an array of affected features if the critical value is true, that is, a group of features might be affected if this attribute is not matched.

CheckItem

An object describes an entry of a supported feature checking.

Type:
  • object
Properties:
Name Type Description
index number

indicates a classification of the requirement, sometimes this field can be ignored.

label string

the label of a requirement.

matched boolean

indicates whether a condition of the requirement is matched or not.

tip string

a tip will help if the condition is not matched.

CheckItem

An object describes an entry of a supported feature checking.

Type:
  • object
Properties:
Name Type Description
index number

indicates a classification of the requirement, sometimes this field can be ignored.

label string

the label of a requirement.

matched boolean

indicates whether a condition of the requirement is matched or not.

tip string

a tip will help if the condition is not matched.

DiagnosticReport

An object describes a report of the entire diagnostic.

Type:
  • object
Properties:
Name Type Description
networkDiagnosticResult NetworkDiagnosticResult

the report of the network diagnostic part.

basicInfo Array.<BasicInfoEntry>

a set of basic information, like browser, OS, hardware, etc.

supportedFeatures Array.<FeatureEntry>

a set of features that are important to the user.

DiagnosticResult

Diagnostic result object.

Type:
  • object
Properties:
Name Type Attributes Description
code number
  • Status code from ERR_CODE. 0 indicates success; non-zero indicates an error.
message string
  • A brief description or error message for this diagnostic result.
stream MediaStream <optional>
  • Optional. A MediaStream containing specified tracks (e.g. used when diagnosing video devices). Not always present for audio diagnostics.

FeatureEntry

An object describes a piece of supported feature.

Type:
  • object
Properties:
Name Type Description
index number

the index of a supported feature, refer to SUPPORTED_FEATURE_INDEX.

featureName string

the name of a supported feature.

isSupported boolean

whether the feature is supported or not.

checkList Array.<CheckItem>

an array of CheckItem which are used to judge whether the conditions of a supported features are matched or not.

FeatureEntry

An object describes a piece of supported feature.

Type:
  • object
Properties:
Name Type Description
index number

the index of a supported feature, refer to SUPPORTED_FEATURE_INDEX.

featureName string

the name of a supported feature.

isSupported boolean

whether the feature is supported or not.

checkList Array.<CheckItem>

an array of CheckItem which are used to judge whether the conditions of a supported features are matched or not.

NetworkDiagnosticConfig

An object represents the configuration of network diagnostic.

Type:
  • object
Properties:
Name Type Description
connectTimeout number

the timeout of the connections established in a network diagnostic. If not set, the default value is DEF_CONNECT_TIMEOUT.

probeDuration number

the duration of how long a round of a network diagnostic. If not set, the default value is DEF_PROBE_DURATION. If set, the maximum value between DEF_PROBE_DURATION and probeDuration is used as the final probing duration.

domain string

the domain of the prober server. Provide your own domain or use the default domain provided by Zoom if not set.

NetworkDiagnosticResult

An object describes the report of the network diagnostic.

Type:
  • object
Properties:
Name Type Description
serviceZone string

indicates the service zone, it is a constant currently.

protocols Array.<ProtocolEntry>

an array of protocols used in a network diagnostic.

statistics NetworkDiagnosticStatsReport

the final report of the network diagnostic statistics.

rid string

a string is used to track this round of network diagnosis.

NetworkDiagnosticStats

An object describes the real-time network diagnostic statistics.

Type:
  • object
Properties:
Name Type Description
type number

indicates whether the data is a real-time statistics or the final report. Refer to NET_PROBING_DATA_TYPE for details.

content NetworkDiagnosticStatsContent

indicates the content of the real-time statistics.

NetworkDiagnosticStatsContent

An object describes the content/data part of the real-time network diagnostic statistics.

Type:
  • object
Properties:
Name Type Description
path string

indicates the statistics coming from uplink or downlink.

statistics NetworkDiagnosticStatsData

the statistics of uplink or downlink.

NetworkDiagnosticStatsData

An object describes the statistics of a network diagnostic.

Type:
  • object
Properties:
Name Type Description
bandwidth number

bandwidth(kb/s).

bw_level number

the quality level of the bandwidth, refer to BANDWIDTH_QUALITY_LEVEL.

jitter number

jitter(ms).

lossRate number

the rate of package loss(%).

rtt number

the round-trip time(ms).

network_level number

the quality level of the network, refer to NETWORK_QUALITY_LEVEL.

NetworkDiagnosticStatsReport

An object describes the report of the final and average statistics of a network diagnostic.

Type:
  • object
Properties:
Name Type Description
uplink_bandwidth number

the last uplink bandwidth, kb/s.

uplink_avg_loss number

the average value of uplink package loss(%).

uplink_avg_rtt number

the average value of uplink round-trip time(ms).

uplink_avg_jitter number

the average value of uplink jitter(ms).

uplink_bw_level number

the last uplink bandwidth quality level, refer to BANDWIDTH_QUALITY_LEVEL.

uplink_network_level number

the last uplink network quality level, refer to NETWORK_QUALITY_LEVEL.

downlink_bandwidth number

the last downlink bandwidth, kb/s.

downlink_avg_loss number

the average value of downlink package loss(%).

downlink_avg_rtt number

the average value of downlink round-trip time(ms).

downlink_avg_jitter number

the average value of downlink jitter(ms).

downlink_bw_level number

the last downlink bandwidth quality level, refer to BANDWIDTH_QUALITY_LEVEL.

downlink_network_level number

the last downlink network quality level, refer to NETWORK_QUALITY_LEVEL.

NetworkStatsListener

A function object is used as a listener to listen the network diagnostic statistics.

Type:
  • object
Properties:
Name Type Description
onStatsReceived function

callback function which receives an instance of NetworkDiagnosticStats.

PSDKError

An object, indicates an error generated by ProberSDK.

Type:
  • object
Properties:
Name Type Description
code number

an error code defined by ERR_CODE.

message string

the error message.

ProtocolEntry

An object represents the details of protocols which are used in the network diagnostics.

Type:
  • object
Properties:
Name Type Description
type number

the type of the protocols, refer to PROTOCOL_TYPE.

isBlocked boolean

indicates whether the protocol is blocked or not.

port string

the port that a protocol uses.

tip string

a tip will help if the protocol or port is blocked or not.

error *

some customized errors or standard errors, like DOMException, will be thrown if any. If no exceptions, it is undefined.

RendererOptions

An object describes how to render video streams.

Type:
  • object
Properties:
Name Type Description
rendererType number

the renderer type, refer to the values of RENDERER_TYPE.

target HTMLMediaElement | HTMLCanvasElement | OffscreenCanvas

where to render a video stream.