npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@deep-foundation/capacitor-voice-recorder

v1.2.7-dev.28

Published

[![npm](https://img.shields.io/npm/v/@deep-foundation/capacitor-voice-recorder.svg)](https://www.npmjs.com/package/@deep-foundation/capacitor-voice-recorder) [![Gitpod](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod

Downloads

221

Readme

npm Gitpod Discord

Provides links&functions based on capacitor-voice-recorder.

Documentation

List of links

AudioRecords

The AudioRecords link serves as a container for link structures representing records inside deep.

Sound

The Sound link represents recorded data as base64 string. All links of type Sound can be played with left click.

capacitor-voice-recorder provides only MIME/type as audio prop and it gets stored as link.

All new links of type Sound will be parced with async handler inside Sound package using music-metadata npm library. Useful data will be stored as a prop links inside Sound link. Make sure to give permissions to Sound package with Join link.

Prerequisitions

  • Install this package in your deep by using npm-packager
  • Provide permissions to this package and its dependencies.

Usage

  1. Import the library into your TypeScript project:
import Recorder, { createContainer } from "@deep-foundation/capacitor-voice-recorder";
  1. Create container link of type "AudioRecords" to store Recorder data:
const containerLinkId = await createContainer(deep);

You can also create it manually inside your deepcase client. Open Insert menu, search for and then insert "AudioRecords" type link.

  1. Getting permissions:

Call getAudioRecordingPermissions method of the Recorder to get audio recording and microphone usage permissions for your app.

const permissionSatus = await Recorder.getAudioRecordingPermissions(); 
  1. Recording Audio:

Start recording audio and return the playback status.

const isrecording = await Recorder.startRecording(); 

Pause the ongoing recording and return the playback status.

const ispaused = await Recorder.pauseRecording();; 

Resume the ongoing recording and return the playback status.

const isresumed = await Recorder.resumeRecording(); 

Stop the ongoing recording, upload the recorded sound, and return the recorded sound with info.

const { recordDataBase64, msDuration, mimeType } = await Recorder.stopRecording({
  deep, // The DeepClient object
  containerLinkId, // The ID of the container link
});
  1. Download records from deep database:

Download all existing records made by this recorder as array of IRecord records.

const records = Recorder.downloadRecords(deep); 

React Usage

  1. Import VoiceRecorder react component or hooks:
import { WithVoiceRecorder, VoiceRecorder, useContainer, useRecordingCycle, useRecordingStatus } from "@deep-foundation/capacitor-voice-recorder";
  1. Create VoiceRecorder component instance inside your deep app and pass a DeepClient instance.
  <VoiceRecorder deep={deep} />

You will see basic ui with all package functionality.

Alternatively you can use WithVoiceRecorder Component like that:

<WithVoiceRecorder deep={yourDeepInstance} containerLinkId={yourContainerLinkId}>
    <VoiceRecorder />
</WithVoiceRecorder>
  1. Custom hooks can be used anywhere in your deep app:

useContainer hook to get existing or create a new container link ID.

const containerLinkId = useContainer(deep);

useRecordingStatus hook to get audio recording status every second (by default).

const audioRecordingStatus = useRecordingStatus({intervalInMs?}); 

useRecordingCycle hook to fire the recording cycle. Recording cycle records audiochunks of a given duration and uploads them as a links structure inside deep database.

const sounds = useRecordingCycle({ deep, recording, containerLinkId, duration: 5000 }); 

Contribution

Feel free to contribute. Please fork the repository and submit a pull request for any bugs, improvements, or features.