@testrtc/watchrtc-sdk
Advanced tools
Comparing version 1.35.2 to 1.36.0-beta-1
import "./types"; | ||
import { IEvent, IStatsCallback, IWatchRTCConfiguration, IWatchRTCInitServices, Rating } from "./interfaces"; | ||
import { IEvent, IStatsCallback, IWatchRTCConfiguration, IWatchRTCInitServices, Rating, StateListener } from "./interfaces"; | ||
/** | ||
@@ -42,6 +42,21 @@ * Initialize SDK. Can be called multiple times but it will be initialized only at the first time. | ||
export declare const addEvent: (event: IEvent) => void; | ||
/** | ||
* Map an incoming stream with a human-readable name | ||
* @param id The identifier of the stream (streamIdentifier attribute) | ||
* @param name The human-readable name | ||
* @deprecated | ||
*/ | ||
export declare const mapStream: (id: string, name: string) => void; | ||
/** | ||
* Map an incoming track with a human-readable name | ||
* @param id The identifier of the track (trackIdentifier attribute) | ||
* @param name The human-readable name | ||
*/ | ||
export declare const mapTrack: (id: string, name: string) => void; | ||
export declare const connect: () => void; | ||
export declare const disconnect: () => void; | ||
export declare const addStatsListener: (listener: IStatsCallback) => void; | ||
export declare const persistentEnd: (nailUpCallEnd?: boolean | undefined) => void; | ||
export declare const persistentStart: (roomId: string, peerId: string) => void; | ||
export declare const addStateListener: (listener: StateListener | null) => void; | ||
declare const _default: { | ||
@@ -86,7 +101,22 @@ /** | ||
addEvent: (event: IEvent) => void; | ||
/** | ||
* Map an incoming stream with a human-readable name | ||
* @param id The identifier of the stream (streamIdentifier attribute) | ||
* @param name The human-readable name | ||
* @deprecated | ||
*/ | ||
mapStream: (id: string, name: string) => void; | ||
/** | ||
* Map an incoming track with a human-readable name | ||
* @param id The identifier of the track (trackIdentifier attribute) | ||
* @param name The human-readable name | ||
*/ | ||
mapTrack: (id: string, name: string) => void; | ||
connect: () => void; | ||
disconnect: () => void; | ||
addStatsListener: (listener: IStatsCallback) => void; | ||
persistentEnd: (nailUpCallEnd?: boolean | undefined) => void; | ||
persistentStart: (roomId: string, peerId: string) => void; | ||
addStateListener: (listener: StateListener | null) => void; | ||
}; | ||
export default _default; |
@@ -73,3 +73,3 @@ export interface RTCPeerConnectionInformation { | ||
trace: ISocketTrace; | ||
close: () => void; | ||
close: (nailUpCallEnd?: boolean) => void; | ||
disableDataCollection: () => void; | ||
@@ -86,2 +86,6 @@ enableDataCollection: () => void; | ||
} | ||
export interface IStateEvent { | ||
connectionStatus: "connected" | "disconnected"; | ||
} | ||
export declare type StateListener = (event: IStateEvent) => any; | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import { IEvent, IStatsCallback, IWatchRTCConfiguration, IWatchRTCInitServices, Rating } from "./interfaces"; | ||
import { IEvent, IStatsCallback, IWatchRTCConfiguration, IWatchRTCInitServices, Rating, StateListener } from "./interfaces"; | ||
/** | ||
@@ -27,4 +27,8 @@ * Initialize SDK. | ||
export declare const mapStream: (id: string, name: string) => void; | ||
export declare const mapTrack: (id: string, name: string) => void; | ||
export declare const connect: () => void; | ||
export declare const disconnect: () => void; | ||
export declare const registerOnStatsListener: (listener: IStatsCallback) => void; | ||
export declare const registerStateListener: (listener: StateListener | null) => void; | ||
export declare const persistentEnd: (nailUpCallEnd?: boolean | undefined) => void; | ||
export declare const persistentStart: (roomId: string, peerId: string) => void; |
export declare const getTransportFromStats: (id: string, reports: any) => any; | ||
export declare const getStreamsFromStats: (id: string, previous: any, current: any) => any; | ||
export declare const getStreamsFromStats: (id: string, previous: any, current: any, mappedTrack: any) => any; |
@@ -25,3 +25,3 @@ import { IEvent, ISocketTrace, IWatchRTCConfiguration, IWatchrtcIdentifiers, Rating, RTCPeerConnectionInformation } from "./interfaces"; | ||
export declare const restoreOriginalConsoleMethods: () => void; | ||
export declare const exposeApplicationStatsForPC: (id: string, previous: any, current: any) => { | ||
export declare const exposeApplicationStatsForPC: (id: string, previous: any, current: any, mappedTradk: any) => { | ||
peer: any; | ||
@@ -28,0 +28,0 @@ streams: any; |
@@ -1,2 +0,2 @@ | ||
declare const _default: "1.35.2"; | ||
declare const _default: "1.36.0-beta-1"; | ||
export default _default; |
@@ -18,3 +18,3 @@ import { ISocketService, ISocketTrace } from "./interfaces"; | ||
trace: ISocketTrace; | ||
close(): void; | ||
close(nailUpCallEnd?: boolean): void; | ||
disableDataCollection(): void; | ||
@@ -21,0 +21,0 @@ enableDataCollection(): void; |
{ | ||
"name": "@testrtc/watchrtc-sdk", | ||
"version": "1.35.2", | ||
"version": "1.36.0-beta-1", | ||
"description": "Monitor your WebRTC application by collecting WebRTC statistics from end users", | ||
@@ -38,4 +38,4 @@ "main": "lib/index.js", | ||
"volta": { | ||
"node": "16.18.1" | ||
"node": "16.19.0" | ||
} | ||
} | ||
} |
@@ -74,8 +74,8 @@ # watchRTC JS SDK | ||
- rtcApiKey - watchRTC API key, as provided by testRTC | ||
- rtcRoomId - an identifier to the session/room/conference. This will enable an analysis of all participants in the same room as a single logical unit. Read more about [rooms and peers in watchRTC](https://testrtc.com/docs/rooms-and-peers-in-watchrtc/). | ||
- rtcPeerId - an identifier of this peer/user in the session. This will make it easier to identify and troubleshoot users. It is recommended to use non-PII data here as much as possible (no emails or names for example) | ||
- keys - (optional) key value object. Used to associate with this peer connection. These can later be searched for or filtered. Read more about [keys in watchRTC](https://testrtc.com/docs/using-custom-keys-in-watchrtc/). | ||
- console - (optional) collect browser console log messages. Read more about [collecting console logs in watchRTC](https://testrtc.com/docs/console-logs-in-watchrtc/). | ||
- proxyUrl - (optional) secured web socket proxy server address, the proxy server should forward the connection to testRTC's watchRTC servers | ||
- **rtcApiKey** - watchRTC API key, as provided by testRTC | ||
- **rtcRoomId** - an identifier to the session/room/conference. This will enable an analysis of all participants in the same room as a single logical unit. Read more about [rooms and peers in watchRTC](https://testrtc.com/docs/rooms-and-peers-in-watchrtc/). | ||
- **rtcPeerId** - an identifier of this peer/user in the session. This will make it easier to identify and troubleshoot users. It is recommended to use non-PII data here as much as possible (no emails or names for example) | ||
- **keys** - (optional) key value object. Used to associate with this peer connection. These can later be searched for or filtered. Read more about [keys in watchRTC](https://testrtc.com/docs/using-custom-keys-in-watchrtc/). | ||
- **console** - (optional) collect browser console log messages. Read more about [collecting console logs in watchRTC](https://testrtc.com/docs/console-logs-in-watchrtc/). | ||
- **proxyUrl** - (optional) secured web socket proxy server address, the proxy server should forward the connection to testRTC's watchRTC servers | ||
Based on your application's logic, you can and should pass these configuration parameters at different stages. Read more about [Setting up a proxy for watchRTC traffic](https://testrtc.com/docs/setting-up-a-proxy-for-watchrtc-traffic/). | ||
@@ -171,4 +171,4 @@ | ||
- rating - A number from 1 to 5. You can use it for a 5-stars rating system, or you can use 1 and 5 values only for a like/dislike type of rating system | ||
- comment - (optional) Simple string value, collecting user's "verbal" feedback | ||
- **rating** - A number from 1 to 5. You can use it for a 5-stars rating system, or you can use 1 and 5 values only for a like/dislike type of rating system | ||
- **comment** - (optional) Simple string value, collecting user's "verbal" feedback | ||
@@ -185,8 +185,8 @@ ```javascript | ||
- name - The event name. This will be displayed when the event occurred | ||
- type - One of the following event types | ||
- **name** - The event name. This will be displayed when the event occurred | ||
- **type** - One of the following event types | ||
- "log" - the event will appear only on the event log in the Advanced WebRTC Analytics for the peer | ||
- "local" - the event will be in the event log as well as placed on the peer level charts | ||
- "global" - the event will be in the event log, peer level charts and on the room level charts | ||
- parameters - (optional) JSON object to attach to the event. This will appear in the event log | ||
- **parameters** - (optional) JSON object to attach to the event. This will appear in the event log | ||
@@ -197,8 +197,8 @@ ```javascript | ||
### Mapping streams | ||
### Mapping streams (deprecated in favor of Mapping tracks) | ||
By default, watchRTC will assign the SSRC information as the name for incoming channels. You can change these to human-readable format indicating the source of the channels by mapping their streams. This is done by calling `watchRTC.mapStream(')`. Read more about [mapping streams in watchRTC](https://testrtc.com/docs/mapping-streams-in-watchrtc/). | ||
By default, watchRTC will assign the SSRC information as the name for incoming channels. You can change these to human-readable format indicating the source of the channels by mapping their streams. This is done by calling `watchRTC.mapStream(streamIdentifier)`. Read more about [mapping streams in watchRTC](https://testrtc.com/docs/mapping-streams-in-watchrtc/). | ||
- id - the StreamIdentifier to map from in the PeerConnection object | ||
- name - the human-readable name to assign and display for it | ||
- **id** - the StreamIdentifier to map from in the PeerConnection object | ||
- **name** - the human-readable name to assign and display for it | ||
@@ -209,2 +209,15 @@ ```javascript | ||
### Mapping tracks | ||
By default, watchRTC will assign the SSRC information as the name for incoming channels. You can change these to human-readable format indicating the source of the channels by mapping their streams. This is done by calling `watchRTC.mapTrack(trackIdentifier)`. Read more about [mapping streams in watchRTC](https://testrtc.com/docs/mapping-streams-in-watchrtc/). | ||
- **id** - the TrackIdentifier to map from in the PeerConnection object | ||
- **name** - the human-readable name to assign and display for it | ||
```javascript | ||
watchRTC.mapTrack("c085d50a-bb28-4d9f-97b1-86bfc646e5b0", "User A"); | ||
``` | ||
_Note_: The `trackIdentifier` corresponds to the remote RTCMediaStreamTrack's Id attribute. | ||
### Collect WebRTC statistics (BETA) | ||
@@ -242,2 +255,3 @@ | ||
- **direction**: String value. Can be one of `inbound` or `outbound`, | ||
- **mappedName**: String value. The name given when calling `mapTrack` and associated with this stream. `null` by default, | ||
- **jitter**: Number in seconds. Average during the last interval. Null if not available, | ||
@@ -258,2 +272,22 @@ - **roundTripTime**: Number in seconds. Average during the last interval. Null if not available, | ||
### Listen to the SDK's connectivity state | ||
Once the watchRTC SDK is initialized, it will report its state changes. Listening to the state can be done by adding a listener from your application. | ||
```javascript | ||
const stateListener = (state) => { | ||
// Called each time SDK state is changed | ||
}; | ||
watchRTC.addStateListener(stateListener); | ||
``` | ||
Each time the state changes, the listener will be called with a JSON object containing new state. | ||
The JSON object contains 1 property: | ||
- **connectionStatus**: String value. Can be one of `connected` or `disconnected`, | ||
_Note_: To stop listening, pass `null` to the `addStateListener()` function. The existing listener will be unsubscribed and removed. | ||
## Samples | ||
@@ -266,2 +300,17 @@ | ||
### 1.36.0 (###,2023) | ||
#### Deprecation methods | ||
- `watchRTC.mapStream() method is deprecated and should be replaced by watchRTC.mapTrack()` | ||
#### New features | ||
- `watchRTC.mapTrack()` was added | ||
- Property `mappedName` added to the `statsListener` which contains the name associated to the stream. | ||
### 1.35.3 (Dec 6, 2022) | ||
#### New features | ||
- `watchRTC.addStateListener()` was added | ||
### 1.35.2 (Nov 8, 2022) | ||
@@ -268,0 +317,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
526892
1345
430
2