Skip to content

Latest commit

 

History

History
executable file
·
61 lines (40 loc) · 2.31 KB

README.md

File metadata and controls

executable file
·
61 lines (40 loc) · 2.31 KB

npm npm

NativeScript-Audio

NativeScript plugin to play and record audio files for Android and iOS.

Uses the following native classes:

Android

iOS

Installation

npm install nativescript-audio

Sample Screen

AudioExample

API

TNSRecorder

Method Description
TNSRecorder.CAN_RECORD(): boolean Determine if ready to record.
start({ filename: string, errorCallback?: Function, infoCallback?: Function }): Promise Start recording file.
stop(): void Stop recording.
dispose(): void Free up system resources when done with recorder.

TNSPlayer

Method Description
playFromFile( { audioFile: string, completeCallback?: Function, errorCallback?: Function, infoCallback?: Function; } ): Promise Play from a file.
playFromUrl( { audioFile: string, completeCallback?: Function, errorCallback?: Function, infoCallback?: Function; } ): Promise Play from a url.
pause(): void Pause playback.
seekTo(time:number): Promise<boolean> Seek to position.
dispose(): void Free up resources when done playing audio.
isAudioPlaying(): boolean Determine if player is playing.
getAudioTrackDuration(): Promise duration of media file assigned to mediaPlayer

Why the TNS prefixed name?

TNS stands for Telerik NativeScript

iOS uses classes prefixed with NS (stemming from the NeXTSTEP days of old): https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/

To avoid confusion with iOS native classes, TNS is used instead.

License

MIT