Socket
Socket
Sign inDemoInstall

capacitor-sound-effect

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 3.0.0

10

package.json
{
"name": "capacitor-sound-effect",
"version": "2.0.1",
"version": "3.0.0",
"description": "Native sound effects",

@@ -47,6 +47,6 @@ "main": "dist/plugin.cjs.js",

"devDependencies": {
"@capacitor/android": "^3.0.0",
"@capacitor/core": "^3.0.0",
"@capacitor/android": "^4.0.0",
"@capacitor/core": "^4.0.0",
"@capacitor/docgen": "^0.0.10",
"@capacitor/ios": "^3.0.0",
"@capacitor/ios": "^4.0.0",
"@ionic/eslint-config": "^0.3.0",

@@ -64,3 +64,3 @@ "@ionic/prettier-config": "^1.0.1",

"peerDependencies": {
"@capacitor/core": "^3.0.0"
"@capacitor/core": "^4.0.0"
},

@@ -67,0 +67,0 @@ "prettier": "@ionic/prettier-config",

# capacitor-sound-effect
Native sound effects
This plugin provides the ability to natively play sound effects in Capacitor based projects.
## Install
### General
```bash

@@ -12,2 +13,8 @@ npm install capacitor-sound-effect

### Ionic
```bash
npm install capacitor-sound-effect
ionic cap sync
```
## API

@@ -55,1 +62,32 @@

</docgen-api>
## Usage Example
This example is based on an Ionic (Vue) project, but is generally applicable to other scenarios
#### Import the plugin
```javascript
import { SoundEffect } from 'capacitor-sound-effect';
```
#### Load the sounds
In Ionic, the path is relative to your 'public' directory. So for a file located in /public/assets/sounds/, the below is applicable:
```javascript
loadSounds() {
SoundEffect.loadSound({id:'message', path:'assets/sounds/message.mp3'});
SoundEffect.loadSound({id:'status', path:'assets/sounds/status.mp3'});
}
```
You must pass an object, as illustrated above, to the loadSound() method. The 'id' must be unique as it is used to reference the sound when you come to playing.
#### Play a sound
When playing a sound, you must reference the 'id' you provided during loadSound().
```javascript
SoundEffect.play({id:'message'});
```
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc