Skip to main content

API reference

This page will contain the javascript API reference for the recorder.

Recorder class

The recorder class is the main class of the recorder.

new Recorder(Element, Options);

Constructor

Element: HTMLElement

The element or selector that the recorder will be mounted in.

Options: Object

An object containing the options for the recorder.

const options = {
recorderType: 'camera',
accessToken: 'documenta-tion-toke-n935-27ee26170781',
language: 'en',
troubleShootingUrl: 'https://link-to-trouble-shooting-guide.com/guide'
renderToPlaceholder: true,
showProgress: true
}
recorderType: String

The type of recording. Supported types:

  • camera
  • screen
  • screencamera
  • audio
accessToken: String

The token that gives you permission to upload the recording.

language: String

The language of the recorder. Supported languages:

  • da (Danish)
  • en (English)
  • de (German)
troubleShootingUrl: String

A url to a helping page if the user fails to give permission to the camera/screen recording.

renderToPlaceholder: Boolean

A flag that indicates if there should be a placeholder when using the renderTo() method.

showProgress: Boolean

Flag indicating whether or not the upload progress should be shown on the recorder when uploading the recording.

Methods

The methods avaliable on the recorder class.

Uploads the recording to the Pathfindr storage

upload();

Renders the component in another container

renderTo(Element);

Element: HTMLElement

The HTMLElement that the recorder will be rendered in. If null the recorder will be rendered in the starting element.

Destroy the component:

// returns a promise - resolves when the component is destroyed
destroy();

Listens for events being emitted:

on(Event, Callback);

Event: String

The name of the event

Callback: Function

The function to be called when the event is emitted.

Events

The events avaliable on the recorder class.

// Listens for uploading progress when uploading a recording
recorder.on('upload-has-progressed', (data) => {
const progress = event.detail;
console.log(progress);
});
// Listens for when a recording is ready to be uploaded.
recorder.on('ready-to-be-uploaded', (data) => {
const recordingReady = event.detail;
console.log(recordingReady);
});
// Listen for when the recorder changes state (inactive, recording, paused)
recorder.on('state-has-changed', (event) => {
const state = event.detail;
console.log(state);
});
// Listen for when the recorder changes state (inactive, recording, paused)
recorder.on('internal-close-request', (event) => {
const state = event.detail;
console.log(state);
});