@capawesome/capacitor-volume 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CapawesomeCapacitorVolume.podspec +17 -0
  2. package/LICENSE +21 -0
  3. package/Package.swift +28 -0
  4. package/README.md +405 -0
  5. package/android/build.gradle +58 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/Volume.java +158 -0
  8. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/VolumeHelper.java +27 -0
  9. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/VolumePlugin.java +178 -0
  10. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/CustomException.java +20 -0
  11. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/CustomExceptions.java +12 -0
  12. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/events/VolumeButtonPressedEvent.java +23 -0
  13. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/events/VolumeChangeEvent.java +22 -0
  14. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/options/GetVolumeOptions.java +23 -0
  15. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/options/SetVolumeOptions.java +41 -0
  16. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/options/StartWatchingOptions.java +17 -0
  17. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/results/GetVolumeResult.java +22 -0
  18. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/results/IsWatchingResult.java +22 -0
  19. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/interfaces/Callback.java +5 -0
  20. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/interfaces/EmptyCallback.java +5 -0
  21. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/interfaces/NonEmptyResultCallback.java +7 -0
  22. package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/interfaces/Result.java +7 -0
  23. package/android/src/main/res/.gitkeep +0 -0
  24. package/dist/docs.json +540 -0
  25. package/dist/esm/definitions.d.ts +255 -0
  26. package/dist/esm/definitions.js +60 -0
  27. package/dist/esm/definitions.js.map +1 -0
  28. package/dist/esm/index.d.ts +4 -0
  29. package/dist/esm/index.js +7 -0
  30. package/dist/esm/index.js.map +1 -0
  31. package/dist/esm/web.d.ts +9 -0
  32. package/dist/esm/web.js +19 -0
  33. package/dist/esm/web.js.map +1 -0
  34. package/dist/plugin.cjs.js +93 -0
  35. package/dist/plugin.cjs.js.map +1 -0
  36. package/dist/plugin.js +96 -0
  37. package/dist/plugin.js.map +1 -0
  38. package/ios/Plugin/Classes/Events/VolumeButtonPressedEvent.swift +16 -0
  39. package/ios/Plugin/Classes/Events/VolumeChangeEvent.swift +16 -0
  40. package/ios/Plugin/Classes/Options/SetVolumeOptions.swift +20 -0
  41. package/ios/Plugin/Classes/Options/StartWatchingOptions.swift +10 -0
  42. package/ios/Plugin/Classes/Results/GetVolumeResult.swift +16 -0
  43. package/ios/Plugin/Classes/Results/IsWatchingResult.swift +16 -0
  44. package/ios/Plugin/Enums/CustomError.swift +24 -0
  45. package/ios/Plugin/Info.plist +24 -0
  46. package/ios/Plugin/Protocols/Result.swift +5 -0
  47. package/ios/Plugin/Volume.swift +192 -0
  48. package/ios/Plugin/VolumePlugin.swift +109 -0
  49. package/package.json +91 -0
