Obtaining information about the recording

The RecordingInfo class contains information about a recording made using the Call.record() method, for example the length of the recording. A RecordingInfo object is returned when the Call.record() method is invoked. The class has the following properties, which can be extracted from the RecordingInfo object using the appropriate get method:

  • keyPressed: the key that the caller pressed to indicate that they had finished recording their message.
  • lengthRecorded: the duration of the recording in seconds.
  • terminationReason: how the recording was terminated. Possible values are:
    • RecordingInfo.MAX_SILENCE: no voice was detected
    • RecordingInfo.KEY_PRESSED: the caller pressed a DTMF key
    • RecordingInfo.MAX_RECORD_LENGTH: the recording exceeded the specified maximum length
For example:
public class InApp extends WVRApplication {
  .
  .
  .
  // Create the segment object for recording a message to a voice segment in the
  // Recordings category
  VoiceSegment vs_caller_message  = new VoiceSegment("Recordings", "CallerMessage");
  .
  .
  .
  // Record the message using the maximum time limit
  RecordingInfo input = call.record(vs_caller_message, -1, false, true);
  // If the user terminated the recording by pressing a key, find out which key they used
  if (input.getTerminationReason() == RecordingInfo.KEY_PRESSED) {
    Character key = input.getKeyPressed();
  }
  .
  .
  .
}