More Control Over The SDK

If you need more flexibility over the SDK you can use these methods.

API Identification

The first step is to identify the client with the api token:

1
2
3
4
5
6
7
8
// 1st parameter is API token
// 2nd parameter is custom parameters to identify each event
// 3rd parameter is to automatically start recording
RobbieVisio.init("api_token", {
  label: 'your-custom-label',
  $name: 'John',
  $id: 'John2778495'
}, false)

Validate Camera Permissions

When executed the user will be asked for camera permissons if they were not previously granted.

1
2
3
4
5
6
7
8
RobbieVisio.validateCameraPermission()
  .then(function() {
    // User has granted camera access or permission was previously given
  })
  .catch(function(error) {
    // Something bad happened
    // Like user refuses to give permissions.
  });

Create a Session

1
2
3
4
5
6
7
RobbieVisio.createSession(parameters)
  .then(function(session) {
    // Session is succesfully created
  })
  .catch(function(error) {
    // Something bad happened.
  })

Start Recording

1
2
3
4
5
6
7
session.startRecording()
  .then(function() {
    // Event was sucessfully sent
  })
  .catch(function(error) {
    // Something bad happened
  });

Update Session Parameters

1
session.updateParameters(parameters);

Close Session

1
session.close();

Keep in mind that Session is not a reusable object, it does not allow event sending after it's closed.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
RobbieVisio.init("123456789");

RobbieVisio.validateCameraPermission()
  .then(RobbieVisio.createSession)
  .then(function(session) {
   return session.startRecording({
      $patient_name: "Joe",
      $id: "Joe_Doe_882774g",
      $patient_illness: "depression",
      doctor_name: "Mike",
      treatment: "Aderol"
    })
  })
  .catch(function(error) {
     console.error(error);
  });

Browser support

For now Robbie Visio SDK only supports desktop browsers:
Chrome 34+
Firefox 29+
Edge 12+