Skip to content

Commit 18624b1

Browse files
update readme and package json description
1 parent 9d13dd1 commit 18624b1

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# iOS Silent Bypass
22

3-
iOS Silent Bypass is a library that allows you to play audio context even if the user has the Silent switch on.
3+
iOS Silent Bypass is a library that allows you to play audio context even if the user has the [action button/silent switch on](https://support.apple.com/guide/iphone/silence-iphone-iph81c7fd7d1/ios).
44
You'll need to wait for an user interaction to check if the audio context is allowed.
55

66
## Usage
@@ -10,15 +10,23 @@ npm install @activetheory/ios-silent-bypass
1010
```
1111

1212
```js
13-
import SilentHack from '@activetheory/ios-silent-bypass';
13+
import SilentBypass from '@activetheory/ios-silent-bypass';
1414

15-
const silentHack = new SilentHack();
15+
function isIOS() {
16+
return navigator.userAgent.includes('iPhone') || navigator.userAgent.includes('iPad');
17+
}
18+
19+
let silentBypass;
20+
21+
if (isIOS()) {
22+
silentBypass = new SilentBypass();
23+
}
1624

1725
// after the library is initialized, you can check if the audio context is allowed
18-
console.log(silentHack.allowed);
26+
console.log(silentBypass?.allowed);
1927

2028
// if you want to remove the event listeners after the audio context is allowed, you can call the destroy method
21-
silentHack.destroy();
29+
silentBypass?.destroy();
2230
```
2331
2432
## License

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@activetheory/ios-silent-bypass",
33
"version": "1.0.0",
4-
"description": "Simple hack to allow web audio even if physical mute switch is on iPhone/iPads",
4+
"description": "Simple hack to allow web audio even if physical mute switch is on iPhone/iPad",
55
"main": "./src/index.js",
66
"publishConfig": {
77
"access": "public"
@@ -31,7 +31,7 @@
3131
"license": "MIT",
3232
"repository": {
3333
"type": "git",
34-
"url": "git+https://github.com/activetheory/ios-silent-hack.git"
34+
"url": "git+https://github.com/activetheory/ios-silent-bypass.git"
3535
},
3636
"prettier": {
3737
"arrowParens": "always",

0 commit comments

Comments
 (0)