{"_id":"@bazuka5801/capacitor-voice-recorder","_rev":"2-78ceb774f1b3e47309a13db7d3ffb27c","name":"@bazuka5801/capacitor-voice-recorder","dist-tags":{"latest":"5.0.3"},"versions":{"5.0.1":{"name":"@bazuka5801/capacitor-voice-recorder","version":"5.0.1","description":"Capacitor plugin for voice recording","main":"dist/plugin.cjs.js","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","author":{"name":"Avihu Harush","email":"tchvu3@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/tchvu3/capacitor-voice-recorder.git"},"bugs":{"url":"https://github.com/tchvu3/capacitor-voice-recorder/issues"},"keywords":["capacitor","plugin","native","voice","audio","record","recorder","ios","android"],"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 -destination generic/platform=iOS && 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 -- --fix --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.mjs","clean":"rimraf ./dist","watch":"tsc --watch","prepublishOnly":"npm run build"},"dependencies":{"get-blob-duration":"^1.2.0"},"devDependencies":{"@capacitor/android":"^5.0.3","@capacitor/core":"^5.0.3","@capacitor/docgen":"^0.2.1","@capacitor/ios":"^5.0.3","@ionic/eslint-config":"^0.3.0","@ionic/prettier-config":"^3.0.0","@ionic/swiftlint-config":"^1.1.2","@typescript-eslint/eslint-plugin":"^5.59.5","eslint":"^8.40.0","prettier":"~2.8.8","prettier-plugin-java":"~2.1.0","rimraf":"^5.0.0","rollup":"^3.21.7","swiftlint":"^1.0.2","typescript":"<4.5.0"},"peerDependencies":{"@capacitor/core":"^5.0.0"},"prettier":"@ionic/prettier-config","swiftlint":"@ionic/swiftlint-config","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"gitHead":"70ee739fe78523593bc512fb015d8d3007651618","homepage":"https://github.com/tchvu3/capacitor-voice-recorder#readme","_id":"@bazuka5801/capacitor-voice-recorder@5.0.1","_nodeVersion":"18.14.2","_npmVersion":"9.5.0","dist":{"integrity":"sha512-YSmyiniJdbaBxAmAIkmFkR9xQu97o49EgLDA6y9qtx3fSGRu9XNbRz31M/vVdIDDr+7zbAheCEQt0qnr2gj16A==","shasum":"79b07801c6846207f185b1ef310162da5b392db5","tarball":"https://registry.npmjs.org/@bazuka5801/capacitor-voice-recorder/-/capacitor-voice-recorder-5.0.1.tgz","fileCount":42,"unpackedSize":134405,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGQpRtLR5OpH2lkZGzkWWAyCxcgSXqhDKAEdEg1+pvV/AiEA4OzBOe8Gq+euf5Gi19SsYDDbhwFSJkymfMdG912Shyc="}]},"_npmUser":{"name":"bazuka5801","email":"bazuka5801@mail.ru"},"directories":{},"maintainers":[{"name":"bazuka5801","email":"bazuka5801@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/capacitor-voice-recorder_5.0.1_1700620766300_0.07892549973577556"},"_hasShrinkwrap":false},"5.0.2":{"name":"@bazuka5801/capacitor-voice-recorder","version":"5.0.2","description":"Capacitor plugin for voice recording","main":"dist/plugin.cjs.js","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","author":{"name":"Avihu Harush","email":"tchvu3@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/tchvu3/capacitor-voice-recorder.git"},"bugs":{"url":"https://github.com/tchvu3/capacitor-voice-recorder/issues"},"keywords":["capacitor","plugin","native","voice","audio","record","recorder","ios","android"],"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 -destination generic/platform=iOS && 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 -- --fix --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.mjs","clean":"rimraf ./dist","watch":"tsc --watch","prepublishOnly":"npm run build"},"dependencies":{"get-blob-duration":"^1.2.0"},"devDependencies":{"@capacitor/android":"^5.0.3","@capacitor/core":"^5.0.3","@capacitor/docgen":"^0.2.1","@capacitor/ios":"^5.0.3","@ionic/eslint-config":"^0.3.0","@ionic/prettier-config":"^3.0.0","@ionic/swiftlint-config":"^1.1.2","@typescript-eslint/eslint-plugin":"^5.59.5","eslint":"^8.40.0","prettier":"~2.8.8","prettier-plugin-java":"~2.1.0","rimraf":"^5.0.0","rollup":"^3.21.7","swiftlint":"^1.0.2","typescript":"<4.5.0"},"peerDependencies":{"@capacitor/core":"^5.0.0"},"prettier":"@ionic/prettier-config","swiftlint":"@ionic/swiftlint-config","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"gitHead":"70ee739fe78523593bc512fb015d8d3007651618","homepage":"https://github.com/tchvu3/capacitor-voice-recorder#readme","_id":"@bazuka5801/capacitor-voice-recorder@5.0.2","_nodeVersion":"18.14.2","_npmVersion":"9.5.0","dist":{"integrity":"sha512-nrUEysOHAita8XjNP3CvisFTgcPcyO+dkbUVAqGgI80wvH27qYeutHklshPsDi6wvUM0cCd7ODruTjLsz6pinA==","shasum":"c9a77a6ba4d5d8fd91ece2def56264a077969418","tarball":"https://registry.npmjs.org/@bazuka5801/capacitor-voice-recorder/-/capacitor-voice-recorder-5.0.2.tgz","fileCount":42,"unpackedSize":137162,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA3MTMoeKr/BaHD07cVcRP5ad+KMk8XIoZQAuPvZY97AAiAYyEKra5tR2N/sN/MXTZWFbB00V6odfuLXWbIxa3rudA=="}]},"_npmUser":{"name":"bazuka5801","email":"bazuka5801@mail.ru"},"directories":{},"maintainers":[{"name":"bazuka5801","email":"bazuka5801@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/capacitor-voice-recorder_5.0.2_1700620963975_0.11534700659886843"},"_hasShrinkwrap":false},"5.0.3":{"name":"@bazuka5801/capacitor-voice-recorder","version":"5.0.3","description":"Capacitor plugin for voice recording","main":"dist/plugin.cjs.js","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","author":{"name":"Avihu Harush","email":"tchvu3@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/tchvu3/capacitor-voice-recorder.git"},"bugs":{"url":"https://github.com/tchvu3/capacitor-voice-recorder/issues"},"keywords":["capacitor","plugin","native","voice","audio","record","recorder","ios","android"],"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 -destination generic/platform=iOS && 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 -- --fix --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.mjs","clean":"rimraf ./dist","watch":"tsc --watch","prepublishOnly":"npm run build"},"dependencies":{"get-blob-duration":"^1.2.0"},"devDependencies":{"@capacitor/android":"^5.0.3","@capacitor/core":"^5.0.3","@capacitor/docgen":"^0.2.1","@capacitor/ios":"^5.0.3","@ionic/eslint-config":"^0.3.0","@ionic/prettier-config":"^3.0.0","@ionic/swiftlint-config":"^1.1.2","@typescript-eslint/eslint-plugin":"^5.59.5","eslint":"^8.40.0","prettier":"~2.8.8","prettier-plugin-java":"~2.1.0","rimraf":"^5.0.0","rollup":"^3.21.7","swiftlint":"^1.0.2","typescript":"<4.5.0"},"peerDependencies":{"@capacitor/core":"^5.0.0"},"prettier":"@ionic/prettier-config","swiftlint":"@ionic/swiftlint-config","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"gitHead":"b1fed87a311c38bc78b1a572412b7ee6ebdbee09","homepage":"https://github.com/tchvu3/capacitor-voice-recorder#readme","_id":"@bazuka5801/capacitor-voice-recorder@5.0.3","_nodeVersion":"18.14.2","_npmVersion":"9.5.0","dist":{"integrity":"sha512-63lshd3qDfy+N3TQJfuCpsvpKKmvoGIxs24OXhqHgdszeoJvXxryzm5+QRAwNY2b4CV09DFLpe+NMLvXV/MK8A==","shasum":"231edea986a665d06d7369128413f48edc37a15d","tarball":"https://registry.npmjs.org/@bazuka5801/capacitor-voice-recorder/-/capacitor-voice-recorder-5.0.3.tgz","fileCount":42,"unpackedSize":136630,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCmkyv2VT7ITNar9tej4c09HCc/JwRo7SuJ6a6r0tpjXQIhAImI6dJ95R9wyGMKKy6ETL0ULLc/9RbYHH/fKOM8qWxz"}]},"_npmUser":{"name":"bazuka5801","email":"bazuka5801@mail.ru"},"directories":{},"maintainers":[{"name":"bazuka5801","email":"bazuka5801@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/capacitor-voice-recorder_5.0.3_1700733690491_0.7795523755163436"},"_hasShrinkwrap":false}},"time":{"created":"2023-11-22T02:39:26.189Z","5.0.1":"2023-11-22T02:39:26.511Z","modified":"2023-11-23T10:01:30.964Z","5.0.2":"2023-11-22T02:42:44.129Z","5.0.3":"2023-11-23T10:01:30.737Z"},"maintainers":[{"name":"bazuka5801","email":"bazuka5801@mail.ru"}],"description":"Capacitor plugin for voice recording","homepage":"https://github.com/tchvu3/capacitor-voice-recorder#readme","keywords":["capacitor","plugin","native","voice","audio","record","recorder","ios","android"],"repository":{"type":"git","url":"git+https://github.com/tchvu3/capacitor-voice-recorder.git"},"author":{"name":"Avihu Harush","email":"tchvu3@gmail.com"},"bugs":{"url":"https://github.com/tchvu3/capacitor-voice-recorder/issues"},"license":"MIT","readme":"<p align=\"center\">\n  <img src=\"https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png\" width=\"128\" height=\"128\" />\n</p>\n<h3 align=\"center\">Capacitor Voice Recorder</h3>\n<p align=\"center\"><strong><code>tchvu3/capacitor-voice-recorder</code></strong></p>\n<p align=\"center\">Capacitor plugin for simple voice recording (For Capacitor 5)</p>\n\n<p align=\"center\">\n  <img src=\"https://img.shields.io/maintenance/yes/2023\" />\n  <a href=\"https://www.npmjs.com/package/capacitor-voice-recorder\"><img src=\"https://img.shields.io/npm/l/capacitor-voice-recorder\" /></a>\n<br>\n  <a href=\"https://www.npmjs.com/package/capacitor-voice-recorder\"><img src=\"https://img.shields.io/npm/dw/capacitor-voice-recorder\" /></a>\n  <a href=\"https://www.npmjs.com/package/capacitor-voice-recorder\"><img src=\"https://img.shields.io/npm/v/capacitor-voice-recorder\" /></a>\n</p>\n\n## Maintainers\n\n| Maintainer | GitHub |\n| -----------| -------|\n| Avihu Harush | [tchvu3](https://github.com/tchvu3) |\n\n## Installation\n\n```\nnpm install --save capacitor-voice-recorder\nnpx cap sync\n```\n\n#### ios note\n\nMake sure to include the ```NSMicrophoneUsageDescription```\nkey, and a corresponding purpose string in your app's Info.plist\n\n## Configuration\n\nNo configuration required for this plugin.\n\n## Supported methods\n\n| Name | Android | iOS | Web |\n| :------------------------------ | :------ | :-- | :-- |\n| canDeviceVoiceRecord | ✅ | ✅ | ✅ |\nrequestAudioRecordingPermission | ✅ | ✅ | ✅ |\n| hasAudioRecordingPermission | ✅ | ✅ | ✅ |\n| startRecording | ✅ | ✅ | ✅ |\n| stopRecording | ✅ | ✅ | ✅ |\n| pauseRecording | ✅ | ✅ | ✅ |\n| resumeRecording | ✅ | ✅ | ✅ |\n| getCurrentStatus | ✅ | ✅ | ✅ |\n\n## Explanation\n\n* canDeviceVoiceRecord - on mobile this function will always return a promise that resolves to `{ value: true }`,\n  while in a browser it will be resolved to `{ value: true }` / `{ value: false }` based on the browser's ability to record.\n  note that this method does not take into account the permission status,\n  only if the browser itself is capable of recording at all.\n\n---\n\n* requestAudioRecordingPermission - if the permission has already been provided then the promise will resolve with `{ value: true }`,\n  otherwise the promise will resolve to `{ value: true }` / `{ value: false }` based on the answer of the user to the request.\n\n---\n\n* hasAudioRecordingPermission - will resolve to `{ value: true }` / `{ value: false }` based on the status of the permission.\n  please note that the web implementation of this plugin uses the Permissions API under the hood which is not widespread as of now.\n  as a result, if the status of the permission cannot be checked the promise will reject with `COULD_NOT_QUERY_PERMISSION_STATUS`.\n  in that case you have no choice but to use the `requestAudioRecordingPermission` function straight away or `startRecording` and capture any exception that is thrown.\n\n---\n\n* startRecording - if the app lacks the required permission then the promise will reject with the message `MISSING_PERMISSION`.\n  if the current device cannot voice record at all (for example, due to old browser) then the promise will reject with `DEVICE_CANNOT_VOICE_RECORD`.\n  if there's a recording already running then the promise will reject with `ALREADY_RECORDING`,\n  and if other apps are using the microphone then the promise will reject\n  with `MICROPHONE_BEING_USED`. in a case of unknown error the promise will reject with `FAILED_TO_RECORD`.\n\n---\n\n* stopRecording - will stop the recording that has been previously started. if the function `startRecording` has not been called beforehand\n  the promise will reject with `RECORDING_HAS_NOT_STARTED`.\n  if the recording has been stopped immediately after it has been started the promise will reject with `EMPTY_RECORDING`.\n  in a case of unknown error the promise will reject with `FAILED_TO_FETCH_RECORDING`.\n  in case of success, you will get the recording in base-64, the duration of the\n  recording in milliseconds, and the mime type.\n\n---\n\n* pauseRecording - will pause an ongoing recording. note that if the recording has not started yet the promise\n  will reject with `RECORDING_HAS_NOT_STARTED`. in case of success the promise will resolve to `{ value: true }` if the pause\n  was successful or `{ value: false }` if the recording is already paused.\n  note that on certain mobile os versions this function is not supported.\n  in these cases the function will reject with `NOT_SUPPORTED_OS_VERSION` and your only viable options is to stop the recording instead.\n\n---\n\n* resumeRecording - will resume a paused recording. note that if the recording has not started yet the promise\n  will reject with `RECORDING_HAS_NOT_STARTED`. in case of success the promise will resolve to `{ value: true }` if the resume\n  was successful or `{ value: false }` if the recording is already running.\n  note that on certain mobile os versions this function is not supported.\n  in these cases the function will reject with `NOT_SUPPORTED_OS_VERSION` and your only viable options is to stop the recording instead\n\n---\n\n* getCurrentStatus - will let you know the current status of the current recording (if there is any at all).\n  will resolve with one of the following values: `{ status: \"NONE\" }` if the plugin is idle and waiting to start a new recording.\n  `{ status: \"RECORDING\" }` if the plugin is in the middle of recording and `{ status: \"PAUSED\" }` if the recording is paused right now.\n\n## Usage\n\n```\n\n// only 'VoiceRecorder' is mandatory, the rest is for typing\nimport { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder';\n\n// will print true / false based on the ability of the current device (or web browser) to record audio\nVoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) => console.log(result.value))\n\n/**\n* will prompt the user to give the required permission, after that\n* the function will print true / false based on the user response\n*/\nVoiceRecorder.requestAudioRecordingPermission().then((result: GenericResponse) => console.log(result.value))\n\n/**\n* will print true / false based on the status of the recording permission.\n* the promise will reject with \"COULD_NOT_QUERY_PERMISSION_STATUS\"\n* if the current device cannot query the current status of the recording permission\n*/\nVoiceRecorder.hasAudioRecordingPermission.then((result: GenericResponse) => console.log(result.value))\n\n/**\n* In case of success the promise will resolve to { value: true }\n* in case of an error the promise will reject with one of the following messages:\n* \"MISSING_PERMISSION\", \"ALREADY_RECORDING\", \"MICROPHONE_BEING_USED\", \"DEVICE_CANNOT_VOICE_RECORD\", or \"FAILED_TO_RECORD\"\n*/\nVoiceRecorder.startRecording()\n.then((result: GenericResponse) => console.log(result.value))\n.catch(error => console.log(error))\n\n/**\n* In case of success the promise will resolve to:\n* {\"value\": { recordDataBase64: string, msDuration: number, mimeType: string }},\n* the file will be in one of several possible formats (more on that later).\n* in case of an error the promise will reject with one of the following messages:\n* \"RECORDING_HAS_NOT_STARTED\" or \"FAILED_TO_FETCH_RECORDING\"\n*/\nVoiceRecorder.stopRecording()\n.then((result: RecordingData) => console.log(result.value))\n.catch(error => console.log(error))\n\n/**\n* will pause an ongoing recording. note that if the recording has not started yet the promise\n* will reject with `RECORDING_HAS_NOT_STARTED`. in case of success the promise will resolve to `{ value: true }` if the pause\n* was successful or `{ value: false }` if the recording is already paused.\n* if the current mobile os does not support this method the promise will reject with `NOT_SUPPORTED_OS_VERSION`\n*/\nVoiceRecorder.pauseRecording()\n.then((result: GenericResponse) => console.log(result.value))\n.catch(error => console.log(error))\n\n/**\n* will resume a paused recording. note that if the recording has not started yet the promise\n* will reject with `RECORDING_HAS_NOT_STARTED`. in case of success the promise will resolve to `{ value: true }` if the resume\n* was successful or `{ value: false }` if the recording is already running.\n* if the current mobile os does not support this method the promise will reject with `NOT_SUPPORTED_OS_VERSION`\n*/\nVoiceRecorder.resumeRecording()\n.then((result: GenericResponse) => console.log(result.value))\n.catch(error => console.log(error))\n\n/**\n* Will return the current status of the plugin.\n* in this example one of these possible values will be printed: \"NONE\" / \"RECORDING\" / \"PAUSED\"\n*/\nVoiceRecorder.getCurrentStatus()\n.then((result: CurrentRecordingStatus) => console.log(result.status))\n.catch(error => console.log(error))\n\n```\n\n## Format and Mime type\n\nThe plugin will return the recording in one of several possible formats.\nthe format is dependent on the os / web browser that the user uses.\non android and ios the mime type will be `audio/aac`, while on chrome and firefox it\nwill be `audio/webm;codecs=opus` and on safari it will be `audio/mp4`.\nnote that these 3 browsers has been tested on. the plugin should still work on\nother browsers, as there is a list of mime types that the plugin checks against the\nuser's browser.\n\nNote that this fact might cause unexpected behavior in case you'll try to play recordings\nbetween several devices or browsers - as they not all support the same set of audio formats.\nit is recommended to convert the recordings to a format that all your target devices supports.\nas this plugin focuses on the recording aspect, it does not provide any conversion between formats.\n\n## Playback\n\nTo play the recorded file you can use plain javascript:\n\n```\nconst base64Sound = '...' // from plugin\nconst mimeType = '...'  // from plugin\nconst audioRef = new Audio(`data:${mimeType};base64,${base64Sound}`)\naudioRef.oncanplaythrough = () => audioRef.play()\naudioRef.load()\n```\n\n## Donation\n\nIf you enjoy my work and find it useful, feel free to invite me to a cup of coffee :)\n\n[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/tchvu3)\n","readmeFilename":"README.md"}