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 4.0.0 to 4.0.1

1

dist/esm/predefined-web-responses.d.ts

@@ -9,4 +9,5 @@ import type { GenericResponse } from './definitions';

export declare const failedToRecordError: () => Error;
export declare const emptyRecordingError: () => Error;
export declare const recordingHasNotStartedError: () => Error;
export declare const failedToFetchRecordingError: () => Error;
export declare const couldNotQueryPermissionStatusError: () => Error;

@@ -8,2 +8,3 @@ export const successResponse = () => ({ value: true });

export const failedToRecordError = () => new Error('FAILED_TO_RECORD');
export const emptyRecordingError = () => new Error('EMPTY_RECORDING');
export const recordingHasNotStartedError = () => new Error('RECORDING_HAS_NOT_STARTED');

@@ -10,0 +11,0 @@ export const failedToFetchRecordingError = () => new Error('FAILED_TO_FETCH_RECORDING');

26

dist/esm/VoiceRecorderImpl.js
import getBlobDuration from 'get-blob-duration';
import { alreadyRecordingError, couldNotQueryPermissionStatusError, deviceCannotVoiceRecordError, failedToFetchRecordingError, failedToRecordError, failureResponse, missingPermissionError, recordingHasNotStartedError, successResponse, } from './predefined-web-responses';
import { alreadyRecordingError, couldNotQueryPermissionStatusError, deviceCannotVoiceRecordError, emptyRecordingError, failedToFetchRecordingError, failedToRecordError, failureResponse, missingPermissionError, recordingHasNotStartedError, successResponse, } from './predefined-web-responses';
// these mime types will be checked one by one in order until one of them is found to be supported by the current browser

@@ -57,3 +57,5 @@ const possibleMimeTypes = ['audio/aac', 'audio/webm;codecs=opus', 'audio/mp4', 'audio/webm', 'audio/ogg;codecs=opus'];

.then(result => ({ value: result.state === 'granted' }))
.catch(() => { throw couldNotQueryPermissionStatusError(); });
.catch(() => {
throw couldNotQueryPermissionStatusError();
});
}

@@ -117,4 +119,4 @@ static async requestAudioRecordingPermission() {

this.mediaRecorder.onerror = () => {
this.prepareInstanceForNextOperation();
reject(failedToRecordError());
this.prepareInstanceForNextOperation();
};

@@ -124,11 +126,16 @@ this.mediaRecorder.onstop = async () => {

if (mimeType == null) {
this.prepareInstanceForNextOperation();
reject(failedToFetchRecordingError());
return;
}
else {
const blobVoiceRecording = new Blob(this.chunks, { 'type': mimeType });
const recordDataBase64 = await VoiceRecorderImpl.blobToBase64(blobVoiceRecording);
const recordingDuration = await getBlobDuration(blobVoiceRecording);
const blobVoiceRecording = new Blob(this.chunks, { 'type': mimeType });
if (blobVoiceRecording.size <= 0) {
this.prepareInstanceForNextOperation();
resolve({ value: { recordDataBase64, mimeType, msDuration: recordingDuration * 1000 } });
reject(emptyRecordingError());
return;
}
const recordDataBase64 = await VoiceRecorderImpl.blobToBase64(blobVoiceRecording);
const recordingDuration = await getBlobDuration(blobVoiceRecording);
this.prepareInstanceForNextOperation();
resolve({ value: { recordDataBase64, mimeType, msDuration: recordingDuration * 1000 } });
};

@@ -160,3 +167,4 @@ this.mediaRecorder.ondataavailable = (event) => this.chunks.push(event.data);

}
catch (ignore) { }
catch (ignore) {
}
}

@@ -163,0 +171,0 @@ this.pendingResult = neverResolvingPromise();

@@ -22,2 +22,3 @@ 'use strict';

const failedToRecordError = () => new Error('FAILED_TO_RECORD');
const emptyRecordingError = () => new Error('EMPTY_RECORDING');
const recordingHasNotStartedError = () => new Error('RECORDING_HAS_NOT_STARTED');

@@ -81,3 +82,5 @@ const failedToFetchRecordingError = () => new Error('FAILED_TO_FETCH_RECORDING');

.then(result => ({ value: result.state === 'granted' }))
.catch(() => { throw couldNotQueryPermissionStatusError(); });
.catch(() => {
throw couldNotQueryPermissionStatusError();
});
}

