DISCONTINUATION OF PROJECT.
This project will no longer be maintained by Intel.
Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project.
Intel no longer accepts patches to this project.
If you have an ongoing need to use this project, are interested in independently developing it, or would like to maintain patches for the open source software community, please create your own fork of this project. DISCONTINUATION OF PROJECT. This project will no longer be maintained by Intel. Intel will not provide or guarantee development of or support for this project, including but not limited to, maintenance, bug fixes, new releases or updates. Patches to this project are no longer accepted by Intel. In an effort to support the developer community, Intel has made this project available under the terms of the Apache License, Version 2. If you have an ongoing need to use this project, are interested in independently developing it, or would like to maintain patches for the community, please create your own fork of the project.
For recording sounds with the microphone and playing them back.
The audio object provides methods to control the recording and playback of audio files. The audio object contains a list of audio recordings known as the "recording list". The recording list is where new recordings are placed once they are created.
Recordings may be created from the device's native microphone and added to the recording list with the startRecording, stopRecording, pauseRecording, and continueRecording methods. An existing sound file may be blended into a recording using addSound.
All the recordings on the list may be listed in an array using getRecordingList, and a reference to a particular recording for use in an application can be obtained with the getRecordingURL method.
A recording can be played back with the startPlaying, stopPlaying, pausePlaying, and continuePlaying methods.
Individual recordings may be removed from the list with deleteRecording, or the recording list may be wiped clear using clearRecordings. Finally, files in the picture list may be referenced for use in an application with
- startPlaying — Start playing a recorded sound file.
- pausePlaying — Pause playing a recorded sound file.
- continuePlaying — Resume playing a paused recorded sound file.
- stopPlaying — Stop playing a recorded sound file.
- startRecording — Start recording with the device microphone.
- addSound — Blend a pre-existing sound file into an in-progress recording.
- pauseRecording — Pause recording.
- continueRecording — Continue a paused recording.
- stopRecording — Stop recording and saved the recorded sound file.
- deleteRecording — Remove a recorded sound file from the device.
- clearRecordings — Remove all recorded sound files from the device.
- getRecordingList — Get a list of all recorded sound files.
- getRecordingURL — Get a URL for accessing a recorded sound file.
- play.busy — startPlaying was called when a file was already being played.
- play.continue — Playback of a file was continued.
- play.error — An error occurred when trying to play a file.
- play.pause — Playback of a file was paused.
- play.start — Playback of a file started.
- play.stop — Playback of a file finished or was stopped.
- record.busy — startRecording was called when recording was already in progress.
- record.clear — All files were removed from the recording list.
- record.continue — Recording was continued.
- record.error — An error occurred when trying to make a recording.
- record.notRemoved — An error occurred while trying to
remove a recorded sound file. - record.pause — Recording was paused.
- record.removed — A file was removed from the recording list.
- record.start — Recording started.
- record.stop — Recording was stopped and the recorded file was saved.
Blend a pre-existing sound file into an in-progress recording.
intel.xdk.audio.addSound(soundFile);
This method is called while a recording (started by startRecording) is in progress. It takes an existing sound file (not a recording sound file), and overlays the sound it contains on top of the current portion of the recording.
(Actually, addSound
just records the current time in the recording and the
name of the added sound file; the blending is done in a post-processing step
when the recording is complete.)
If no recording is currently in progress, then this method has no effect.
- Apple iOS
- Google Android
- Microsoft Windows 8 - BETA
- Microsoft Windows Phone 8 - BETA
- soundFile: The file name (not the complete path) of the sound file to be
blended into the recording. The plugin looks for a sound file with that name in (?).
Resume playing a paused sound recording file.
intel.xdk.audio.continuePlaying();
This method is called when the playback of a sound recording file has been paused by a call to pausePlaying, and causes the playback to resume where it left off. If there is not a currently paused playback, then this method has no effect.
- Apple iOS
- Google Android
- Microsoft Windows 8 - BETA
- Microsoft Windows Phone 8 - BETA
- play.start: The current recorded sound file playback was successfully resumed.
- play.error: An error occurred when attempting to resume the paused playback.
Resume a paused recording.
intel.xdk.audio.continueRecording();
This method is called when recording with the device's microphone has been paused by a call to pauseRecording, and causes the recording to resume. If there is not a currently paused recording, then this method has no effect.
- Apple iOS
- Google Android
- Microsoft Windows 8 - BETA
- Microsoft Windows Phone 8 - BETA
- record.start: The recording waas successfully resumed.
- record.error: An error occurred when attempting to resume the recording.
Remove all recorded sound files.
intel.xdk.audio.clearRecordings()
This method removes all recorded sound files from the recording list.
- record.clear: All recorded sound files have been deleted, and the recording list is empty.
Remove a recorded sound file.
intel.xdk.audio.deleteRecording(recording)
This method removes a single recorded sound file from the recording list.
- recording: The file name (not the complete path) of the sound file to be removed. This is a name which was in the array returned by getRecordingList.
- record.removed: A recorded sound file has been
deleted. The event object has a
name
property which is the string that was passed as the recording argument todeleteRecording
. - record.notRemoved: A call to
deleteRecording
did not delete a recorded sound file. The recording argument may not have been the name of a file in the recording list, or there may have been some other error.
Get a list of all recorded sound files.
recordings = intel.xdk.audio.getRecordingList()
This method returns an array containing the file names (not the complete paths) of all the recorded sound files in the recording list. Pass one of the file names to getRecordingURL to get a complete file path URL for the file.
- An array containing the file names (not the complete paths) of all the recorded sound files in the recording list.
Get a URL for accessing a recorded sound file.
url = intel.xdk.audio.getRecordingURL(recording)
This method returns the full path URL of a recorded sound file, given the file name from the array returned by getRecordingList.
- recording: A file name from the array of file names returned by a call to getRecordingList.
- An string containing a complete path URL for the recorded sound file whose file name is recording.
recordings = intel.xdk.getRecordingList();
url = intel.xdk.getRecordingURL(recordings[0]);
Fired when a photo is added to the application's picture list
This event is fired in response to a takePicture or importPicture method once a photo is available to the application in the picture list. The event is returned with two parameters.
- success: This parameter returns a true or a false depending on whether the photo was successfully captured or not.
- filename: The filename of the image in the picture list.
Once an image has been added to the picture list, it can be referenced in an application using getPictureURL and passing its filename. The entire list of available images file names can be accessed using getPictureList.
Fired when accessing the native camera functionality is blocked by another process
Fired when the user chooses to cancel rather than taking or importing a picture
Fired when the user chooses to cancel rather than taking or importing a picture.
The event is returned with one parameter.
- success: This parameter is always false for the cancel event
This event is fired when the application's picture list has been cleared.
This event is fired when a photo is removed from application's picture list.