1.0.1 • Published 7 years ago

cordova-plugin-media-danding v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

title: cordova-media-danding description: Record and play audio on the device.

cordova-plugin-media

This plugin provides the ability to record and play back audio files on a device.

NOTE: The current implementation does not adhere to a W3C specification for media capture, and is provided for convenience only. A future implementation will adhere to the latest W3C specification and may deprecate the current APIs.

This plugin defines a global Media Constructor.

Although in the global scope, it is not available until after the deviceready event.

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    console.log(Media);
}

Installation

cordova plugin add cordova-plugin-media

Supported Platforms

  • Android
  • BlackBerry 10
  • iOS
  • Windows Phone 7 and 8
  • Tizen
  • Windows 8
  • Windows
  • Browser

Media

var media = new Media(src, mediaSuccess, [mediaError], [mediaStatus]);

Methods

  • media.getCurrentAmplitude: Returns the current position within an audio file.

  • media.getAudioFullPath: return the tempfile path in android platform

  • media.getCurrentPosition: Returns the current position within an audio file.

  • media.getDuration: Returns the duration of an audio file.

  • media.play: Start or resume playing an audio file.

  • media.pause: Pause playback of an audio file.

  • media.pauseRecord: Pause recording of an audio file.

  • media.release: Releases the underlying operating system's audio resources.

  • media.resumeRecord: Resume recording of an audio file.

  • media.seekTo: Moves the position within the audio file.

  • media.setVolume: Set the volume for audio playback.

  • media.startRecord: Start recording an audio file.

  • media.stopRecord: Stop recording an audio file.

  • media.stop: Stop playing an audio file.

Additional ReadOnly Parameters

  • position: The position within the audio playback, in seconds.

    • Not automatically updated during play; call getCurrentPosition to update.
  • duration: The duration of the media, in seconds.

media.getCurrentAmplitude

Returns the current amplitude of the current recording.

media.getCurrentAmplitude(mediaSuccess, [mediaError]);

Supported Platforms

  • Android
  • iOS