This type represents an audio recording.
An instance of this type can be obtained using the following function calls:
Once the application needs the decrypted file format of the Recording it can retrieve it with getAsFile function.
To delete the Recording the destroy function must be called.
An instance of this type can be obtained using the following function calls:
- audioCapture - used when a new recording is created (or continued at resume)
- getAll - used when the application is restarted. The application can retrieve all the existing recordings by this function
- get - used when the application is restarted. The application can save the id of the recordings. Once the application is started the recording for the saved id can be obtained by this function.
Once the application needs the decrypted file format of the Recording it can retrieve it with getAsFile function.
To delete the Recording the destroy function must be called.
Properties:
Name | Type | Description |
---|---|---|
id |
string | The id of the recording |
Methods
destroy(successCallbackopt, errorCallbackopt)
Deletes the file on encryptedFilePath.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
successCallback |
sap.VoiceRecording.Recording.DestroySuccessCallback |
<optional> |
Callback method upon success. |
errorCallback |
sap.VoiceRecording.Recording.DestroyErrorCallback |
<optional> |
Callback method upon failure. |
Throws:
Will throw an error if an ongoing voice recording operation is in progress.
getAsFile(successCallback, errorCallback)
Creates a decrypted file representation of the Recording object.
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
sap.VoiceRecording.Recording.GetAsFileSuccessCallback | Callback method upon success. Invoked with the decrypted file path. |
errorCallback |
sap.VoiceRecording.Recording.GetAsFileErrorCallback | Callback method upon failure. |
Throws:
Will throw an error if an ongoing voice recording operation is in progress.
getCreationDate() → {Date}
Returns the creation date of the Recording.
Returns:
the date of the creation of the recording
- Type
- Date
getDuration() → {Number}
Returns the duration of the Recording (in milliseconds).
Returns:
the duration of the recording in milliseconds
- Type
- Number
getFileName() → {string}
Returns the filename of the Recording. Once getAsFile function is called it will generate the file with this given filename.
This filename is generated automatically by VoiceRecording, but can be changed with setFileName
Returns:
the filename of the recording
- Type
- string
play(successCallbackopt, errorCallbackopt)
Open a new playback dialog where the user can play back the voice recording.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
successCallback |
sap.VoiceRecording.Recording.PlaySuccessCallback |
<optional> |
Callback method upon success. |
errorCallback |
sap.VoiceRecording.Recording.PlayErrorCallback |
<optional> |
Callback method upon failure. |
Throws:
Will throw an error if an ongoing voice recording operation is in progress.
setFileName(fileName, successCallback, errorCallback)
Sets the filename of the Recording. The filename is used only when the file representation is generated by getAsFile function.
This filename is generated automatically by VoiceRecording, but can be changed with by this function.
Parameters:
Name | Type | Description |
---|---|---|
fileName |
string | the filename to be set for this recording. |
successCallback |
sap.VoiceRecording.Recording.SetFileNameSuccessCallback | Callback method upon success. |
errorCallback |
sap.VoiceRecording.Recording.SetFileNameErrorCallback | Callback method upon failure. |
Throws:
Will throw an error if an ongoing voice recording operation is in progress.
Type Definitions
DestroyErrorCallback(error, extraopt)
Callback invoked to inform the user about the destroy process.
- 'metadata_error': can not read/write metadata. 'extra' parameter is the nested error from file plugin.
- 'file_error': can not read/write files. 'extra' parameter is the nested error from file plugin.
- 'unknown_error': unknown error happened. 'extra' parameter is the nested error.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
error |
string | the error code (see above) | |
extra |
Object |
<optional> |
an object containing the nested error |
DestroySuccessCallback()
Callback invoked to inform the user about the destroy process.
GetAsFileErrorCallback(code, extraopt)
Callback invoked to inform the user about the decryption process.
The error codes and the associated extra parameters can be the following:
- 'file_error': can not read/write files. 'extra' parameter is the nested error from file plugin.
- 'logon_error': logon is not initialized - extra parameter is the nested error comes from logon plugin.
- 'encrypted_storage_error': error thrown by encrypted storage - extra parameter is the nested error comes from encrypted storage.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
code |
string | error code | |
extra |
Object |
<optional> |
an object associated to the given error code |
GetAsFileSuccessCallback(path)
Callback invoked to inform the user about the decryption process.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The path of the decrypted file. |
PlayErrorCallback(error, extraopt)
Callback invoked to inform the user about the play recording process.
The error codes and the associated extra parameters can be the following:
- 'cancel_error': the recording was cancelled by the user, but there was an error during closing the audio recorder.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
error |
string | the error code (see above) | |
extra |
Object |
<optional> |
an object containing the nested error |
PlaySuccessCallback()
Callback invoked to inform the user about the play voice recording process.
SetFileNameErrorCallback(code, extraopt)
Callback invoked to inform the user about the setFileName process.
The error codes and the associated extra parameters can be the following:
- 'encrypted_storage_error': error thrown by encrypted storage - extra parameter is the nested error comes from encrypted storage.
- 'metadata_error': can not read/write metadata. 'extra' parameter is the nested error from file plugin.
- 'file_error': can not read/write files. 'extra' parameter is the nested error from file plugin.
- 'unknown_error': unknown error happened. 'extra' parameter is the nested error.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
code |
string | error code | |
extra |
Object |
<optional> |
an object associated to the given error code |
SetFileNameSuccessCallback()
Callback invoked to inform the user about the setFileName process.