OpenReplay Tracker Assist plugin
Tracker plugin for WebRTC video support at your site.
Installation
npm i @openreplay/tracker-assist
Usage
Initialize the @openreplay/tracker
package as usual and load the plugin into it.
import Tracker from '@openreplay/tracker';
import trackerAssist from '@openreplay/tracker-assist';
const tracker = new Tracker({
projectKey: YOUR_PROJECT_KEY,
});
tracker.start();
tracker.use(trackerAssist());
Options:
{
confirmText: string,
confirmStyle: Object,
config: RTCConfiguration,
onAgentConnect: () => (()=>void | void),
onCallStart: () => (()=>void | void),
}
Use confirmText
option to specify a text in the call confirmation popup.
You can specify its styles as well with confirmStyle
style object.
{
background: "#555"
color: "orange"
}
It is possible to pass config
RTCConfiguration object in order to configure TURN server or other parameters.
config: {
iceServers: [{
urls: "stun:stun.services.mozilla.com",
username: "louis@mozilla.com",
credential: "webrtcdemo"
}, {
urls: ["stun:stun.example.com", "stun:stun-1.example.com"]
}]
}
You can pass onAgentConnect
callback. It will be called when someone from OpenReplay UI connects to the current live session. It can return another function. In this case, returned callback will be called when the same agent connection gets closed.
onAgentConnect: () => {
console.log("Hello!")
const onAgentDisconnect = () => console.log("Bye!")
return onAgentDisconnect
}
Warning: it is possible for the same agent to be connected/disconnected several times during one session due to a bad network. Several agents may connect simultaneously.
A callback onCallStart
will be fired when the end-user accepts the call. It can return another callback that will be called on the call end.
onCallStart: () => {
console.log("Allo!")
const onCallEnd = () => console.log("short beeps...")
return onCallEnd
}