This plugin provides the ability to record and playback audio files on a device.
Plugin.xml
Added this line for the android
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
7.0.0
AudioInfo
CheckStatus
GetCurrentAmplitude
GetCurrentPosition
GetDuration
AudioPlaybackControls
Pause
Play
Resume
Stop
AudioRecordControls
StartRecord
StopRecord
AudioSettings
SeekTo
SetRate
SetVolume
Other
CheckMediaPlugin
Release
CallResult
Code <Integer>
Message <Text>
The error output will include a code and a message from Cordova, except for the special case of code -1. This custom code was introduced specifically for the GetDuration Action to manage its failure, as it does not return a MediaError Object from Cordova.
A code of -1 was assigned with the foresight of potential future releases introducing new codes. This measure serves to avoid any conflict with future codes and ensures that this custom code remains distinct.
Error (CallResult)
-1 = “Duration not available” (Only for getDuration)
(0…x) = An error message from Cordova describing the details of the error
The status output will feature a code from Cordova along with a message assigned by this component to clarify its significance.
Status (CallResult)
0 = “None”
1 = “Starting”
2 = “Running”
3 = “Paused”
4 = “Stopped”
Returns the status of the current audio file being played or recorded.
Outputs
Returns the current amplitude within an audio file.
IsSuccess <Boolean>
Amplitude <Decimal>
Returns the current position (in seconds) within an audio file.
Positions <Decimal>
Returns the duration of an audio file in seconds.
Inputs
Source <Text> (File name. Example: "audio.aac")
Duration <Decimal>
Pause playback of an audio file.
Starts playing an audio file.
Resumes playing an audio file.
Stop playing an audio file.
Note: The release() will be called in this flow.
Start recording an audio file.
Stop recording an audio file.
Moves the position within the audio file.
Milliseconds <Decimal>
Set the playback rate for the audio file.
Rate <Decimal> (Example: 2.0)
Set the volume for audio playback.
Volume <Decimal> (The value must be within the range of 0.0 to 1.0).
Checks if Cordova Media Plugin is available or not.
Note: In this action, it's also checked if cordova is available from CommonPlugin.
Releases the underlying operating system's audio resources.
Not tested on iOS
I omitted two additional options for the play() method in Cordova (numberOfLoops and playAudioWhenScreenIsLocked) specifically because I wanted to avoid incorporating elements that I couldn't verify through testing.The same applies to pauseRecord() and resumeRecord() methods.
You may need the File Plugin (supported by OutSystems) to view files recorded.
I'll make an effort to stay in sync with Cordova's media plugin changes to ensure this component remains current. If you'd rather not receive updates, feel free to tag your preferred version directly from my GitHub repository in the Extensibility Configuration module property.
Cordova-plugin-media
GitHub - apache/cordova-plugin-media
GitHub - VITOR-EFL-DEV/cordova-plugin-media