Skip to content

About

🎤 🎵 NativeScript plugin to record and play audio 🎵 🎤

Resources

Stars

0 stars

Watchers

1 watching

Forks

 
 

Latest commit

 

History

39 Commits

Folders and files

Repository files navigation

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

About

🎤 🎵 NativeScript plugin to record and play audio 🎵 🎤

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages