Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

intel/cordova-plugin-intel-xdk-audio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

intel.xdk.audio

For recording sounds with the microphone and playing them back.

Description

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

Methods

Events

Methods

addSound

Blend a pre-existing sound file into an in-progress recording.

intel.xdk.audio.addSound(soundFile);

Description

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.

Available Platforms

  • Apple iOS
  • Google Android
  • Microsoft Windows 8 - BETA
  • Microsoft Windows Phone 8 - BETA

Parameters

  • 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 (?).

Example

continuePlaying

Resume playing a paused sound recording file.

intel.xdk.audio.continuePlaying();

Description

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.

Available Platforms

  • Apple iOS
  • Google Android
  • Microsoft Windows 8 - BETA
  • Microsoft Windows Phone 8 - BETA

Events

  • play.start: The current recorded sound file playback was successfully resumed.
  • play.error: An error occurred when attempting to resume the paused playback.

Example

continueRecording

Resume a paused recording.

intel.xdk.audio.continueRecording();

Description

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.

Available Platforms

  • Apple iOS
  • Google Android
  • Microsoft Windows 8 - BETA
  • Microsoft Windows Phone 8 - BETA

Events

  • record.start: The recording waas successfully resumed.
  • record.error: An error occurred when attempting to resume the recording.

Example

clearRecordings

Remove all recorded sound files.

intel.xdk.audio.clearRecordings()

Description

This method removes all recorded sound files from the recording list.

Events

  • record.clear: All recorded sound files have been deleted, and the recording list is empty.

deleteRecording

Remove a recorded sound file.

intel.xdk.audio.deleteRecording(recording)

Description

This method removes a single recorded sound file from the recording list.

Parameters

  • 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.

Events

  • 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 to deleteRecording.
  • 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.

Example

getRecordingList

Get a list of all recorded sound files.

recordings = intel.xdk.audio.getRecordingList()

Description

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.

Returns

  • An array containing the file names (not the complete paths) of all the recorded sound files in the recording list.

Example

getRecordingURL

Get a URL for accessing a recorded sound file.

url = intel.xdk.audio.getRecordingURL(recording)

Description

This method returns the full path URL of a recorded sound file, given the file name from the array returned by getRecordingList.

Parameters

  • recording: A file name from the array of file names returned by a call to getRecordingList.

Returns

  • An string containing a complete path URL for the recorded sound file whose file name is recording.

Example

recordings = intel.xdk.getRecordingList();
url = intel.xdk.getRecordingURL(recordings[0]);

Events

picture.add

Fired when a photo is added to the application's picture list

Description

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.

picture.busy

Fired when accessing the native camera functionality is blocked by another process

picture.cancel

Fired when the user chooses to cancel rather than taking or importing a picture

Description

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

picture.clear

This event is fired when the application's picture list has been cleared.

picture.remove

This event is fired when a photo is removed from application's picture list.