@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.
- package/CapawesomeCapacitorVolume.podspec +17 -0
- package/LICENSE +21 -0
- package/Package.swift +28 -0
- package/README.md +405 -0
- package/android/build.gradle +58 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/Volume.java +158 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/VolumeHelper.java +27 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/VolumePlugin.java +178 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/CustomException.java +20 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/CustomExceptions.java +12 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/events/VolumeButtonPressedEvent.java +23 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/events/VolumeChangeEvent.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/options/GetVolumeOptions.java +23 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/options/SetVolumeOptions.java +41 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/options/StartWatchingOptions.java +17 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/results/GetVolumeResult.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/classes/results/IsWatchingResult.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/interfaces/Callback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/interfaces/EmptyCallback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/interfaces/NonEmptyResultCallback.java +7 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/volume/interfaces/Result.java +7 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +540 -0
- package/dist/esm/definitions.d.ts +255 -0
- package/dist/esm/definitions.js +60 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +9 -0
- package/dist/esm/web.js +19 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +93 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +96 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/Classes/Events/VolumeButtonPressedEvent.swift +16 -0
- package/ios/Plugin/Classes/Events/VolumeChangeEvent.swift +16 -0
- package/ios/Plugin/Classes/Options/SetVolumeOptions.swift +20 -0
- package/ios/Plugin/Classes/Options/StartWatchingOptions.swift +10 -0
- package/ios/Plugin/Classes/Results/GetVolumeResult.swift +16 -0
- package/ios/Plugin/Classes/Results/IsWatchingResult.swift +16 -0
- package/ios/Plugin/Enums/CustomError.swift +24 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/Protocols/Result.swift +5 -0
- package/ios/Plugin/Volume.swift +192 -0
- package/ios/Plugin/VolumePlugin.swift +109 -0
- package/package.json +91 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import type { PluginListenerHandle } from '@capacitor/core';
|
|
2
|
+
export interface VolumePlugin {
|
|
3
|
+
/**
|
|
4
|
+
* Get the current volume level.
|
|
5
|
+
*
|
|
6
|
+
* On iOS, this always returns the media volume.
|
|
7
|
+
*
|
|
8
|
+
* Only available on Android and iOS.
|
|
9
|
+
*
|
|
10
|
+
* @since 0.1.0
|
|
11
|
+
*/
|
|
12
|
+
getVolume(options?: GetVolumeOptions): Promise<GetVolumeResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Check whether the hardware volume buttons are currently being watched.
|
|
15
|
+
*
|
|
16
|
+
* Only available on Android and iOS.
|
|
17
|
+
*
|
|
18
|
+
* @since 0.1.0
|
|
19
|
+
*/
|
|
20
|
+
isWatching(): Promise<IsWatchingResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Set the volume level.
|
|
23
|
+
*
|
|
24
|
+
* On iOS, this always sets the media volume.
|
|
25
|
+
*
|
|
26
|
+
* Only available on Android and iOS.
|
|
27
|
+
*
|
|
28
|
+
* @since 0.1.0
|
|
29
|
+
*/
|
|
30
|
+
setVolume(options: SetVolumeOptions): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Start watching the hardware volume buttons.
|
|
33
|
+
*
|
|
34
|
+
* The `volumeButtonPressed` and `volumeChange` events are only
|
|
35
|
+
* emitted while watching.
|
|
36
|
+
*
|
|
37
|
+
* If the volume buttons are already being watched, this call has
|
|
38
|
+
* no effect. Call `stopWatching()` first to change the options.
|
|
39
|
+
*
|
|
40
|
+
* Only available on Android and iOS.
|
|
41
|
+
*
|
|
42
|
+
* @since 0.1.0
|
|
43
|
+
*/
|
|
44
|
+
startWatching(options?: StartWatchingOptions): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Stop watching the hardware volume buttons.
|
|
47
|
+
*
|
|
48
|
+
* On iOS, this also restores the volume level that was set when
|
|
49
|
+
* watching started if the `suppressVolumeChange` option was enabled.
|
|
50
|
+
*
|
|
51
|
+
* Only available on Android and iOS.
|
|
52
|
+
*
|
|
53
|
+
* @since 0.1.0
|
|
54
|
+
*/
|
|
55
|
+
stopWatching(): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Called when a hardware volume button is pressed while watching.
|
|
58
|
+
*
|
|
59
|
+
* Only available on Android and iOS.
|
|
60
|
+
*
|
|
61
|
+
* @since 0.1.0
|
|
62
|
+
*/
|
|
63
|
+
addListener(eventName: 'volumeButtonPressed', listenerFunc: (event: VolumeButtonPressedEvent) => void): Promise<PluginListenerHandle>;
|
|
64
|
+
/**
|
|
65
|
+
* Called when the volume level changes while watching.
|
|
66
|
+
*
|
|
67
|
+
* On Android, this is called for changes to the music stream.
|
|
68
|
+
* On iOS, this is called for changes to the media volume and is
|
|
69
|
+
* not called while the `suppressVolumeChange` option is enabled.
|
|
70
|
+
*
|
|
71
|
+
* Only available on Android and iOS.
|
|
72
|
+
*
|
|
73
|
+
* @since 0.1.0
|
|
74
|
+
*/
|
|
75
|
+
addListener(eventName: 'volumeChange', listenerFunc: (event: VolumeChangeEvent) => void): Promise<PluginListenerHandle>;
|
|
76
|
+
/**
|
|
77
|
+
* Remove all listeners for this plugin.
|
|
78
|
+
*
|
|
79
|
+
* @since 0.1.0
|
|
80
|
+
*/
|
|
81
|
+
removeAllListeners(): Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @since 0.1.0
|
|
85
|
+
*/
|
|
86
|
+
export interface GetVolumeOptions {
|
|
87
|
+
/**
|
|
88
|
+
* The audio stream to get the volume for.
|
|
89
|
+
*
|
|
90
|
+
* Only available on Android.
|
|
91
|
+
*
|
|
92
|
+
* @since 0.1.0
|
|
93
|
+
* @default VolumeStream.Music
|
|
94
|
+
* @example 'music'
|
|
95
|
+
*/
|
|
96
|
+
stream?: VolumeStream;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @since 0.1.0
|
|
100
|
+
*/
|
|
101
|
+
export interface GetVolumeResult {
|
|
102
|
+
/**
|
|
103
|
+
* The current volume level as a value between `0` and `1`.
|
|
104
|
+
*
|
|
105
|
+
* @since 0.1.0
|
|
106
|
+
* @example 0.5
|
|
107
|
+
*/
|
|
108
|
+
volume: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @since 0.1.0
|
|
112
|
+
*/
|
|
113
|
+
export interface SetVolumeOptions {
|
|
114
|
+
/**
|
|
115
|
+
* The audio stream to set the volume for.
|
|
116
|
+
*
|
|
117
|
+
* Only available on Android.
|
|
118
|
+
*
|
|
119
|
+
* @since 0.1.0
|
|
120
|
+
* @default VolumeStream.Music
|
|
121
|
+
* @example 'music'
|
|
122
|
+
*/
|
|
123
|
+
stream?: VolumeStream;
|
|
124
|
+
/**
|
|
125
|
+
* The volume level to set as a value between `0` and `1`.
|
|
126
|
+
*
|
|
127
|
+
* @since 0.1.0
|
|
128
|
+
* @example 0.5
|
|
129
|
+
*/
|
|
130
|
+
volume: number;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @since 0.1.0
|
|
134
|
+
*/
|
|
135
|
+
export interface StartWatchingOptions {
|
|
136
|
+
/**
|
|
137
|
+
* Whether to keep the volume level unchanged when a hardware volume
|
|
138
|
+
* button is pressed while watching.
|
|
139
|
+
*
|
|
140
|
+
* On Android, the volume key events are consumed so that the system
|
|
141
|
+
* does not apply the volume change or display the volume panel.
|
|
142
|
+
* On iOS, the volume level is reset immediately after each button
|
|
143
|
+
* press and the system volume indicator is hidden. If the volume
|
|
144
|
+
* level is close to the minimum or maximum, it is nudged to a value
|
|
145
|
+
* from which both buttons can still be detected. The original volume
|
|
146
|
+
* level is restored when watching stops.
|
|
147
|
+
*
|
|
148
|
+
* @since 0.1.0
|
|
149
|
+
* @default false
|
|
150
|
+
* @example true
|
|
151
|
+
*/
|
|
152
|
+
suppressVolumeChange?: boolean;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* @since 0.1.0
|
|
156
|
+
*/
|
|
157
|
+
export interface IsWatchingResult {
|
|
158
|
+
/**
|
|
159
|
+
* Whether the hardware volume buttons are currently being watched.
|
|
160
|
+
*
|
|
161
|
+
* @since 0.1.0
|
|
162
|
+
* @example true
|
|
163
|
+
*/
|
|
164
|
+
watching: boolean;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @since 0.1.0
|
|
168
|
+
*/
|
|
169
|
+
export interface VolumeButtonPressedEvent {
|
|
170
|
+
/**
|
|
171
|
+
* The direction of the pressed hardware volume button.
|
|
172
|
+
*
|
|
173
|
+
* @since 0.1.0
|
|
174
|
+
* @example 'up'
|
|
175
|
+
*/
|
|
176
|
+
direction: Direction;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* @since 0.1.0
|
|
180
|
+
*/
|
|
181
|
+
export interface VolumeChangeEvent {
|
|
182
|
+
/**
|
|
183
|
+
* The new volume level as a value between `0` and `1`.
|
|
184
|
+
*
|
|
185
|
+
* @since 0.1.0
|
|
186
|
+
* @example 0.5
|
|
187
|
+
*/
|
|
188
|
+
volume: number;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The direction of a hardware volume button.
|
|
192
|
+
*
|
|
193
|
+
* - `up`: The volume up button.
|
|
194
|
+
* - `down`: The volume down button.
|
|
195
|
+
*
|
|
196
|
+
* @since 0.1.0
|
|
197
|
+
*/
|
|
198
|
+
export type Direction = 'down' | 'up';
|
|
199
|
+
/**
|
|
200
|
+
* The audio stream of the device.
|
|
201
|
+
*
|
|
202
|
+
* @since 0.1.0
|
|
203
|
+
*/
|
|
204
|
+
export declare enum VolumeStream {
|
|
205
|
+
/**
|
|
206
|
+
* The audio stream for alarms.
|
|
207
|
+
*
|
|
208
|
+
* @since 0.1.0
|
|
209
|
+
*/
|
|
210
|
+
Alarm = "alarm",
|
|
211
|
+
/**
|
|
212
|
+
* The audio stream for music and media playback.
|
|
213
|
+
*
|
|
214
|
+
* @since 0.1.0
|
|
215
|
+
*/
|
|
216
|
+
Music = "music",
|
|
217
|
+
/**
|
|
218
|
+
* The audio stream for notifications.
|
|
219
|
+
*
|
|
220
|
+
* @since 0.1.0
|
|
221
|
+
*/
|
|
222
|
+
Notification = "notification",
|
|
223
|
+
/**
|
|
224
|
+
* The audio stream for the phone ring.
|
|
225
|
+
*
|
|
226
|
+
* @since 0.1.0
|
|
227
|
+
*/
|
|
228
|
+
Ring = "ring",
|
|
229
|
+
/**
|
|
230
|
+
* The audio stream for system sounds.
|
|
231
|
+
*
|
|
232
|
+
* @since 0.1.0
|
|
233
|
+
*/
|
|
234
|
+
System = "system",
|
|
235
|
+
/**
|
|
236
|
+
* The audio stream for phone calls.
|
|
237
|
+
*
|
|
238
|
+
* @since 0.1.0
|
|
239
|
+
*/
|
|
240
|
+
VoiceCall = "voiceCall"
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* @since 0.1.0
|
|
244
|
+
*/
|
|
245
|
+
export declare enum ErrorCode {
|
|
246
|
+
/**
|
|
247
|
+
* Do Not Disturb access is required to change the volume of the
|
|
248
|
+
* ring, notification or system stream while Do Not Disturb is active.
|
|
249
|
+
*
|
|
250
|
+
* Only available on Android.
|
|
251
|
+
*
|
|
252
|
+
* @since 0.1.0
|
|
253
|
+
*/
|
|
254
|
+
DoNotDisturbAccessRequired = "DO_NOT_DISTURB_ACCESS_REQUIRED"
|
|
255
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The audio stream of the device.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
export var VolumeStream;
|
|
7
|
+
(function (VolumeStream) {
|
|
8
|
+
/**
|
|
9
|
+
* The audio stream for alarms.
|
|
10
|
+
*
|
|
11
|
+
* @since 0.1.0
|
|
12
|
+
*/
|
|
13
|
+
VolumeStream["Alarm"] = "alarm";
|
|
14
|
+
/**
|
|
15
|
+
* The audio stream for music and media playback.
|
|
16
|
+
*
|
|
17
|
+
* @since 0.1.0
|
|
18
|
+
*/
|
|
19
|
+
VolumeStream["Music"] = "music";
|
|
20
|
+
/**
|
|
21
|
+
* The audio stream for notifications.
|
|
22
|
+
*
|
|
23
|
+
* @since 0.1.0
|
|
24
|
+
*/
|
|
25
|
+
VolumeStream["Notification"] = "notification";
|
|
26
|
+
/**
|
|
27
|
+
* The audio stream for the phone ring.
|
|
28
|
+
*
|
|
29
|
+
* @since 0.1.0
|
|
30
|
+
*/
|
|
31
|
+
VolumeStream["Ring"] = "ring";
|
|
32
|
+
/**
|
|
33
|
+
* The audio stream for system sounds.
|
|
34
|
+
*
|
|
35
|
+
* @since 0.1.0
|
|
36
|
+
*/
|
|
37
|
+
VolumeStream["System"] = "system";
|
|
38
|
+
/**
|
|
39
|
+
* The audio stream for phone calls.
|
|
40
|
+
*
|
|
41
|
+
* @since 0.1.0
|
|
42
|
+
*/
|
|
43
|
+
VolumeStream["VoiceCall"] = "voiceCall";
|
|
44
|
+
})(VolumeStream || (VolumeStream = {}));
|
|
45
|
+
/**
|
|
46
|
+
* @since 0.1.0
|
|
47
|
+
*/
|
|
48
|
+
export var ErrorCode;
|
|
49
|
+
(function (ErrorCode) {
|
|
50
|
+
/**
|
|
51
|
+
* Do Not Disturb access is required to change the volume of the
|
|
52
|
+
* ring, notification or system stream while Do Not Disturb is active.
|
|
53
|
+
*
|
|
54
|
+
* Only available on Android.
|
|
55
|
+
*
|
|
56
|
+
* @since 0.1.0
|
|
57
|
+
*/
|
|
58
|
+
ErrorCode["DoNotDisturbAccessRequired"] = "DO_NOT_DISTURB_ACCESS_REQUIRED";
|
|
59
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
60
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAsNA;;;;GAIG;AACH,MAAM,CAAN,IAAY,YAqCX;AArCD,WAAY,YAAY;IACtB;;;;OAIG;IACH,+BAAe,CAAA;IACf;;;;OAIG;IACH,+BAAe,CAAA;IACf;;;;OAIG;IACH,6CAA6B,CAAA;IAC7B;;;;OAIG;IACH,6BAAa,CAAA;IACb;;;;OAIG;IACH,iCAAiB,CAAA;IACjB;;;;OAIG;IACH,uCAAuB,CAAA;AACzB,CAAC,EArCW,YAAY,KAAZ,YAAY,QAqCvB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SAUX;AAVD,WAAY,SAAS;IACnB;;;;;;;OAOG;IACH,0EAA6D,CAAA;AAC/D,CAAC,EAVW,SAAS,KAAT,SAAS,QAUpB","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface VolumePlugin {\n /**\n * Get the current volume level.\n *\n * On iOS, this always returns the media volume.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n getVolume(options?: GetVolumeOptions): Promise<GetVolumeResult>;\n /**\n * Check whether the hardware volume buttons are currently being watched.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n isWatching(): Promise<IsWatchingResult>;\n /**\n * Set the volume level.\n *\n * On iOS, this always sets the media volume.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n setVolume(options: SetVolumeOptions): Promise<void>;\n /**\n * Start watching the hardware volume buttons.\n *\n * The `volumeButtonPressed` and `volumeChange` events are only\n * emitted while watching.\n *\n * If the volume buttons are already being watched, this call has\n * no effect. Call `stopWatching()` first to change the options.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n startWatching(options?: StartWatchingOptions): Promise<void>;\n /**\n * Stop watching the hardware volume buttons.\n *\n * On iOS, this also restores the volume level that was set when\n * watching started if the `suppressVolumeChange` option was enabled.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n stopWatching(): Promise<void>;\n /**\n * Called when a hardware volume button is pressed while watching.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n addListener(\n eventName: 'volumeButtonPressed',\n listenerFunc: (event: VolumeButtonPressedEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Called when the volume level changes while watching.\n *\n * On Android, this is called for changes to the music stream.\n * On iOS, this is called for changes to the media volume and is\n * not called while the `suppressVolumeChange` option is enabled.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n addListener(\n eventName: 'volumeChange',\n listenerFunc: (event: VolumeChangeEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove all listeners for this plugin.\n *\n * @since 0.1.0\n */\n removeAllListeners(): Promise<void>;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface GetVolumeOptions {\n /**\n * The audio stream to get the volume for.\n *\n * Only available on Android.\n *\n * @since 0.1.0\n * @default VolumeStream.Music\n * @example 'music'\n */\n stream?: VolumeStream;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface GetVolumeResult {\n /**\n * The current volume level as a value between `0` and `1`.\n *\n * @since 0.1.0\n * @example 0.5\n */\n volume: number;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface SetVolumeOptions {\n /**\n * The audio stream to set the volume for.\n *\n * Only available on Android.\n *\n * @since 0.1.0\n * @default VolumeStream.Music\n * @example 'music'\n */\n stream?: VolumeStream;\n /**\n * The volume level to set as a value between `0` and `1`.\n *\n * @since 0.1.0\n * @example 0.5\n */\n volume: number;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface StartWatchingOptions {\n /**\n * Whether to keep the volume level unchanged when a hardware volume\n * button is pressed while watching.\n *\n * On Android, the volume key events are consumed so that the system\n * does not apply the volume change or display the volume panel.\n * On iOS, the volume level is reset immediately after each button\n * press and the system volume indicator is hidden. If the volume\n * level is close to the minimum or maximum, it is nudged to a value\n * from which both buttons can still be detected. The original volume\n * level is restored when watching stops.\n *\n * @since 0.1.0\n * @default false\n * @example true\n */\n suppressVolumeChange?: boolean;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface IsWatchingResult {\n /**\n * Whether the hardware volume buttons are currently being watched.\n *\n * @since 0.1.0\n * @example true\n */\n watching: boolean;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface VolumeButtonPressedEvent {\n /**\n * The direction of the pressed hardware volume button.\n *\n * @since 0.1.0\n * @example 'up'\n */\n direction: Direction;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface VolumeChangeEvent {\n /**\n * The new volume level as a value between `0` and `1`.\n *\n * @since 0.1.0\n * @example 0.5\n */\n volume: number;\n}\n\n/**\n * The direction of a hardware volume button.\n *\n * - `up`: The volume up button.\n * - `down`: The volume down button.\n *\n * @since 0.1.0\n */\nexport type Direction = 'down' | 'up';\n\n/**\n * The audio stream of the device.\n *\n * @since 0.1.0\n */\nexport enum VolumeStream {\n /**\n * The audio stream for alarms.\n *\n * @since 0.1.0\n */\n Alarm = 'alarm',\n /**\n * The audio stream for music and media playback.\n *\n * @since 0.1.0\n */\n Music = 'music',\n /**\n * The audio stream for notifications.\n *\n * @since 0.1.0\n */\n Notification = 'notification',\n /**\n * The audio stream for the phone ring.\n *\n * @since 0.1.0\n */\n Ring = 'ring',\n /**\n * The audio stream for system sounds.\n *\n * @since 0.1.0\n */\n System = 'system',\n /**\n * The audio stream for phone calls.\n *\n * @since 0.1.0\n */\n VoiceCall = 'voiceCall',\n}\n\n/**\n * @since 0.1.0\n */\nexport enum ErrorCode {\n /**\n * Do Not Disturb access is required to change the volume of the\n * ring, notification or system stream while Do Not Disturb is active.\n *\n * Only available on Android.\n *\n * @since 0.1.0\n */\n DoNotDisturbAccessRequired = 'DO_NOT_DISTURB_ACCESS_REQUIRED',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,MAAM,GAAG,cAAc,CAAe,QAAQ,EAAE;IACpD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;CACxD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { VolumePlugin } from './definitions';\n\nconst Volume = registerPlugin<VolumePlugin>('Volume', {\n web: () => import('./web').then(m => new m.VolumeWeb()),\n});\n\nexport * from './definitions';\nexport { Volume };\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { GetVolumeResult, IsWatchingResult, VolumePlugin } from './definitions';
|
|
3
|
+
export declare class VolumeWeb extends WebPlugin implements VolumePlugin {
|
|
4
|
+
getVolume(): Promise<GetVolumeResult>;
|
|
5
|
+
isWatching(): Promise<IsWatchingResult>;
|
|
6
|
+
setVolume(): Promise<void>;
|
|
7
|
+
startWatching(): Promise<void>;
|
|
8
|
+
stopWatching(): Promise<void>;
|
|
9
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
export class VolumeWeb extends WebPlugin {
|
|
3
|
+
async getVolume() {
|
|
4
|
+
throw this.unimplemented('Not implemented on web.');
|
|
5
|
+
}
|
|
6
|
+
async isWatching() {
|
|
7
|
+
throw this.unimplemented('Not implemented on web.');
|
|
8
|
+
}
|
|
9
|
+
async setVolume() {
|
|
10
|
+
throw this.unimplemented('Not implemented on web.');
|
|
11
|
+
}
|
|
12
|
+
async startWatching() {
|
|
13
|
+
throw this.unimplemented('Not implemented on web.');
|
|
14
|
+
}
|
|
15
|
+
async stopWatching() {
|
|
16
|
+
throw this.unimplemented('Not implemented on web.');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n GetVolumeResult,\n IsWatchingResult,\n VolumePlugin,\n} from './definitions';\n\nexport class VolumeWeb extends WebPlugin implements VolumePlugin {\n async getVolume(): Promise<GetVolumeResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async isWatching(): Promise<IsWatchingResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async setVolume(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async startWatching(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async stopWatching(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The audio stream of the device.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.1.0
|
|
9
|
+
*/
|
|
10
|
+
exports.VolumeStream = void 0;
|
|
11
|
+
(function (VolumeStream) {
|
|
12
|
+
/**
|
|
13
|
+
* The audio stream for alarms.
|
|
14
|
+
*
|
|
15
|
+
* @since 0.1.0
|
|
16
|
+
*/
|
|
17
|
+
VolumeStream["Alarm"] = "alarm";
|
|
18
|
+
/**
|
|
19
|
+
* The audio stream for music and media playback.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.1.0
|
|
22
|
+
*/
|
|
23
|
+
VolumeStream["Music"] = "music";
|
|
24
|
+
/**
|
|
25
|
+
* The audio stream for notifications.
|
|
26
|
+
*
|
|
27
|
+
* @since 0.1.0
|
|
28
|
+
*/
|
|
29
|
+
VolumeStream["Notification"] = "notification";
|
|
30
|
+
/**
|
|
31
|
+
* The audio stream for the phone ring.
|
|
32
|
+
*
|
|
33
|
+
* @since 0.1.0
|
|
34
|
+
*/
|
|
35
|
+
VolumeStream["Ring"] = "ring";
|
|
36
|
+
/**
|
|
37
|
+
* The audio stream for system sounds.
|
|
38
|
+
*
|
|
39
|
+
* @since 0.1.0
|
|
40
|
+
*/
|
|
41
|
+
VolumeStream["System"] = "system";
|
|
42
|
+
/**
|
|
43
|
+
* The audio stream for phone calls.
|
|
44
|
+
*
|
|
45
|
+
* @since 0.1.0
|
|
46
|
+
*/
|
|
47
|
+
VolumeStream["VoiceCall"] = "voiceCall";
|
|
48
|
+
})(exports.VolumeStream || (exports.VolumeStream = {}));
|
|
49
|
+
/**
|
|
50
|
+
* @since 0.1.0
|
|
51
|
+
*/
|
|
52
|
+
exports.ErrorCode = void 0;
|
|
53
|
+
(function (ErrorCode) {
|
|
54
|
+
/**
|
|
55
|
+
* Do Not Disturb access is required to change the volume of the
|
|
56
|
+
* ring, notification or system stream while Do Not Disturb is active.
|
|
57
|
+
*
|
|
58
|
+
* Only available on Android.
|
|
59
|
+
*
|
|
60
|
+
* @since 0.1.0
|
|
61
|
+
*/
|
|
62
|
+
ErrorCode["DoNotDisturbAccessRequired"] = "DO_NOT_DISTURB_ACCESS_REQUIRED";
|
|
63
|
+
})(exports.ErrorCode || (exports.ErrorCode = {}));
|
|
64
|
+
|
|
65
|
+
const Volume = core.registerPlugin('Volume', {
|
|
66
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.VolumeWeb()),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
class VolumeWeb extends core.WebPlugin {
|
|
70
|
+
async getVolume() {
|
|
71
|
+
throw this.unimplemented('Not implemented on web.');
|
|
72
|
+
}
|
|
73
|
+
async isWatching() {
|
|
74
|
+
throw this.unimplemented('Not implemented on web.');
|
|
75
|
+
}
|
|
76
|
+
async setVolume() {
|
|
77
|
+
throw this.unimplemented('Not implemented on web.');
|
|
78
|
+
}
|
|
79
|
+
async startWatching() {
|
|
80
|
+
throw this.unimplemented('Not implemented on web.');
|
|
81
|
+
}
|
|
82
|
+
async stopWatching() {
|
|
83
|
+
throw this.unimplemented('Not implemented on web.');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
88
|
+
__proto__: null,
|
|
89
|
+
VolumeWeb: VolumeWeb
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
exports.Volume = Volume;
|
|
93
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * The audio stream of the device.\n *\n * @since 0.1.0\n */\nexport var VolumeStream;\n(function (VolumeStream) {\n /**\n * The audio stream for alarms.\n *\n * @since 0.1.0\n */\n VolumeStream[\"Alarm\"] = \"alarm\";\n /**\n * The audio stream for music and media playback.\n *\n * @since 0.1.0\n */\n VolumeStream[\"Music\"] = \"music\";\n /**\n * The audio stream for notifications.\n *\n * @since 0.1.0\n */\n VolumeStream[\"Notification\"] = \"notification\";\n /**\n * The audio stream for the phone ring.\n *\n * @since 0.1.0\n */\n VolumeStream[\"Ring\"] = \"ring\";\n /**\n * The audio stream for system sounds.\n *\n * @since 0.1.0\n */\n VolumeStream[\"System\"] = \"system\";\n /**\n * The audio stream for phone calls.\n *\n * @since 0.1.0\n */\n VolumeStream[\"VoiceCall\"] = \"voiceCall\";\n})(VolumeStream || (VolumeStream = {}));\n/**\n * @since 0.1.0\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n /**\n * Do Not Disturb access is required to change the volume of the\n * ring, notification or system stream while Do Not Disturb is active.\n *\n * Only available on Android.\n *\n * @since 0.1.0\n */\n ErrorCode[\"DoNotDisturbAccessRequired\"] = \"DO_NOT_DISTURB_ACCESS_REQUIRED\";\n})(ErrorCode || (ErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Volume = registerPlugin('Volume', {\n web: () => import('./web').then(m => new m.VolumeWeb()),\n});\nexport * from './definitions';\nexport { Volume };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class VolumeWeb extends WebPlugin {\n async getVolume() {\n throw this.unimplemented('Not implemented on web.');\n }\n async isWatching() {\n throw this.unimplemented('Not implemented on web.');\n }\n async setVolume() {\n throw this.unimplemented('Not implemented on web.');\n }\n async startWatching() {\n throw this.unimplemented('Not implemented on web.');\n }\n async stopWatching() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["VolumeStream","ErrorCode","registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACWA;AACX,CAAC,UAAU,YAAY,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,OAAO;AACnC;AACA;AACA;AACA;AACA;AACA,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,OAAO;AACnC;AACA;AACA;AACA;AACA;AACA,IAAI,YAAY,CAAC,cAAc,CAAC,GAAG,cAAc;AACjD;AACA;AACA;AACA;AACA;AACA,IAAI,YAAY,CAAC,MAAM,CAAC,GAAG,MAAM;AACjC;AACA;AACA;AACA;AACA;AACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;AACrC;AACA;AACA;AACA;AACA;AACA,IAAI,YAAY,CAAC,WAAW,CAAC,GAAG,WAAW;AAC3C,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC;AACvC;AACA;AACA;AACWC;AACX,CAAC,UAAU,SAAS,EAAE;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,4BAA4B,CAAC,GAAG,gCAAgC;AAC9E,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC;;ACzD5B,MAAC,MAAM,GAAGC,mBAAc,CAAC,QAAQ,EAAE;AACxC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;AAC3D,CAAC;;ACFM,MAAM,SAAS,SAASC,cAAS,CAAC;AACzC,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
var capacitorVolume = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The audio stream of the device.
|
|
6
|
+
*
|
|
7
|
+
* @since 0.1.0
|
|
8
|
+
*/
|
|
9
|
+
exports.VolumeStream = void 0;
|
|
10
|
+
(function (VolumeStream) {
|
|
11
|
+
/**
|
|
12
|
+
* The audio stream for alarms.
|
|
13
|
+
*
|
|
14
|
+
* @since 0.1.0
|
|
15
|
+
*/
|
|
16
|
+
VolumeStream["Alarm"] = "alarm";
|
|
17
|
+
/**
|
|
18
|
+
* The audio stream for music and media playback.
|
|
19
|
+
*
|
|
20
|
+
* @since 0.1.0
|
|
21
|
+
*/
|
|
22
|
+
VolumeStream["Music"] = "music";
|
|
23
|
+
/**
|
|
24
|
+
* The audio stream for notifications.
|
|
25
|
+
*
|
|
26
|
+
* @since 0.1.0
|
|
27
|
+
*/
|
|
28
|
+
VolumeStream["Notification"] = "notification";
|
|
29
|
+
/**
|
|
30
|
+
* The audio stream for the phone ring.
|
|
31
|
+
*
|
|
32
|
+
* @since 0.1.0
|
|
33
|
+
*/
|
|
34
|
+
VolumeStream["Ring"] = "ring";
|
|
35
|
+
/**
|
|
36
|
+
* The audio stream for system sounds.
|
|
37
|
+
*
|
|
38
|
+
* @since 0.1.0
|
|
39
|
+
*/
|
|
40
|
+
VolumeStream["System"] = "system";
|
|
41
|
+
/**
|
|
42
|
+
* The audio stream for phone calls.
|
|
43
|
+
*
|
|
44
|
+
* @since 0.1.0
|
|
45
|
+
*/
|
|
46
|
+
VolumeStream["VoiceCall"] = "voiceCall";
|
|
47
|
+
})(exports.VolumeStream || (exports.VolumeStream = {}));
|
|
48
|
+
/**
|
|
49
|
+
* @since 0.1.0
|
|
50
|
+
*/
|
|
51
|
+
exports.ErrorCode = void 0;
|
|
52
|
+
(function (ErrorCode) {
|
|
53
|
+
/**
|
|
54
|
+
* Do Not Disturb access is required to change the volume of the
|
|
55
|
+
* ring, notification or system stream while Do Not Disturb is active.
|
|
56
|
+
*
|
|
57
|
+
* Only available on Android.
|
|
58
|
+
*
|
|
59
|
+
* @since 0.1.0
|
|
60
|
+
*/
|
|
61
|
+
ErrorCode["DoNotDisturbAccessRequired"] = "DO_NOT_DISTURB_ACCESS_REQUIRED";
|
|
62
|
+
})(exports.ErrorCode || (exports.ErrorCode = {}));
|
|
63
|
+
|
|
64
|
+
const Volume = core.registerPlugin('Volume', {
|
|
65
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.VolumeWeb()),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
class VolumeWeb extends core.WebPlugin {
|
|
69
|
+
async getVolume() {
|
|
70
|
+
throw this.unimplemented('Not implemented on web.');
|
|
71
|
+
}
|
|
72
|
+
async isWatching() {
|
|
73
|
+
throw this.unimplemented('Not implemented on web.');
|
|
74
|
+
}
|
|
75
|
+
async setVolume() {
|
|
76
|
+
throw this.unimplemented('Not implemented on web.');
|
|
77
|
+
}
|
|
78
|
+
async startWatching() {
|
|
79
|
+
throw this.unimplemented('Not implemented on web.');
|
|
80
|
+
}
|
|
81
|
+
async stopWatching() {
|
|
82
|
+
throw this.unimplemented('Not implemented on web.');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
87
|
+
__proto__: null,
|
|
88
|
+
VolumeWeb: VolumeWeb
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
exports.Volume = Volume;
|
|
92
|
+
|
|
93
|
+
return exports;
|
|
94
|
+
|
|
95
|
+
})({}, capacitorExports);
|
|
96
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * The audio stream of the device.\n *\n * @since 0.1.0\n */\nexport var VolumeStream;\n(function (VolumeStream) {\n /**\n * The audio stream for alarms.\n *\n * @since 0.1.0\n */\n VolumeStream[\"Alarm\"] = \"alarm\";\n /**\n * The audio stream for music and media playback.\n *\n * @since 0.1.0\n */\n VolumeStream[\"Music\"] = \"music\";\n /**\n * The audio stream for notifications.\n *\n * @since 0.1.0\n */\n VolumeStream[\"Notification\"] = \"notification\";\n /**\n * The audio stream for the phone ring.\n *\n * @since 0.1.0\n */\n VolumeStream[\"Ring\"] = \"ring\";\n /**\n * The audio stream for system sounds.\n *\n * @since 0.1.0\n */\n VolumeStream[\"System\"] = \"system\";\n /**\n * The audio stream for phone calls.\n *\n * @since 0.1.0\n */\n VolumeStream[\"VoiceCall\"] = \"voiceCall\";\n})(VolumeStream || (VolumeStream = {}));\n/**\n * @since 0.1.0\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n /**\n * Do Not Disturb access is required to change the volume of the\n * ring, notification or system stream while Do Not Disturb is active.\n *\n * Only available on Android.\n *\n * @since 0.1.0\n */\n ErrorCode[\"DoNotDisturbAccessRequired\"] = \"DO_NOT_DISTURB_ACCESS_REQUIRED\";\n})(ErrorCode || (ErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Volume = registerPlugin('Volume', {\n web: () => import('./web').then(m => new m.VolumeWeb()),\n});\nexport * from './definitions';\nexport { Volume };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class VolumeWeb extends WebPlugin {\n async getVolume() {\n throw this.unimplemented('Not implemented on web.');\n }\n async isWatching() {\n throw this.unimplemented('Not implemented on web.');\n }\n async setVolume() {\n throw this.unimplemented('Not implemented on web.');\n }\n async startWatching() {\n throw this.unimplemented('Not implemented on web.');\n }\n async stopWatching() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["VolumeStream","ErrorCode","registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;IACA;AACWA;IACX,CAAC,UAAU,YAAY,EAAE;IACzB;IACA;IACA;IACA;IACA;IACA,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,OAAO;IACnC;IACA;IACA;IACA;IACA;IACA,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,OAAO;IACnC;IACA;IACA;IACA;IACA;IACA,IAAI,YAAY,CAAC,cAAc,CAAC,GAAG,cAAc;IACjD;IACA;IACA;IACA;IACA;IACA,IAAI,YAAY,CAAC,MAAM,CAAC,GAAG,MAAM;IACjC;IACA;IACA;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACrC;IACA;IACA;IACA;IACA;IACA,IAAI,YAAY,CAAC,WAAW,CAAC,GAAG,WAAW;IAC3C,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC;IACvC;IACA;IACA;AACWC;IACX,CAAC,UAAU,SAAS,EAAE;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,4BAA4B,CAAC,GAAG,gCAAgC;IAC9E,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC;;ACzD5B,UAAC,MAAM,GAAGC,mBAAc,CAAC,QAAQ,EAAE;IACxC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3D,CAAC;;ICFM,MAAM,SAAS,SAASC,cAAS,CAAC;IACzC,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,aAAa,GAAG;IAC1B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class VolumeButtonPressedEvent: NSObject, Result {
|
|
5
|
+
let direction: String
|
|
6
|
+
|
|
7
|
+
init(direction: String) {
|
|
8
|
+
self.direction = direction
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@objc public func toJSObject() -> AnyObject {
|
|
12
|
+
var result = JSObject()
|
|
13
|
+
result["direction"] = direction
|
|
14
|
+
return result as AnyObject
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class VolumeChangeEvent: NSObject, Result {
|
|
5
|
+
let volume: Float
|
|
6
|
+
|
|
7
|
+
init(volume: Float) {
|
|
8
|
+
self.volume = volume
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@objc public func toJSObject() -> AnyObject {
|
|
12
|
+
var result = JSObject()
|
|
13
|
+
result["volume"] = volume
|
|
14
|
+
return result as AnyObject
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class SetVolumeOptions: NSObject {
|
|
5
|
+
let volume: Float
|
|
6
|
+
|
|
7
|
+
init(_ call: CAPPluginCall) throws {
|
|
8
|
+
self.volume = try SetVolumeOptions.getVolumeFromCall(call)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
private static func getVolumeFromCall(_ call: CAPPluginCall) throws -> Float {
|
|
12
|
+
guard let volume = call.getFloat("volume") else {
|
|
13
|
+
throw CustomError.volumeMissing
|
|
14
|
+
}
|
|
15
|
+
guard volume >= 0, volume <= 1 else {
|
|
16
|
+
throw CustomError.volumeInvalid
|
|
17
|
+
}
|
|
18
|
+
return volume
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class GetVolumeResult: NSObject, Result {
|
|
5
|
+
let volume: Float
|
|
6
|
+
|
|
7
|
+
init(volume: Float) {
|
|
8
|
+
self.volume = volume
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@objc public func toJSObject() -> AnyObject {
|
|
12
|
+
var result = JSObject()
|
|
13
|
+
result["volume"] = volume
|
|
14
|
+
return result as AnyObject
|
|
15
|
+
}
|
|
16
|
+
}
|