@capawesome/capacitor-audio-session 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 (35) hide show
  1. package/CapawesomeCapacitorAudioSession.podspec +17 -0
  2. package/LICENSE +21 -0
  3. package/Package.swift +28 -0
  4. package/README.md +389 -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/audiosession/AudioSessionPlugin.java +35 -0
  8. package/android/src/main/res/.gitkeep +0 -0
  9. package/dist/docs.json +759 -0
  10. package/dist/esm/definitions.d.ts +287 -0
  11. package/dist/esm/definitions.js +19 -0
  12. package/dist/esm/definitions.js.map +1 -0
  13. package/dist/esm/index.d.ts +4 -0
  14. package/dist/esm/index.js +7 -0
  15. package/dist/esm/index.js.map +1 -0
  16. package/dist/esm/web.d.ts +8 -0
  17. package/dist/esm/web.js +16 -0
  18. package/dist/esm/web.js.map +1 -0
  19. package/dist/plugin.cjs.js +49 -0
  20. package/dist/plugin.cjs.js.map +1 -0
  21. package/dist/plugin.js +52 -0
  22. package/dist/plugin.js.map +1 -0
  23. package/ios/Plugin/AudioSession.swift +127 -0
  24. package/ios/Plugin/AudioSessionPlugin.swift +103 -0
  25. package/ios/Plugin/Classes/Events/InterruptionEvent.swift +19 -0
  26. package/ios/Plugin/Classes/Events/RouteChangeEvent.swift +19 -0
  27. package/ios/Plugin/Classes/Options/ConfigureOptions.swift +101 -0
  28. package/ios/Plugin/Classes/Options/OverrideOutputOptions.swift +24 -0
  29. package/ios/Plugin/Classes/Options/SetActiveOptions.swift +27 -0
  30. package/ios/Plugin/Classes/Results/AudioSessionOutput.swift +19 -0
  31. package/ios/Plugin/Classes/Results/GetCurrentOutputsResult.swift +16 -0
  32. package/ios/Plugin/Enums/CustomError.swift +36 -0
  33. package/ios/Plugin/Info.plist +24 -0
  34. package/ios/Plugin/Protocols/Result.swift +5 -0
  35. package/package.json +91 -0
