audio-utilis

1.1.0 • Public • Published

audio-utilis

can record,play,stop and cleanup

Installation

npm install audio-utilis

Usage

import { StartRecording, StopRecording, PlayRecordedFile, CleanUpFiles, PauseRecordedFile, ResumeRecordedFile, StopWhilePlayingRecordedFile, GetRecordingObj, } from 'audio-utilis';

// ...

const [isRecording, setIsRecording] = useState(false); const [isPlaying, setIsPlaying] = useState(false);

const handleStartRecs = () => { setIsRecording(true); StartRecording(); };

const handleStopRecs = () => { ... setIsRecording(false); StopRecording(); };

const cleanUpRecds = () => { ... CleanUpFiles(); };

const handlePlayAudio = async () => { return new Promise((resolve, reject) => { setIsPlaying(true); PlayRecordedFile() .then(flag => { console.log('in func ===> ', flag); setIsPlaying(!flag); resolve(flag); }) .catch(error => { reject(error); setIsPlaying(false); }); }); };

const handlePauseRecd = () => { setIsPlaying(false); PauseRecordedFile(); };

const getFile = () => { const recdFile = await GetRecordingObj(); console.log(recdFile); };

const cancelAudioPlayer = () => { StopWhilePlayingRecordedFile(); setIsPlaying(false) };

const resumeRecording = () => { ResumeRecordedFile(); setIsRecording(True) };


Package Sidebar

Install

npm i audio-utilis

Weekly Downloads

1

Version

1.1.0

License

ISC

Unpacked Size

271 kB

Total Files

40

Last publish

Collaborators

  • arfeen000