openreplay/tracker/tracker-assist
2022-02-10 23:51:32 +01:00
..
layout cherry pick changes from 240ce27681 2021-11-20 00:08:55 +05:30
src feat(assist): 3.5.0: transition to WS, remote control separation + better customize configuration 2022-02-10 23:51:32 +01:00
.gitignore feat(assist): 3.5.0: transition to WS, remote control separation + better customize configuration 2022-02-10 23:51:32 +01:00
.npmignore feat(assist): 3.5.0: transition to WS, remote control separation + better customize configuration 2022-02-10 23:51:32 +01:00
LICENSE feat (tracker-axios): wip 2021-06-30 13:42:15 +02:00
package-lock.json feat(tracker-assist): 3.5.0 websocket-rewritten 2022-02-08 23:07:19 +01:00
package.json feat(tracker-assist): 3.5.0 websocket-rewritten 2022-02-08 23:07:19 +01:00
README.md feat(tracker-assist): 3.4.13: scroll behaviour improvement & mouse events incapsulation 2022-01-11 09:30:59 +01:00
tsconfig-cjs.json feat (tracker-axios): wip 2021-06-30 13:42:15 +02:00
tsconfig.json feat(tracker-assist): 3.4.8: webpack 5 fully specified imports 2021-11-29 11:51:02 +01:00

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
}