package/dist/docs.json ADDED
@@ -0,0 +1,759 @@
1
+ {
2
+ "api": {
3
+ "name": "AudioSessionPlugin",
4
+ "slug": "audiosessionplugin",
5
+ "docs": "",
6
+ "tags": [],
7
+ "methods": [
8
+ {
9
+ "name": "addListener",
10
+ "signature": "(eventName: 'interruption', listenerFunc: (event: InterruptionEvent) => void) => Promise<PluginListenerHandle>",
11
+ "parameters": [
12
+ {
13
+ "name": "eventName",
14
+ "docs": "",
15
+ "type": "'interruption'"
16
+ },
17
+ {
18
+ "name": "listenerFunc",
19
+ "docs": "",
20
+ "type": "(event: InterruptionEvent) => void"
21
+ }
22
+ ],
23
+ "returns": "Promise<PluginListenerHandle>",
24
+ "tags": [
25
+ {
26
+ "name": "since",
27
+ "text": "0.1.0"
28
+ }
29
+ ],
30
+ "docs": "Called when the audio session is interrupted, e.g. by an incoming phone call.\n\nOnly available on iOS.",
31
+ "complexTypes": [
32
+ "PluginListenerHandle",
33
+ "InterruptionEvent"
34
+ ],
35
+ "slug": "addlistenerinterruption-"
36
+ },
37
+ {
38
+ "name": "addListener",
39
+ "signature": "(eventName: 'routeChange', listenerFunc: (event: RouteChangeEvent) => void) => Promise<PluginListenerHandle>",
40
+ "parameters": [
41
+ {
42
+ "name": "eventName",
43
+ "docs": "",
44
+ "type": "'routeChange'"
45
+ },
46
+ {
47
+ "name": "listenerFunc",
48
+ "docs": "",
49
+ "type": "(event: RouteChangeEvent) => void"
50
+ }
51
+ ],
52
+ "returns": "Promise<PluginListenerHandle>",
53
+ "tags": [
54
+ {
55
+ "name": "since",
56
+ "text": "0.1.0"
57
+ }
58
+ ],
59
+ "docs": "Called when the audio route changes, e.g. when headphones are plugged in or out.\n\nOnly available on iOS.",
60
+ "complexTypes": [
61
+ "PluginListenerHandle",
62
+ "RouteChangeEvent"
63
+ ],
64
+ "slug": "addlistenerroutechange-"
65
+ },
66
+ {
67
+ "name": "configure",
68
+ "signature": "(options: ConfigureOptions) => Promise<void>",
69
+ "parameters": [
70
+ {
71
+ "name": "options",
72
+ "docs": "",
73
+ "type": "ConfigureOptions"
74
+ }
75
+ ],
76
+ "returns": "Promise<void>",
77
+ "tags": [
78
+ {
79
+ "name": "since",
80
+ "text": "0.1.0"
81
+ }
82
+ ],
83
+ "docs": "Configure the audio session category, mode and options.\n\nOnly available on iOS.",
84
+ "complexTypes": [
85
+ "ConfigureOptions"
86
+ ],
87
+ "slug": "configure"
88
+ },
89
+ {
90
+ "name": "getCurrentOutputs",
91
+ "signature": "() => Promise<GetCurrentOutputsResult>",
92
+ "parameters": [],
93
+ "returns": "Promise<GetCurrentOutputsResult>",
94
+ "tags": [
95
+ {
96
+ "name": "since",
97
+ "text": "0.1.0"
98
+ }
99
+ ],
100
+ "docs": "Get the audio outputs of the current audio route.\n\nOnly available on iOS.",
101
+ "complexTypes": [
102
+ "GetCurrentOutputsResult"
103
+ ],
104
+ "slug": "getcurrentoutputs"
105
+ },
106
+ {
107
+ "name": "overrideOutput",
108
+ "signature": "(options: OverrideOutputOptions) => Promise<void>",
109
+ "parameters": [
110
+ {
111
+ "name": "options",
112
+ "docs": "",
113
+ "type": "OverrideOutputOptions"
114
+ }
115
+ ],
116
+ "returns": "Promise<void>",
117
+ "tags": [
118
+ {
119
+ "name": "since",
120
+ "text": "0.1.0"
121
+ }
122
+ ],
123
+ "docs": "Override the audio output port that is used for playback.\n\nOnly available on iOS.",
124
+ "complexTypes": [
125
+ "OverrideOutputOptions"
126
+ ],
127
+ "slug": "overrideoutput"
128
+ },
129
+ {
130
+ "name": "removeAllListeners",
131
+ "signature": "() => Promise<void>",
132
+ "parameters": [],
133
+ "returns": "Promise<void>",
134
+ "tags": [
135
+ {
136
+ "name": "since",
137
+ "text": "0.1.0"
138
+ }
139
+ ],
140
+ "docs": "Remove all listeners for this plugin.\n\nOnly available on iOS.",
141
+ "complexTypes": [],
142
+ "slug": "removealllisteners"
143
+ },
144
+ {
145
+ "name": "setActive",
146
+ "signature": "(options: SetActiveOptions) => Promise<void>",
147
+ "parameters": [
148
+ {
149
+ "name": "options",
150
+ "docs": "",
151
+ "type": "SetActiveOptions"
152
+ }
153
+ ],
154
+ "returns": "Promise<void>",
155
+ "tags": [
156
+ {
157
+ "name": "since",
158
+ "text": "0.1.0"
159
+ }
160
+ ],
161
+ "docs": "Activate or deactivate the audio session.\n\nOnly available on iOS.",
162
+ "complexTypes": [
163
+ "SetActiveOptions"
164
+ ],
165
+ "slug": "setactive"
166
+ }
167
+ ],
168
+ "properties": []
169
+ },
170
+ "interfaces": [
171
+ {
172
+ "name": "PluginListenerHandle",
173
+ "slug": "pluginlistenerhandle",
174
+ "docs": "",
175
+ "tags": [],
176
+ "methods": [],
177
+ "properties": [
178
+ {
179
+ "name": "remove",
180
+ "tags": [],
181
+ "docs": "",
182
+ "complexTypes": [],
183
+ "type": "() => Promise<void>"
184
+ }
185
+ ]
186
+ },
187
+ {
188
+ "name": "InterruptionEvent",
189
+ "slug": "interruptionevent",
190
+ "docs": "",
191
+ "tags": [
192
+ {
193
+ "text": "0.1.0",
194
+ "name": "since"
195
+ }
196
+ ],
197
+ "methods": [],
198
+ "properties": [
199
+ {
200
+ "name": "shouldResume",
201
+ "tags": [
202
+ {
203
+ "text": "0.1.0",
204
+ "name": "since"
205
+ }
206
+ ],
207
+ "docs": "Whether playback should resume after the interruption ended.\n\nOnly `true` if `type` is `ended`.",
208
+ "complexTypes": [],
209
+ "type": "boolean"
210
+ },
211
+ {
212
+ "name": "type",
213
+ "tags": [
214
+ {
215
+ "text": "0.1.0",
216
+ "name": "since"
217
+ }
218
+ ],
219
+ "docs": "The type of the interruption.",
220
+ "complexTypes": [
221
+ "InterruptionType"
222
+ ],
223
+ "type": "InterruptionType"
224
+ }
225
+ ]
226
+ },
227
+ {
228
+ "name": "RouteChangeEvent",
229
+ "slug": "routechangeevent",
230
+ "docs": "",
231
+ "tags": [
232
+ {
233
+ "text": "0.1.0",
234
+ "name": "since"
235
+ }
236
+ ],
237
+ "methods": [],
238
+ "properties": [
239
+ {
240
+ "name": "outputs",
241
+ "tags": [
242
+ {
243
+ "text": "0.1.0",
244
+ "name": "since"
245
+ }
246
+ ],
247
+ "docs": "The audio outputs of the audio route after the change.",
248
+ "complexTypes": [
249
+ "AudioSessionOutput"
250
+ ],
251
+ "type": "AudioSessionOutput[]"
252
+ },
253
+ {
254
+ "name": "reason",
255
+ "tags": [
256
+ {
257
+ "text": "0.1.0",
258
+ "name": "since"
259
+ }
260
+ ],
261
+ "docs": "The reason why the audio route changed.",
262
+ "complexTypes": [
263
+ "RouteChangeReason"
264
+ ],
265
+ "type": "RouteChangeReason"
266
+ }
267
+ ]
268
+ },
269
+ {
270
+ "name": "AudioSessionOutput",
271
+ "slug": "audiosessionoutput",
272
+ "docs": "",
273
+ "tags": [
274
+ {
275
+ "text": "0.1.0",
276
+ "name": "since"
277
+ }
278
+ ],
279
+ "methods": [],
280
+ "properties": [
281
+ {
282
+ "name": "portName",
283
+ "tags": [
284
+ {
285
+ "text": "'Speaker'",
286
+ "name": "example"
287
+ },
288
+ {
289
+ "text": "0.1.0",
290
+ "name": "since"
291
+ }
292
+ ],
293
+ "docs": "The human-readable name of the audio output port.",
294
+ "complexTypes": [],
295
+ "type": "string"
296
+ },
297
+ {
298
+ "name": "portType",
299
+ "tags": [
300
+ {
301
+ "text": "'Speaker'",
302
+ "name": "example"
303
+ },
304
+ {
305
+ "text": "0.1.0",
306
+ "name": "since"
307
+ }
308
+ ],
309
+ "docs": "The type of the audio output port.",
310
+ "complexTypes": [],
311
+ "type": "string"
312
+ }
313
+ ]
314
+ },
315
+ {
316
+ "name": "ConfigureOptions",
317
+ "slug": "configureoptions",
318
+ "docs": "",
319
+ "tags": [
320
+ {
321
+ "text": "0.1.0",
322
+ "name": "since"
323
+ }
324
+ ],
325
+ "methods": [],
326
+ "properties": [
327
+ {
328
+ "name": "category",
329
+ "tags": [
330
+ {
331
+ "text": "'playback'",
332
+ "name": "example"
333
+ },
334
+ {
335
+ "text": "0.1.0",
336
+ "name": "since"
337
+ }
338
+ ],
339
+ "docs": "The audio session category.",
340
+ "complexTypes": [
341
+ "AudioSessionCategory"
342
+ ],
343
+ "type": "AudioSessionCategory"
344
+ },
345
+ {
346
+ "name": "mode",
347
+ "tags": [
348
+ {
349
+ "text": "'default'",
350
+ "name": "default"
351
+ },
352
+ {
353
+ "text": "'moviePlayback'",
354
+ "name": "example"
355
+ },
356
+ {
357
+ "text": "0.1.0",
358
+ "name": "since"
359
+ }
360
+ ],
361
+ "docs": "The audio session mode.",
362
+ "complexTypes": [
363
+ "AudioSessionMode"
364
+ ],
365
+ "type": "AudioSessionMode"
366
+ },
367
+ {
368
+ "name": "options",
369
+ "tags": [
370
+ {
371
+ "text": "0.1.0",
372
+ "name": "since"
373
+ }
374
+ ],
375
+ "docs": "The audio session category options.",
376
+ "complexTypes": [
377
+ "AudioSessionCategoryOptions"
378
+ ],
379
+ "type": "AudioSessionCategoryOptions"
380
+ }
381
+ ]
382
+ },
383
+ {
384
+ "name": "AudioSessionCategoryOptions",
385
+ "slug": "audiosessioncategoryoptions",
386
+ "docs": "",
387
+ "tags": [
388
+ {
389
+ "text": "0.1.0",
390
+ "name": "since"
391
+ }
392
+ ],
393
+ "methods": [],
394
+ "properties": [
395
+ {
396
+ "name": "allowAirPlay",
397
+ "tags": [
398
+ {
399
+ "text": "false",
400
+ "name": "default"
401
+ },
402
+ {
403
+ "text": "0.1.0",
404
+ "name": "since"
405
+ }
406
+ ],
407
+ "docs": "Whether AirPlay devices can be used for output.",
408
+ "complexTypes": [],
409
+ "type": "boolean | undefined"
410
+ },
411
+ {
412
+ "name": "allowBluetooth",
413
+ "tags": [
414
+ {
415
+ "text": "false",
416
+ "name": "default"
417
+ },
418
+ {
419
+ "text": "0.1.0",
420
+ "name": "since"
421
+ }
422
+ ],
423
+ "docs": "Whether Bluetooth hands-free devices can be used for input and output.",
424
+ "complexTypes": [],
425
+ "type": "boolean | undefined"
426
+ },
427
+ {
428
+ "name": "allowBluetoothA2DP",
429
+ "tags": [
430
+ {
431
+ "text": "false",
432
+ "name": "default"
433
+ },
434
+ {
435
+ "text": "0.1.0",
436
+ "name": "since"
437
+ }
438
+ ],
439
+ "docs": "Whether Bluetooth A2DP devices can be used for output.",
440
+ "complexTypes": [],
441
+ "type": "boolean | undefined"
442
+ },
443
+ {
444
+ "name": "defaultToSpeaker",
445
+ "tags": [
446
+ {
447
+ "text": "false",
448
+ "name": "default"
449
+ },
450
+ {
451
+ "text": "0.1.0",
452
+ "name": "since"
453
+ }
454
+ ],
455
+ "docs": "Whether audio is routed to the built-in speaker instead of the receiver\nwhen no other audio route is connected.",
456
+ "complexTypes": [],
457
+ "type": "boolean | undefined"
458
+ },
459
+ {
460
+ "name": "duckOthers",
461
+ "tags": [
462
+ {
463
+ "text": "false",
464
+ "name": "default"
465
+ },
466
+ {
467
+ "text": "0.1.0",
468
+ "name": "since"
469
+ }
470
+ ],
471
+ "docs": "Whether audio from other sessions is reduced in volume (ducked) while audio\nfrom this session plays.",
472
+ "complexTypes": [],
473
+ "type": "boolean | undefined"
474
+ },
475
+ {
476
+ "name": "interruptSpokenAudioAndMixWithOthers",
477
+ "tags": [
478
+ {
479
+ "text": "false",
480
+ "name": "default"
481
+ },
482
+ {
483
+ "text": "0.1.0",
484
+ "name": "since"
485
+ }
486
+ ],
487
+ "docs": "Whether audio from other sessions using the `spokenAudio` mode is interrupted\nand audio from this session is mixed with the remaining audio.",
488
+ "complexTypes": [],
489
+ "type": "boolean | undefined"
490
+ },
491
+ {
492
+ "name": "mixWithOthers",
493
+ "tags": [
494
+ {
495
+ "text": "false",
496
+ "name": "default"
497
+ },
498
+ {
499
+ "text": "0.1.0",
500
+ "name": "since"
501
+ }
502
+ ],
503
+ "docs": "Whether audio from this session mixes with audio from other active sessions\ninstead of interrupting them.",
504
+ "complexTypes": [],
505
+ "type": "boolean | undefined"
506
+ }
507
+ ]
508
+ },
509
+ {
510
+ "name": "GetCurrentOutputsResult",
511
+ "slug": "getcurrentoutputsresult",
512
+ "docs": "",
513
+ "tags": [
514
+ {
515
+ "text": "0.1.0",
516
+ "name": "since"
517
+ }
518
+ ],
519
+ "methods": [],
520
+ "properties": [
521
+ {
522
+ "name": "outputs",
523
+ "tags": [
524
+ {
525
+ "text": "0.1.0",
526
+ "name": "since"
527
+ }
528
+ ],
529
+ "docs": "The audio outputs of the current audio route.",
530
+ "complexTypes": [
531
+ "AudioSessionOutput"
532
+ ],
533
+ "type": "AudioSessionOutput[]"
534
+ }
535
+ ]
536
+ },
537
+ {
538
+ "name": "OverrideOutputOptions",
539
+ "slug": "overrideoutputoptions",
540
+ "docs": "",
541
+ "tags": [
542
+ {
543
+ "text": "0.1.0",
544
+ "name": "since"
545
+ }
546
+ ],
547
+ "methods": [],
548
+ "properties": [
549
+ {
550
+ "name": "type",
551
+ "tags": [
552
+ {
553
+ "text": "'speaker'",
554
+ "name": "example"
555
+ },
556
+ {
557
+ "text": "0.1.0",
558
+ "name": "since"
559
+ }
560
+ ],
561
+ "docs": "The audio output port to route playback to.",
562
+ "complexTypes": [
563
+ "OverrideOutputType"
564
+ ],
565
+ "type": "OverrideOutputType"
566
+ }
567
+ ]
568
+ },
569
+ {
570
+ "name": "SetActiveOptions",
571
+ "slug": "setactiveoptions",
572
+ "docs": "",
573
+ "tags": [
574
+ {
575
+ "text": "0.1.0",
576
+ "name": "since"
577
+ }
578
+ ],
579
+ "methods": [],
580
+ "properties": [
581
+ {
582
+ "name": "active",
583
+ "tags": [
584
+ {
585
+ "text": "0.1.0",
586
+ "name": "since"
587
+ }
588
+ ],
589
+ "docs": "Whether the audio session should be activated (`true`) or deactivated (`false`).",
590
+ "complexTypes": [],
591
+ "type": "boolean"
592
+ },
593
+ {
594
+ "name": "notifyOthersOnDeactivation",
595
+ "tags": [
596
+ {
597
+ "text": "true",
598
+ "name": "default"
599
+ },
600
+ {
601
+ "text": "0.1.0",
602
+ "name": "since"
603
+ }
604
+ ],
605
+ "docs": "Whether other audio sessions are notified when this session is deactivated,\nso they can resume playback.",
606
+ "complexTypes": [],
607
+ "type": "boolean | undefined"
608
+ }
609
+ ]
610
+ }
611
+ ],
612
+ "enums": [],
613
+ "typeAliases": [
614
+ {
615
+ "name": "InterruptionType",
616
+ "slug": "interruptiontype",
617
+ "docs": "The type of an audio session interruption.",
618
+ "types": [
619
+ {
620
+ "text": "'began'",
621
+ "complexTypes": []
622
+ },
623
+ {
624
+ "text": "'ended'",
625
+ "complexTypes": []
626
+ }
627
+ ]
628
+ },
629
+ {
630
+ "name": "RouteChangeReason",
631
+ "slug": "routechangereason",
632
+ "docs": "The reason why the audio route changed.",
633
+ "types": [
634
+ {
635
+ "text": "'categoryChange'",
636
+ "complexTypes": []
637
+ },
638
+ {
639
+ "text": "'newDeviceAvailable'",
640
+ "complexTypes": []
641
+ },
642
+ {
643
+ "text": "'noSuitableRouteForCategory'",
644
+ "complexTypes": []
645
+ },
646
+ {
647
+ "text": "'oldDeviceUnavailable'",
648
+ "complexTypes": []
649
+ },
650
+ {
651
+ "text": "'override'",
652
+ "complexTypes": []
653
+ },
654
+ {
655
+ "text": "'routeConfigurationChange'",
656
+ "complexTypes": []
657
+ },
658
+ {
659
+ "text": "'unknown'",
660
+ "complexTypes": []
661
+ },
662
+ {
663
+ "text": "'wakeFromSleep'",
664
+ "complexTypes": []
665
+ }
666
+ ]
667
+ },
668
+ {
669
+ "name": "AudioSessionCategory",
670
+ "slug": "audiosessioncategory",
671
+ "docs": "The audio session category.",
672
+ "types": [
673
+ {
674
+ "text": "'ambient'",
675
+ "complexTypes": []
676
+ },
677
+ {
678
+ "text": "'multiRoute'",
679
+ "complexTypes": []
680
+ },
681
+ {
682
+ "text": "'playAndRecord'",
683
+ "complexTypes": []
684
+ },
685
+ {
686
+ "text": "'playback'",
687
+ "complexTypes": []
688
+ },
689
+ {
690
+ "text": "'record'",
691
+ "complexTypes": []
692
+ },
693
+ {
694
+ "text": "'soloAmbient'",
695
+ "complexTypes": []
696
+ }
697
+ ]
698
+ },
699
+ {
700
+ "name": "AudioSessionMode",
701
+ "slug": "audiosessionmode",
702
+ "docs": "The audio session mode.",
703
+ "types": [
704
+ {
705
+ "text": "'default'",
706
+ "complexTypes": []
707
+ },
708
+ {
709
+ "text": "'gameChat'",
710
+ "complexTypes": []
711
+ },
712
+ {
713
+ "text": "'measurement'",
714
+ "complexTypes": []
715
+ },
716
+ {
717
+ "text": "'moviePlayback'",
718
+ "complexTypes": []
719
+ },
720
+ {
721
+ "text": "'spokenAudio'",
722
+ "complexTypes": []
723
+ },
724
+ {
725
+ "text": "'videoChat'",
726
+ "complexTypes": []
727
+ },
728
+ {
729
+ "text": "'videoRecording'",
730
+ "complexTypes": []
731
+ },
732
+ {
733
+ "text": "'voiceChat'",
734
+ "complexTypes": []
735
+ },
736
+ {
737
+ "text": "'voicePrompt'",
738
+ "complexTypes": []
739
+ }
740
+ ]
741
+ },
742
+ {
743
+ "name": "OverrideOutputType",
744
+ "slug": "overrideoutputtype",
745
+ "docs": "The audio output port to route playback to.",
746
+ "types": [
747
+ {
748
+ "text": "'default'",
749
+ "complexTypes": []
750
+ },
751
+ {
752
+ "text": "'speaker'",
753
+ "complexTypes": []
754
+ }
755
+ ]
756
+ }
757
+ ],
758
+ "pluginConfigs": []
759
+ }