package/dist/docs.json ADDED
@@ -0,0 +1,540 @@
1
+ {
2
+ "api": {
3
+ "name": "VolumePlugin",
4
+ "slug": "volumeplugin",
5
+ "docs": "",
6
+ "tags": [],
7
+ "methods": [
8
+ {
9
+ "name": "getVolume",
10
+ "signature": "(options?: GetVolumeOptions | undefined) => Promise<GetVolumeResult>",
11
+ "parameters": [
12
+ {
13
+ "name": "options",
14
+ "docs": "",
15
+ "type": "GetVolumeOptions | undefined"
16
+ }
17
+ ],
18
+ "returns": "Promise<GetVolumeResult>",
19
+ "tags": [
20
+ {
21
+ "name": "since",
22
+ "text": "0.1.0"
23
+ }
24
+ ],
25
+ "docs": "Get the current volume level.\n\nOn iOS, this always returns the media volume.\n\nOnly available on Android and iOS.",
26
+ "complexTypes": [
27
+ "GetVolumeResult",
28
+ "GetVolumeOptions"
29
+ ],
30
+ "slug": "getvolume"
31
+ },
32
+ {
33
+ "name": "isWatching",
34
+ "signature": "() => Promise<IsWatchingResult>",
35
+ "parameters": [],
36
+ "returns": "Promise<IsWatchingResult>",
37
+ "tags": [
38
+ {
39
+ "name": "since",
40
+ "text": "0.1.0"
41
+ }
42
+ ],
43
+ "docs": "Check whether the hardware volume buttons are currently being watched.\n\nOnly available on Android and iOS.",
44
+ "complexTypes": [
45
+ "IsWatchingResult"
46
+ ],
47
+ "slug": "iswatching"
48
+ },
49
+ {
50
+ "name": "setVolume",
51
+ "signature": "(options: SetVolumeOptions) => Promise<void>",
52
+ "parameters": [
53
+ {
54
+ "name": "options",
55
+ "docs": "",
56
+ "type": "SetVolumeOptions"
57
+ }
58
+ ],
59
+ "returns": "Promise<void>",
60
+ "tags": [
61
+ {
62
+ "name": "since",
63
+ "text": "0.1.0"
64
+ }
65
+ ],
66
+ "docs": "Set the volume level.\n\nOn iOS, this always sets the media volume.\n\nOnly available on Android and iOS.",
67
+ "complexTypes": [
68
+ "SetVolumeOptions"
69
+ ],
70
+ "slug": "setvolume"
71
+ },
72
+ {
73
+ "name": "startWatching",
74
+ "signature": "(options?: StartWatchingOptions | undefined) => Promise<void>",
75
+ "parameters": [
76
+ {
77
+ "name": "options",
78
+ "docs": "",
79
+ "type": "StartWatchingOptions | undefined"
80
+ }
81
+ ],
82
+ "returns": "Promise<void>",
83
+ "tags": [
84
+ {
85
+ "name": "since",
86
+ "text": "0.1.0"
87
+ }
88
+ ],
89
+ "docs": "Start watching the hardware volume buttons.\n\nThe `volumeButtonPressed` and `volumeChange` events are only\nemitted while watching.\n\nIf the volume buttons are already being watched, this call has\nno effect. Call `stopWatching()` first to change the options.\n\nOnly available on Android and iOS.",
90
+ "complexTypes": [
91
+ "StartWatchingOptions"
92
+ ],
93
+ "slug": "startwatching"
94
+ },
95
+ {
96
+ "name": "stopWatching",
97
+ "signature": "() => Promise<void>",
98
+ "parameters": [],
99
+ "returns": "Promise<void>",
100
+ "tags": [
101
+ {
102
+ "name": "since",
103
+ "text": "0.1.0"
104
+ }
105
+ ],
106
+ "docs": "Stop watching the hardware volume buttons.\n\nOn iOS, this also restores the volume level that was set when\nwatching started if the `suppressVolumeChange` option was enabled.\n\nOnly available on Android and iOS.",
107
+ "complexTypes": [],
108
+ "slug": "stopwatching"
109
+ },
110
+ {
111
+ "name": "addListener",
112
+ "signature": "(eventName: 'volumeButtonPressed', listenerFunc: (event: VolumeButtonPressedEvent) => void) => Promise<PluginListenerHandle>",
113
+ "parameters": [
114
+ {
115
+ "name": "eventName",
116
+ "docs": "",
117
+ "type": "'volumeButtonPressed'"
118
+ },
119
+ {
120
+ "name": "listenerFunc",
121
+ "docs": "",
122
+ "type": "(event: VolumeButtonPressedEvent) => void"
123
+ }
124
+ ],
125
+ "returns": "Promise<PluginListenerHandle>",
126
+ "tags": [
127
+ {
128
+ "name": "since",
129
+ "text": "0.1.0"
130
+ }
131
+ ],
132
+ "docs": "Called when a hardware volume button is pressed while watching.\n\nOnly available on Android and iOS.",
133
+ "complexTypes": [
134
+ "PluginListenerHandle",
135
+ "VolumeButtonPressedEvent"
136
+ ],
137
+ "slug": "addlistenervolumebuttonpressed-"
138
+ },
139
+ {
140
+ "name": "addListener",
141
+ "signature": "(eventName: 'volumeChange', listenerFunc: (event: VolumeChangeEvent) => void) => Promise<PluginListenerHandle>",
142
+ "parameters": [
143
+ {
144
+ "name": "eventName",
145
+ "docs": "",
146
+ "type": "'volumeChange'"
147
+ },
148
+ {
149
+ "name": "listenerFunc",
150
+ "docs": "",
151
+ "type": "(event: VolumeChangeEvent) => void"
152
+ }
153
+ ],
154
+ "returns": "Promise<PluginListenerHandle>",
155
+ "tags": [
156
+ {
157
+ "name": "since",
158
+ "text": "0.1.0"
159
+ }
160
+ ],
161
+ "docs": "Called when the volume level changes while watching.\n\nOn Android, this is called for changes to the music stream.\nOn iOS, this is called for changes to the media volume and is\nnot called while the `suppressVolumeChange` option is enabled.\n\nOnly available on Android and iOS.",
162
+ "complexTypes": [
163
+ "PluginListenerHandle",
164
+ "VolumeChangeEvent"
165
+ ],
166
+ "slug": "addlistenervolumechange-"
167
+ },
168
+ {
169
+ "name": "removeAllListeners",
170
+ "signature": "() => Promise<void>",
171
+ "parameters": [],
172
+ "returns": "Promise<void>",
173
+ "tags": [
174
+ {
175
+ "name": "since",
176
+ "text": "0.1.0"
177
+ }
178
+ ],
179
+ "docs": "Remove all listeners for this plugin.",
180
+ "complexTypes": [],
181
+ "slug": "removealllisteners"
182
+ }
183
+ ],
184
+ "properties": []
185
+ },
186
+ "interfaces": [
187
+ {
188
+ "name": "GetVolumeResult",
189
+ "slug": "getvolumeresult",
190
+ "docs": "",
191
+ "tags": [
192
+ {
193
+ "text": "0.1.0",
194
+ "name": "since"
195
+ }
196
+ ],
197
+ "methods": [],
198
+ "properties": [
199
+ {
200
+ "name": "volume",
201
+ "tags": [
202
+ {
203
+ "text": "0.1.0",
204
+ "name": "since"
205
+ },
206
+ {
207
+ "text": "0.5",
208
+ "name": "example"
209
+ }
210
+ ],
211
+ "docs": "The current volume level as a value between `0` and `1`.",
212
+ "complexTypes": [],
213
+ "type": "number"
214
+ }
215
+ ]
216
+ },
217
+ {
218
+ "name": "GetVolumeOptions",
219
+ "slug": "getvolumeoptions",
220
+ "docs": "",
221
+ "tags": [
222
+ {
223
+ "text": "0.1.0",
224
+ "name": "since"
225
+ }
226
+ ],
227
+ "methods": [],
228
+ "properties": [
229
+ {
230
+ "name": "stream",
231
+ "tags": [
232
+ {
233
+ "text": "0.1.0",
234
+ "name": "since"
235
+ },
236
+ {
237
+ "text": "VolumeStream.Music",
238
+ "name": "default"
239
+ },
240
+ {
241
+ "text": "'music'",
242
+ "name": "example"
243
+ }
244
+ ],
245
+ "docs": "The audio stream to get the volume for.\n\nOnly available on Android.",
246
+ "complexTypes": [
247
+ "VolumeStream"
248
+ ],
249
+ "type": "VolumeStream"
250
+ }
251
+ ]
252
+ },
253
+ {
254
+ "name": "IsWatchingResult",
255
+ "slug": "iswatchingresult",
256
+ "docs": "",
257
+ "tags": [
258
+ {
259
+ "text": "0.1.0",
260
+ "name": "since"
261
+ }
262
+ ],
263
+ "methods": [],
264
+ "properties": [
265
+ {
266
+ "name": "watching",
267
+ "tags": [
268
+ {
269
+ "text": "0.1.0",
270
+ "name": "since"
271
+ },
272
+ {
273
+ "text": "true",
274
+ "name": "example"
275
+ }
276
+ ],
277
+ "docs": "Whether the hardware volume buttons are currently being watched.",
278
+ "complexTypes": [],
279
+ "type": "boolean"
280
+ }
281
+ ]
282
+ },
283
+ {
284
+ "name": "SetVolumeOptions",
285
+ "slug": "setvolumeoptions",
286
+ "docs": "",
287
+ "tags": [
288
+ {
289
+ "text": "0.1.0",
290
+ "name": "since"
291
+ }
292
+ ],
293
+ "methods": [],
294
+ "properties": [
295
+ {
296
+ "name": "stream",
297
+ "tags": [
298
+ {
299
+ "text": "0.1.0",
300
+ "name": "since"
301
+ },
302
+ {
303
+ "text": "VolumeStream.Music",
304
+ "name": "default"
305
+ },
306
+ {
307
+ "text": "'music'",
308
+ "name": "example"
309
+ }
310
+ ],
311
+ "docs": "The audio stream to set the volume for.\n\nOnly available on Android.",
312
+ "complexTypes": [
313
+ "VolumeStream"
314
+ ],
315
+ "type": "VolumeStream"
316
+ },
317
+ {
318
+ "name": "volume",
319
+ "tags": [
320
+ {
321
+ "text": "0.1.0",
322
+ "name": "since"
323
+ },
324
+ {
325
+ "text": "0.5",
326
+ "name": "example"
327
+ }
328
+ ],
329
+ "docs": "The volume level to set as a value between `0` and `1`.",
330
+ "complexTypes": [],
331
+ "type": "number"
332
+ }
333
+ ]
334
+ },
335
+ {
336
+ "name": "StartWatchingOptions",
337
+ "slug": "startwatchingoptions",
338
+ "docs": "",
339
+ "tags": [
340
+ {
341
+ "text": "0.1.0",
342
+ "name": "since"
343
+ }
344
+ ],
345
+ "methods": [],
346
+ "properties": [
347
+ {
348
+ "name": "suppressVolumeChange",
349
+ "tags": [
350
+ {
351
+ "text": "0.1.0",
352
+ "name": "since"
353
+ },
354
+ {
355
+ "text": "false",
356
+ "name": "default"
357
+ },
358
+ {
359
+ "text": "true",
360
+ "name": "example"
361
+ }
362
+ ],
363
+ "docs": "Whether to keep the volume level unchanged when a hardware volume\nbutton is pressed while watching.\n\nOn Android, the volume key events are consumed so that the system\ndoes not apply the volume change or display the volume panel.\nOn iOS, the volume level is reset immediately after each button\npress and the system volume indicator is hidden. If the volume\nlevel is close to the minimum or maximum, it is nudged to a value\nfrom which both buttons can still be detected. The original volume\nlevel is restored when watching stops.",
364
+ "complexTypes": [],
365
+ "type": "boolean | undefined"
366
+ }
367
+ ]
368
+ },
369
+ {
370
+ "name": "PluginListenerHandle",
371
+ "slug": "pluginlistenerhandle",
372
+ "docs": "",
373
+ "tags": [],
374
+ "methods": [],
375
+ "properties": [
376
+ {
377
+ "name": "remove",
378
+ "tags": [],
379
+ "docs": "",
380
+ "complexTypes": [],
381
+ "type": "() => Promise<void>"
382
+ }
383
+ ]
384
+ },
385
+ {
386
+ "name": "VolumeButtonPressedEvent",
387
+ "slug": "volumebuttonpressedevent",
388
+ "docs": "",
389
+ "tags": [
390
+ {
391
+ "text": "0.1.0",
392
+ "name": "since"
393
+ }
394
+ ],
395
+ "methods": [],
396
+ "properties": [
397
+ {
398
+ "name": "direction",
399
+ "tags": [
400
+ {
401
+ "text": "0.1.0",
402
+ "name": "since"
403
+ },
404
+ {
405
+ "text": "'up'",
406
+ "name": "example"
407
+ }
408
+ ],
409
+ "docs": "The direction of the pressed hardware volume button.",
410
+ "complexTypes": [
411
+ "Direction"
412
+ ],
413
+ "type": "Direction"
414
+ }
415
+ ]
416
+ },
417
+ {
418
+ "name": "VolumeChangeEvent",
419
+ "slug": "volumechangeevent",
420
+ "docs": "",
421
+ "tags": [
422
+ {
423
+ "text": "0.1.0",
424
+ "name": "since"
425
+ }
426
+ ],
427
+ "methods": [],
428
+ "properties": [
429
+ {
430
+ "name": "volume",
431
+ "tags": [
432
+ {
433
+ "text": "0.1.0",
434
+ "name": "since"
435
+ },
436
+ {
437
+ "text": "0.5",
438
+ "name": "example"
439
+ }
440
+ ],
441
+ "docs": "The new volume level as a value between `0` and `1`.",
442
+ "complexTypes": [],
443
+ "type": "number"
444
+ }
445
+ ]
446
+ }
447
+ ],
448
+ "enums": [
449
+ {
450
+ "name": "VolumeStream",
451
+ "slug": "volumestream",
452
+ "members": [
453
+ {
454
+ "name": "Alarm",
455
+ "value": "'alarm'",
456
+ "tags": [
457
+ {
458
+ "text": "0.1.0",
459
+ "name": "since"
460
+ }
461
+ ],
462
+ "docs": "The audio stream for alarms."
463
+ },
464
+ {
465
+ "name": "Music",
466
+ "value": "'music'",
467
+ "tags": [
468
+ {
469
+ "text": "0.1.0",
470
+ "name": "since"
471
+ }
472
+ ],
473
+ "docs": "The audio stream for music and media playback."
474
+ },
475
+ {
476
+ "name": "Notification",
477
+ "value": "'notification'",
478
+ "tags": [
479
+ {
480
+ "text": "0.1.0",
481
+ "name": "since"
482
+ }
483
+ ],
484
+ "docs": "The audio stream for notifications."
485
+ },
486
+ {
487
+ "name": "Ring",
488
+ "value": "'ring'",
489
+ "tags": [
490
+ {
491
+ "text": "0.1.0",
492
+ "name": "since"
493
+ }
494
+ ],
495
+ "docs": "The audio stream for the phone ring."
496
+ },
497
+ {
498
+ "name": "System",
499
+ "value": "'system'",
500
+ "tags": [
501
+ {
502
+ "text": "0.1.0",
503
+ "name": "since"
504
+ }
505
+ ],
506
+ "docs": "The audio stream for system sounds."
507
+ },
508
+ {
509
+ "name": "VoiceCall",
510
+ "value": "'voiceCall'",
511
+ "tags": [
512
+ {
513
+ "text": "0.1.0",
514
+ "name": "since"
515
+ }
516
+ ],
517
+ "docs": "The audio stream for phone calls."
518
+ }
519
+ ]
520
+ }
521
+ ],
522
+ "typeAliases": [
523
+ {
524
+ "name": "Direction",
525
+ "slug": "direction",
526
+ "docs": "The direction of a hardware volume button.\n\n- `up`: The volume up button.\n- `down`: The volume down button.",
527
+ "types": [
528
+ {
529
+ "text": "'down'",
530
+ "complexTypes": []
531
+ },
532
+ {
533
+ "text": "'up'",
534
+ "complexTypes": []
535
+ }
536
+ ]
537
+ }
538
+ ],
539
+ "pluginConfigs": []
540
+ }