@@ -141,4 +144,4 @@ static async requestAudioRecordingPermission() {

this.mediaRecorder.onerror = () => {
this.prepareInstanceForNextOperation();
reject(failedToRecordError());
this.prepareInstanceForNextOperation();
};

@@ -148,11 +151,16 @@ this.mediaRecorder.onstop = async () => {

if (mimeType == null) {
this.prepareInstanceForNextOperation();
reject(failedToFetchRecordingError());
return;
}
else {
const blobVoiceRecording = new Blob(this.chunks, { 'type': mimeType });
const recordDataBase64 = await VoiceRecorderImpl.blobToBase64(blobVoiceRecording);
const recordingDuration = await getBlobDuration__default["default"](blobVoiceRecording);
const blobVoiceRecording = new Blob(this.chunks, { 'type': mimeType });
if (blobVoiceRecording.size <= 0) {
this.prepareInstanceForNextOperation();
resolve({ value: { recordDataBase64, mimeType, msDuration: recordingDuration * 1000 } });
reject(emptyRecordingError());
return;
}
const recordDataBase64 = await VoiceRecorderImpl.blobToBase64(blobVoiceRecording);
const recordingDuration = await getBlobDuration__default["default"](blobVoiceRecording);
this.prepareInstanceForNextOperation();
resolve({ value: { recordDataBase64, mimeType, msDuration: recordingDuration * 1000 } });
};

@@ -184,3 +192,4 @@ this.mediaRecorder.ondataavailable = (event) => this.chunks.push(event.data);

}
catch (ignore) { }
catch (ignore) {
}
}

@@ -187,0 +196,0 @@ this.pendingResult = neverResolvingPromise();

@@ -18,2 +18,3 @@ var capacitorVoiceRecorder = (function (exports, core, getBlobDuration) {

const failedToRecordError = () => new Error('FAILED_TO_RECORD');
const emptyRecordingError = () => new Error('EMPTY_RECORDING');
const recordingHasNotStartedError = () => new Error('RECORDING_HAS_NOT_STARTED');

@@ -77,3 +78,5 @@ const failedToFetchRecordingError = () => new Error('FAILED_TO_FETCH_RECORDING');

.then(result => ({ value: result.state === 'granted' }))
.catch(() => { throw couldNotQueryPermissionStatusError(); });
.catch(() => {
throw couldNotQueryPermissionStatusError();
});
}

@@ -137,4 +140,4 @@ static async requestAudioRecordingPermission() {

this.mediaRecorder.onerror = () => {
this.prepareInstanceForNextOperation();
reject(failedToRecordError());
this.prepareInstanceForNextOperation();
};

@@ -144,11 +147,16 @@ this.mediaRecorder.onstop = async () => {

if (mimeType == null) {
this.prepareInstanceForNextOperation();
reject(failedToFetchRecordingError());
return;
}
else {
const blobVoiceRecording = new Blob(this.chunks, { 'type': mimeType });
const recordDataBase64 = await VoiceRecorderImpl.blobToBase64(blobVoiceRecording);
const recordingDuration = await getBlobDuration__default["default"](blobVoiceRecording);
const blobVoiceRecording = new Blob(this.chunks, { 'type': mimeType });
if (blobVoiceRecording.size <= 0) {
this.prepareInstanceForNextOperation();
resolve({ value: { recordDataBase64, mimeType, msDuration: recordingDuration * 1000 } });
reject(emptyRecordingError());
return;
}
const recordDataBase64 = await VoiceRecorderImpl.blobToBase64(blobVoiceRecording);
const recordingDuration = await getBlobDuration__default["default"](blobVoiceRecording);
this.prepareInstanceForNextOperation();
resolve({ value: { recordDataBase64, mimeType, msDuration: recordingDuration * 1000 } });
};

@@ -180,3 +188,4 @@ this.mediaRecorder.ondataavailable = (event) => this.chunks.push(event.data);

}
catch (ignore) { }
catch (ignore) {
}
}

@@ -183,0 +192,0 @@ this.pendingResult = neverResolvingPromise();

{
"name": "capacitor-voice-recorder",
"version": "4.0.0",
"version": "4.0.1",
"description": "Capacitor plugin for voice recording",

@@ -5,0 +5,0 @@ "main": "dist/plugin.cjs.js",

@@ -82,2 +82,3 @@ <p align="center">

the promise will reject with `RECORDING_HAS_NOT_STARTED`.
if the recording has been stopped immediately after it has been started the promise will reject with `EMPTY_RECORDING`.
in a case of unknown error the promise will reject with `FAILED_TO_FETCH_RECORDING`.

@@ -84,0 +85,0 @@ in case of success, you will get the recording in base-64, the duration of the

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