Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

capacitor-voice-recorder

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capacitor-voice-recorder - npm Package Compare versions

Comparing version 0.1.4 to 1.0.0

android/src/main/java/com/tchvu3/capacitorvoicerecorder/CustomMediaRecorder.java

5

dist/esm/definitions.d.ts

@@ -1,6 +0,1 @@

declare module '@capacitor/core' {
interface PluginRegistry {
VoiceRecorder: VoiceRecorderPlugin;
}
}
export declare type Base64String = string;

@@ -7,0 +2,0 @@ export interface RecordingData {

1

dist/esm/definitions.js

@@ -0,1 +1,2 @@

export {};
//# sourceMappingURL=definitions.js.map

@@ -0,2 +1,4 @@

import type { VoiceRecorderPlugin } from './definitions';
declare const VoiceRecorder: VoiceRecorderPlugin;
export * from './definitions';
export * from './web';
export { VoiceRecorder };

@@ -1,2 +0,7 @@

export * from './web';
import { registerPlugin } from '@capacitor/core';
const VoiceRecorder = registerPlugin('VoiceRecorder', {
web: () => import('./web').then(m => new m.VoiceRecorderWeb()),
});
export * from './definitions';
export { VoiceRecorder };
//# sourceMappingURL=index.js.map
import { WebPlugin } from '@capacitor/core';
import { GenericResponse, RecordingData, VoiceRecorderPlugin } from './definitions';
import type { GenericResponse, RecordingData, VoiceRecorderPlugin } from './definitions';
export declare class VoiceRecorderWeb extends WebPlugin implements VoiceRecorderPlugin {
constructor();
canDeviceVoiceRecord(): Promise<GenericResponse>;

@@ -11,3 +10,1 @@ hasAudioRecordingPermission(): Promise<GenericResponse>;

}
declare const VoiceRecorder: VoiceRecorderWeb;
export { VoiceRecorder };

@@ -1,9 +0,3 @@

import { registerWebPlugin, WebPlugin } from '@capacitor/core';
import { WebPlugin } from '@capacitor/core';
export class VoiceRecorderWeb extends WebPlugin {
constructor() {
super({
name: 'VoiceRecorder',
platforms: ['web'],
});
}
canDeviceVoiceRecord() {

@@ -25,5 +19,2 @@ return Promise.reject(new Error('VoiceRecorder does not have web implementation'));

}
const VoiceRecorder = new VoiceRecorderWeb();
export { VoiceRecorder };
registerWebPlugin(VoiceRecorder);
//# sourceMappingURL=web.js.map
{
"name": "capacitor-voice-recorder",
"version": "0.1.4",
"version": "1.0.0",
"description": "Capacitor plugin for voice recording",
"main": "dist/esm/index.js",
"main": "dist/plugin.cjs.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"scripts": {
"build": "npm run clean && tsc",
"clean": "rm -rf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
"publish": "npm publish"
"unpkg": "dist/plugin.js",
"files": [
"android/src/main/",
"android/build.gradle",
"dist/",
"ios/Plugin/",
"CapacitorVoiceRecorder.podspec"
],
"author": {
"name": "Avihu Harush",
"email": "tchvu3@gmail.com"
},
"author": "Avihu Harush",
"license": "MIT",
"dependencies": {
"@capacitor/core": "latest"
"repository": {
"type": "git",
"url": "https://github.com/tchvu3/capacitor-voice-recorder.git"
},
"devDependencies": {
"typescript": "^3.2.4",
"@capacitor/ios": "latest",
"@capacitor/android": "latest"
"bugs": {
"url": "https://github.com/tchvu3/capacitor-voice-recorder/issues"
},
"files": [
"dist/",
"ios/",
"android/",
"CapacitorVoiceRecorder.podspec"
],
"keywords": [

@@ -41,2 +39,42 @@ "capacitor",

],
"scripts": {
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
"verify:android": "cd android && ./gradlew clean build test && cd ..",
"verify:web": "npm run build",
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- autocorrect --format",
"eslint": "eslint . --ext ts",
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"swiftlint": "node-swiftlint",
"docgen": "docgen --api VoiceRecorderPlugin --output-readme README.md --output-json dist/docs.json",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build"
},
"devDependencies": {
"@capacitor/android": "^3.0.0",
"@capacitor/core": "^3.0.0",
"@capacitor/docgen": "^0.0.10",
"@capacitor/ios": "^3.0.0",
"@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^1.0.1",
"@ionic/swiftlint-config": "^1.1.2",
"eslint": "^7.11.0",
"prettier": "~2.2.0",
"prettier-plugin-java": "~1.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.32.0",
"swiftlint": "^1.0.1",
"typescript": "~4.0.3"
},
"peerDependencies": {
"@capacitor/core": "^3.0.0"
},
"prettier": "@ionic/prettier-config",
"swiftlint": "@ionic/swiftlint-config",
"eslintConfig": {
"extends": "@ionic/eslint-config/recommended"
},
"capacitor": {

@@ -49,10 +87,3 @@ "ios": {

}
},
"repository": {
"type": "git",
"url": "https://github.com/tchvu3/capacitor-voice-recorder"
},
"bugs": {
"url": "https://github.com/tchvu3/capacitor-voice-recorder/issues"
}
}

@@ -20,3 +20,2 @@ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p>

## Maintainers

@@ -28,3 +27,2 @@

## Installation

@@ -38,19 +36,6 @@

#### ios note
Make sure to include the ```NSMicrophoneUsageDescription```
key, and a corresponding purpose string in your app's Info.plist
#### android note
Make sure to add the plugin to your MainActivity.java like so:
```
import com.tchvu3.capvoicerecorder.VoiceRecorder;
...
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
add(VoiceRecorder.class); // Add this line
}});
}
```
## Configuration

@@ -60,41 +45,38 @@

## Supported methods
| Name | Android | iOS | Web |
| :------------------------------ | :------ | :-- | :-- |
| canDeviceVoiceRecord | ✅ | ✅ | ❌ |
| requestAudioRecordingPermission | ✅ | ✅ | ❌ |
| hasAudioRecordingPermission | ✅ | ✅ | ❌ |
| startRecording | ✅ | ✅ | ❌ |
| stopRecording | ✅ | ✅ | ❌ |
| Name | Android | iOS | Web |
| :------------------------------ | :------ | :-- | :-- |
| canDeviceVoiceRecord | ✅ | ✅ | ❌ | |
requestAudioRecordingPermission | ✅ | ✅ | ❌ |
| hasAudioRecordingPermission | ✅ | ✅ | ❌ |
| startRecording | ✅ | ✅ | ❌ |
| stopRecording | ✅ | ✅ | ❌ |
## Explanation
* canDeviceVoiceRecord - return promise that resolves to {"value": true} / {"value": false}
based on the phone's ability to record voice.
* canDeviceVoiceRecord - return promise that resolves to {"value": true} / {"value": false} based on the phone's ability to record voice.
---
* requestAudioRecordingPermission - if the permission has already been provided
then the promise will resolve with {"value": true}, otherwise the promise will resolve
to {"value": true} / {"value": false} based on the answer of the user to the request.
* requestAudioRecordingPermission - if the permission has already been provided then the promise will resolve with {"value": true},
otherwise the promise will resolve to {"value": true} / {"value": false} based on the answer of the user to the request.
---
* hasAudioRecordingPermission - will resolve to {"value": true} / {"value": false} based on the
status of the permission.
* hasAudioRecordingPermission - will resolve to {"value": true} / {"value": false} based on the status of the permission.
---
* startRecording - if the app lacks the required permission then
the promise will reject with the message "MISSING_PERMISSION".
if the phone is unable to record then the promise will reject
with the message "CANNOT_VOICE_RECORD_ON_THIS_PHONE".
if there's a recording already running then the promise will reject with "ALREADY_RECORDING",
and if other apps are using the microphone then the promise will reject with "MICROPHONE_BEING_USED".
in a case of unknown error the promise will reject with "FAILED_TO_RECORD".
* startRecording - if the app lacks the required permission then the promise will reject with the message "MISSING_PERMISSION". if the phone
is unable to record then the promise will reject with the message "CANNOT_VOICE_RECORD_ON_THIS_PHONE". if there's a recording already
running then the promise will reject with "ALREADY_RECORDING", and if other apps are using the microphone then the promise will reject
with "MICROPHONE_BEING_USED". in a case of unknown error the promise will reject with "FAILED_TO_RECORD".
---
* stopRecording - will stop the recording that has been previously started.
if the function startRecording() has not been called beforehand
the promise will reject with: "RECORDING_HAS_NOT_STARTED".
in case of success, you will get the recording in base-64,
the duration of the recording in milliseconds, and the mime type.
* stopRecording - will stop the recording that has been previously started. if the function startRecording() has not been called beforehand
the promise will reject with: "RECORDING_HAS_NOT_STARTED". in case of success, you will get the recording in base-64, the duration of the
recording in milliseconds, and the mime type.
## Usage

@@ -104,9 +86,5 @@

import { Plugins } from "@capacitor/core"
// only 'VoiceRecorder' is mandatory, the rest is for typing
import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse } from 'capacitor-voice-recorder';
// not mandatory, only for code completion
import { RecordingData, GenericResponse } from 'capacitor-voice-recorder'
const { VoiceRecorder } = Plugins
// will print true / false based on the device ability to record

@@ -148,4 +126,3 @@ VoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) => console.log(result.value))

To play the recorded file you can use plain
javascript:
To play the recorded file you can use plain javascript:

@@ -152,0 +129,0 @@ ```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc