C# Class WPCordovaClassLib.Cordova.Commands.AudioPlayer

Implements audio record and play back functionality.
Inheritance: IDisposable
Show file Open project: ChristianWeyer/tUdUs Class Usage Examples

Public Methods

Method Description
AudioPlayer ( Media handler, String id ) : System

Creates AudioPlayer instance

Dispose ( ) : void

Destroys player and stop audio playing or recording

getCurrentPosition ( ) : double

Gets current position of playback

getDuration ( string filePath ) : double

Gets the duration of the audio file

pausePlaying ( ) : void

Pauses playing

seekToPlaying ( int milliseconds ) : void

Seek or jump to a new time in the track

setVolume ( double vol ) : void

Set the volume of the player

startPlaying ( string filePath ) : void

Starts or resume playing audio file

Starts or resume playing audio file

startRecording ( string filePath ) : void

Starts recording, data is stored in memory

stopPlaying ( ) : void

Stops playing the audio file

stopRecording ( ) : void

Stops recording

Private Methods

Method Description
FinalizeXnaGameLoop ( ) : void

Finalizes XNA game loop for microphone

InitializeXnaGameLoop ( ) : void

Special initialization required for the microphone: XNA game loop

InvokeCallback ( int message, double value, bool removeHandler ) : void
InvokeCallback ( int message, int value, bool removeHandler ) : void
InvokeCallback ( int message, string value, bool removeHandler ) : void
MediaEnded ( object sender, RoutedEventArgs arg ) : void

Callback to be invoked when playback of a media source has completed

MediaFailed ( object sender, RoutedEventArgs arg ) : void

Callback to be invoked when playback of a media source has failed

MediaOpened ( object sender, RoutedEventArgs arg ) : void

Callback to be invoked when the media source is ready for playback

SaveAudioClipToLocalStorage ( ) : void

Writes audio data from memory to isolated storage

SetState ( int state ) : void

Sets the state and send it to JavaScript

recorderBufferReady ( object sender, EventArgs e ) : void

Copies data from recorder to memory storages and updates recording state

Method Details

AudioPlayer() public method

Creates AudioPlayer instance
public AudioPlayer ( Media handler, String id ) : System
handler Media Media object
id String player id
return System

Dispose() public method

Destroys player and stop audio playing or recording
public Dispose ( ) : void
return void

getCurrentPosition() public method

Gets current position of playback
public getCurrentPosition ( ) : double
return double

getDuration() public method

Gets the duration of the audio file
public getDuration ( string filePath ) : double
filePath string The name of the audio file
return double

pausePlaying() public method

Pauses playing
public pausePlaying ( ) : void
return void

seekToPlaying() public method

Seek or jump to a new time in the track
public seekToPlaying ( int milliseconds ) : void
milliseconds int The new track position
return void

setVolume() public method

Set the volume of the player
public setVolume ( double vol ) : void
vol double volume 0.0-1.0, default value is 0.5
return void

startPlaying() public method

Starts or resume playing audio file Starts or resume playing audio file
public startPlaying ( string filePath ) : void
filePath string The name of the audio file
return void

startRecording() public method

Starts recording, data is stored in memory
public startRecording ( string filePath ) : void
filePath string
return void

stopPlaying() public method

Stops playing the audio file
public stopPlaying ( ) : void
return void

stopRecording() public method

Stops recording
public stopRecording ( ) : void
return void