capacitor-plugin-recorder 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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst RecorderPlayer = registerPlugin('RecorderPlayer', {\n web: () => import('./web').then((m) => new m.RecorderPlayerWeb()),\n});\nexport * from './definitions';\nexport { RecorderPlayer };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class RecorderPlayerWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.mediaRecorder = null;\n this.audioChunks = [];\n this.recordingStartTime = 0;\n this.pausedDuration = 0;\n this.recordingStatus = 'stopped';\n // Multiple players support\n this.players = new Map();\n this.playerIdCounter = 0;\n }\n generatePlayerId() {\n return `player-${++this.playerIdCounter}-${Date.now()}`;\n }\n async requestPermission() {\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n // Stop the stream immediately, we just needed permission\n stream.getTracks().forEach(track => track.stop());\n return { microphone: 'granted' };\n }\n catch (error) {\n // Check if it's a permission denied error\n if (error.name === 'NotAllowedError') {\n return { microphone: 'denied' };\n }\n return { microphone: 'denied' };\n }\n }\n async checkPermission() {\n try {\n const result = await navigator.permissions.query({ name: 'microphone' });\n if (result.state === 'granted') {\n return { microphone: 'granted' };\n }\n else if (result.state === 'denied') {\n return { microphone: 'denied' };\n }\n return { microphone: 'prompt' };\n }\n catch (_a) {\n // Fallback for browsers that don't support permissions API for microphone\n return { microphone: 'prompt' };\n }\n }\n async startRecord(options) {\n console.log('Starting recording with options:', options);\n if (this.recordingStatus === 'recording') {\n throw new Error('Recording already in progress');\n }\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n this.audioChunks = [];\n this.pausedDuration = 0;\n this.mediaRecorder = new MediaRecorder(stream);\n this.mediaRecorder.ondataavailable = (event) => {\n if (event.data.size > 0) {\n this.audioChunks.push(event.data);\n }\n };\n this.mediaRecorder.start(100);\n this.recordingStartTime = Date.now();\n this.recordingStatus = 'recording';\n this.notifyRecordingStatusChange();\n }\n catch (error) {\n throw new Error('Failed to start recording: ' + error.message);\n }\n }\n async stopRecord() {\n if (!this.mediaRecorder || this.recordingStatus === 'stopped') {\n throw new Error('No recording in progress');\n }\n return new Promise((resolve, reject) => {\n if (!this.mediaRecorder) {\n reject(new Error('No recording in progress'));\n return;\n }\n this.mediaRecorder.onstop = () => {\n var _a;\n const duration = Date.now() - this.recordingStartTime - this.pausedDuration;\n const blob = new Blob(this.audioChunks, { type: 'audio/webm' });\n const path = URL.createObjectURL(blob);\n (_a = this.mediaRecorder) === null || _a === void 0 ? void 0 : _a.stream.getTracks().forEach(track => track.stop());\n this.recordingStatus = 'stopped';\n this.notifyRecordingStatusChange();\n resolve({ path, duration });\n };\n this.mediaRecorder.stop();\n });\n }\n async pauseRecord() {\n if (!this.mediaRecorder || this.recordingStatus !== 'recording') {\n throw new Error('No active recording to pause');\n }\n this.mediaRecorder.pause();\n this.pausedDuration = Date.now() - this.recordingStartTime;\n this.recordingStatus = 'paused';\n this.notifyRecordingStatusChange();\n }\n async resumeRecord() {\n if (!this.mediaRecorder || this.recordingStatus !== 'paused') {\n throw new Error('No paused recording to resume');\n }\n this.mediaRecorder.resume();\n this.recordingStartTime = Date.now() - this.pausedDuration;\n this.recordingStatus = 'recording';\n this.notifyRecordingStatusChange();\n }\n async preparePlay(options) {\n if (!options.path) {\n throw new Error('Audio path is required');\n }\n const playerId = this.generatePlayerId();\n const audioElement = new Audio(options.path);\n return new Promise((resolve, reject) => {\n audioElement.onloadedmetadata = () => {\n var _a;\n const duration = Math.round(((_a = audioElement.duration) !== null && _a !== void 0 ? _a : 0) * 1000);\n const playerState = {\n audioElement,\n status: 'stopped',\n path: options.path,\n };\n this.players.set(playerId, playerState);\n this.setupAudioEventListeners(playerId);\n this.notifyPlaybackStatusChange(playerId);\n resolve({ playerId, duration });\n };\n audioElement.onerror = () => {\n reject(new Error('Failed to load audio file'));\n };\n audioElement.load();\n });\n }\n async play(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n throw new Error(`No player found with ID: ${options.playerId}`);\n }\n try {\n await player.audioElement.play();\n player.status = 'playing';\n this.notifyPlaybackStatusChange(options.playerId);\n }\n catch (error) {\n throw new Error('Failed to play audio: ' + error.message);\n }\n }\n async pausePlay(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n throw new Error(`No player found with ID: ${options.playerId}`);\n }\n if (player.status !== 'playing') {\n throw new Error('No audio playing to pause');\n }\n player.audioElement.pause();\n player.status = 'paused';\n this.notifyPlaybackStatusChange(options.playerId);\n }\n async resumePlay(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n throw new Error(`No player found with ID: ${options.playerId}`);\n }\n if (player.status !== 'paused') {\n throw new Error('No paused audio to resume');\n }\n await player.audioElement.play();\n player.status = 'playing';\n this.notifyPlaybackStatusChange(options.playerId);\n }\n async stopPlay(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n throw new Error(`No player found with ID: ${options.playerId}`);\n }\n player.audioElement.pause();\n player.audioElement.currentTime = 0;\n player.status = 'stopped';\n this.notifyPlaybackStatusChange(options.playerId);\n }\n async seekTo(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n throw new Error(`No player found with ID: ${options.playerId}`);\n }\n const positionInSeconds = options.position / 1000;\n if (positionInSeconds < 0 || positionInSeconds > player.audioElement.duration) {\n throw new Error('Invalid seek position');\n }\n player.audioElement.currentTime = positionInSeconds;\n this.notifyPlaybackStatusChange(options.playerId);\n }\n async getPlaybackStatus(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n throw new Error(`No player found with ID: ${options.playerId}`);\n }\n return {\n playerId: options.playerId,\n status: player.status,\n currentPosition: Math.round(player.audioElement.currentTime * 1000),\n duration: Math.round(player.audioElement.duration * 1000),\n };\n }\n async getRecordingStatus() {\n let duration = 0;\n if (this.recordingStatus === 'recording') {\n duration = Date.now() - this.recordingStartTime;\n }\n else if (this.recordingStatus === 'paused') {\n duration = this.pausedDuration;\n }\n return {\n status: this.recordingStatus,\n duration,\n };\n }\n async destroyPlayer(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n return; // Already destroyed or never existed\n }\n player.audioElement.pause();\n player.audioElement.src = '';\n player.audioElement.load();\n this.players.delete(options.playerId);\n }\n setupAudioEventListeners(playerId) {\n const player = this.players.get(playerId);\n if (!player)\n return;\n player.audioElement.onplay = () => {\n const p = this.players.get(playerId);\n if (p) {\n p.status = 'playing';\n this.notifyPlaybackStatusChange(playerId);\n }\n };\n player.audioElement.onpause = () => {\n const p = this.players.get(playerId);\n // Only set to paused if currently playing (not stopped or ended)\n if (p && p.status === 'playing') {\n p.status = 'paused';\n this.notifyPlaybackStatusChange(playerId);\n }\n };\n player.audioElement.onended = () => {\n const p = this.players.get(playerId);\n if (p) {\n p.status = 'ended';\n this.notifyPlaybackStatusChange(playerId);\n }\n };\n player.audioElement.ontimeupdate = () => {\n const p = this.players.get(playerId);\n if (p && p.status === 'playing') {\n this.notifyPlaybackStatusChange(playerId);\n }\n };\n }\n notifyRecordingStatusChange() {\n this.getRecordingStatus().then(status => {\n this.notifyListeners('recordingStatusChange', status);\n });\n }\n notifyPlaybackStatusChange(playerId) {\n this.getPlaybackStatus({ playerId }).then(status => {\n this.notifyListeners('playbackStatusChange', status);\n }).catch(() => {\n // Player may have been destroyed\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;AACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACrE,CAAC;;ACFM,MAAM,iBAAiB,SAASC,cAAS,CAAC;AACjD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,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Player = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ const RecorderPlayer = core.registerPlugin('RecorderPlayer', {
5
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.RecorderPlayerWeb()),
6
+ });
7
+
8
+ class RecorderPlayerWeb extends core.WebPlugin {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.mediaRecorder = null;
12
+ this.audioChunks = [];
13
+ this.recordingStartTime = 0;
14
+ this.pausedDuration = 0;
15
+ this.recordingStatus = 'stopped';
16
+ // Multiple players support
17
+ this.players = new Map();
18
+ this.playerIdCounter = 0;
19
+ }
20
+ generatePlayerId() {
21
+ return `player-${++this.playerIdCounter}-${Date.now()}`;
22
+ }
23
+ async requestPermission() {
24
+ try {
25
+ const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
26
+ // Stop the stream immediately, we just needed permission
27
+ stream.getTracks().forEach(track => track.stop());
28
+ return { microphone: 'granted' };
29
+ }
30
+ catch (error) {
31
+ // Check if it's a permission denied error
32
+ if (error.name === 'NotAllowedError') {
33
+ return { microphone: 'denied' };
34
+ }
35
+ return { microphone: 'denied' };
36
+ }
37
+ }
38
+ async checkPermission() {
39
+ try {
40
+ const result = await navigator.permissions.query({ name: 'microphone' });
41
+ if (result.state === 'granted') {
42
+ return { microphone: 'granted' };
43
+ }
44
+ else if (result.state === 'denied') {
45
+ return { microphone: 'denied' };
46
+ }
47
+ return { microphone: 'prompt' };
48
+ }
49
+ catch (_a) {
50
+ // Fallback for browsers that don't support permissions API for microphone
51
+ return { microphone: 'prompt' };
52
+ }
53
+ }
54
+ async startRecord(options) {
55
+ console.log('Starting recording with options:', options);
56
+ if (this.recordingStatus === 'recording') {
57
+ throw new Error('Recording already in progress');
58
+ }
59
+ try {
60
+ const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
61
+ this.audioChunks = [];
62
+ this.pausedDuration = 0;
63
+ this.mediaRecorder = new MediaRecorder(stream);
64
+ this.mediaRecorder.ondataavailable = (event) => {
65
+ if (event.data.size > 0) {
66
+ this.audioChunks.push(event.data);
67
+ }
68
+ };
69
+ this.mediaRecorder.start(100);
70
+ this.recordingStartTime = Date.now();
71
+ this.recordingStatus = 'recording';
72
+ this.notifyRecordingStatusChange();
73
+ }
74
+ catch (error) {
75
+ throw new Error('Failed to start recording: ' + error.message);
76
+ }
77
+ }
78
+ async stopRecord() {
79
+ if (!this.mediaRecorder || this.recordingStatus === 'stopped') {
80
+ throw new Error('No recording in progress');
81
+ }
82
+ return new Promise((resolve, reject) => {
83
+ if (!this.mediaRecorder) {
84
+ reject(new Error('No recording in progress'));
85
+ return;
86
+ }
87
+ this.mediaRecorder.onstop = () => {
88
+ var _a;
89
+ const duration = Date.now() - this.recordingStartTime - this.pausedDuration;
90
+ const blob = new Blob(this.audioChunks, { type: 'audio/webm' });
91
+ const path = URL.createObjectURL(blob);
92
+ (_a = this.mediaRecorder) === null || _a === void 0 ? void 0 : _a.stream.getTracks().forEach(track => track.stop());
93
+ this.recordingStatus = 'stopped';
94
+ this.notifyRecordingStatusChange();
95
+ resolve({ path, duration });
96
+ };
97
+ this.mediaRecorder.stop();
98
+ });
99
+ }
100
+ async pauseRecord() {
101
+ if (!this.mediaRecorder || this.recordingStatus !== 'recording') {
102
+ throw new Error('No active recording to pause');
103
+ }
104
+ this.mediaRecorder.pause();
105
+ this.pausedDuration = Date.now() - this.recordingStartTime;
106
+ this.recordingStatus = 'paused';
107
+ this.notifyRecordingStatusChange();
108
+ }
109
+ async resumeRecord() {
110
+ if (!this.mediaRecorder || this.recordingStatus !== 'paused') {
111
+ throw new Error('No paused recording to resume');
112
+ }
113
+ this.mediaRecorder.resume();
114
+ this.recordingStartTime = Date.now() - this.pausedDuration;
115
+ this.recordingStatus = 'recording';
116
+ this.notifyRecordingStatusChange();
117
+ }
118
+ async preparePlay(options) {
119
+ if (!options.path) {
120
+ throw new Error('Audio path is required');
121
+ }
122
+ const playerId = this.generatePlayerId();
123
+ const audioElement = new Audio(options.path);
124
+ return new Promise((resolve, reject) => {
125
+ audioElement.onloadedmetadata = () => {
126
+ var _a;
127
+ const duration = Math.round(((_a = audioElement.duration) !== null && _a !== void 0 ? _a : 0) * 1000);
128
+ const playerState = {
129
+ audioElement,
130
+ status: 'stopped',
131
+ path: options.path,
132
+ };
133
+ this.players.set(playerId, playerState);
134
+ this.setupAudioEventListeners(playerId);
135
+ this.notifyPlaybackStatusChange(playerId);
136
+ resolve({ playerId, duration });
137
+ };
138
+ audioElement.onerror = () => {
139
+ reject(new Error('Failed to load audio file'));
140
+ };
141
+ audioElement.load();
142
+ });
143
+ }
144
+ async play(options) {
145
+ const player = this.players.get(options.playerId);
146
+ if (!player) {
147
+ throw new Error(`No player found with ID: ${options.playerId}`);
148
+ }
149
+ try {
150
+ await player.audioElement.play();
151
+ player.status = 'playing';
152
+ this.notifyPlaybackStatusChange(options.playerId);
153
+ }
154
+ catch (error) {
155
+ throw new Error('Failed to play audio: ' + error.message);
156
+ }
157
+ }
158
+ async pausePlay(options) {
159
+ const player = this.players.get(options.playerId);
160
+ if (!player) {
161
+ throw new Error(`No player found with ID: ${options.playerId}`);
162
+ }
163
+ if (player.status !== 'playing') {
164
+ throw new Error('No audio playing to pause');
165
+ }
166
+ player.audioElement.pause();
167
+ player.status = 'paused';
168
+ this.notifyPlaybackStatusChange(options.playerId);
169
+ }
170
+ async resumePlay(options) {
171
+ const player = this.players.get(options.playerId);
172
+ if (!player) {
173
+ throw new Error(`No player found with ID: ${options.playerId}`);
174
+ }
175
+ if (player.status !== 'paused') {
176
+ throw new Error('No paused audio to resume');
177
+ }
178
+ await player.audioElement.play();
179
+ player.status = 'playing';
180
+ this.notifyPlaybackStatusChange(options.playerId);
181
+ }
182
+ async stopPlay(options) {
183
+ const player = this.players.get(options.playerId);
184
+ if (!player) {
185
+ throw new Error(`No player found with ID: ${options.playerId}`);
186
+ }
187
+ player.audioElement.pause();
188
+ player.audioElement.currentTime = 0;
189
+ player.status = 'stopped';
190
+ this.notifyPlaybackStatusChange(options.playerId);
191
+ }
192
+ async seekTo(options) {
193
+ const player = this.players.get(options.playerId);
194
+ if (!player) {
195
+ throw new Error(`No player found with ID: ${options.playerId}`);
196
+ }
197
+ const positionInSeconds = options.position / 1000;
198
+ if (positionInSeconds < 0 || positionInSeconds > player.audioElement.duration) {
199
+ throw new Error('Invalid seek position');
200
+ }
201
+ player.audioElement.currentTime = positionInSeconds;
202
+ this.notifyPlaybackStatusChange(options.playerId);
203
+ }
204
+ async getPlaybackStatus(options) {
205
+ const player = this.players.get(options.playerId);
206
+ if (!player) {
207
+ throw new Error(`No player found with ID: ${options.playerId}`);
208
+ }
209
+ return {
210
+ playerId: options.playerId,
211
+ status: player.status,
212
+ currentPosition: Math.round(player.audioElement.currentTime * 1000),
213
+ duration: Math.round(player.audioElement.duration * 1000),
214
+ };
215
+ }
216
+ async getRecordingStatus() {
217
+ let duration = 0;
218
+ if (this.recordingStatus === 'recording') {
219
+ duration = Date.now() - this.recordingStartTime;
220
+ }
221
+ else if (this.recordingStatus === 'paused') {
222
+ duration = this.pausedDuration;
223
+ }
224
+ return {
225
+ status: this.recordingStatus,
226
+ duration,
227
+ };
228
+ }
229
+ async destroyPlayer(options) {
230
+ const player = this.players.get(options.playerId);
231
+ if (!player) {
232
+ return; // Already destroyed or never existed
233
+ }
234
+ player.audioElement.pause();
235
+ player.audioElement.src = '';
236
+ player.audioElement.load();
237
+ this.players.delete(options.playerId);
238
+ }
239
+ setupAudioEventListeners(playerId) {
240
+ const player = this.players.get(playerId);
241
+ if (!player)
242
+ return;
243
+ player.audioElement.onplay = () => {
244
+ const p = this.players.get(playerId);
245
+ if (p) {
246
+ p.status = 'playing';
247
+ this.notifyPlaybackStatusChange(playerId);
248
+ }
249
+ };
250
+ player.audioElement.onpause = () => {
251
+ const p = this.players.get(playerId);
252
+ // Only set to paused if currently playing (not stopped or ended)
253
+ if (p && p.status === 'playing') {
254
+ p.status = 'paused';
255
+ this.notifyPlaybackStatusChange(playerId);
256
+ }
257
+ };
258
+ player.audioElement.onended = () => {
259
+ const p = this.players.get(playerId);
260
+ if (p) {
261
+ p.status = 'ended';
262
+ this.notifyPlaybackStatusChange(playerId);
263
+ }
264
+ };
265
+ player.audioElement.ontimeupdate = () => {
266
+ const p = this.players.get(playerId);
267
+ if (p && p.status === 'playing') {
268
+ this.notifyPlaybackStatusChange(playerId);
269
+ }
270
+ };
271
+ }
272
+ notifyRecordingStatusChange() {
273
+ this.getRecordingStatus().then(status => {
274
+ this.notifyListeners('recordingStatusChange', status);
275
+ });
276
+ }
277
+ notifyPlaybackStatusChange(playerId) {
278
+ this.getPlaybackStatus({ playerId }).then(status => {
279
+ this.notifyListeners('playbackStatusChange', status);
280
+ }).catch(() => {
281
+ // Player may have been destroyed
282
+ });
283
+ }
284
+ }
285
+
286
+ var web = /*#__PURE__*/Object.freeze({
287
+ __proto__: null,
288
+ RecorderPlayerWeb: RecorderPlayerWeb
289
+ });
290
+
291
+ exports.RecorderPlayer = RecorderPlayer;
292
+
293
+ return exports;
294
+
295
+ })({}, capacitorExports);
296
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst RecorderPlayer = registerPlugin('RecorderPlayer', {\n web: () => import('./web').then((m) => new m.RecorderPlayerWeb()),\n});\nexport * from './definitions';\nexport { RecorderPlayer };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class RecorderPlayerWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.mediaRecorder = null;\n this.audioChunks = [];\n this.recordingStartTime = 0;\n this.pausedDuration = 0;\n this.recordingStatus = 'stopped';\n // Multiple players support\n this.players = new Map();\n this.playerIdCounter = 0;\n }\n generatePlayerId() {\n return `player-${++this.playerIdCounter}-${Date.now()}`;\n }\n async requestPermission() {\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n // Stop the stream immediately, we just needed permission\n stream.getTracks().forEach(track => track.stop());\n return { microphone: 'granted' };\n }\n catch (error) {\n // Check if it's a permission denied error\n if (error.name === 'NotAllowedError') {\n return { microphone: 'denied' };\n }\n return { microphone: 'denied' };\n }\n }\n async checkPermission() {\n try {\n const result = await navigator.permissions.query({ name: 'microphone' });\n if (result.state === 'granted') {\n return { microphone: 'granted' };\n }\n else if (result.state === 'denied') {\n return { microphone: 'denied' };\n }\n return { microphone: 'prompt' };\n }\n catch (_a) {\n // Fallback for browsers that don't support permissions API for microphone\n return { microphone: 'prompt' };\n }\n }\n async startRecord(options) {\n console.log('Starting recording with options:', options);\n if (this.recordingStatus === 'recording') {\n throw new Error('Recording already in progress');\n }\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n this.audioChunks = [];\n this.pausedDuration = 0;\n this.mediaRecorder = new MediaRecorder(stream);\n this.mediaRecorder.ondataavailable = (event) => {\n if (event.data.size > 0) {\n this.audioChunks.push(event.data);\n }\n };\n this.mediaRecorder.start(100);\n this.recordingStartTime = Date.now();\n this.recordingStatus = 'recording';\n this.notifyRecordingStatusChange();\n }\n catch (error) {\n throw new Error('Failed to start recording: ' + error.message);\n }\n }\n async stopRecord() {\n if (!this.mediaRecorder || this.recordingStatus === 'stopped') {\n throw new Error('No recording in progress');\n }\n return new Promise((resolve, reject) => {\n if (!this.mediaRecorder) {\n reject(new Error('No recording in progress'));\n return;\n }\n this.mediaRecorder.onstop = () => {\n var _a;\n const duration = Date.now() - this.recordingStartTime - this.pausedDuration;\n const blob = new Blob(this.audioChunks, { type: 'audio/webm' });\n const path = URL.createObjectURL(blob);\n (_a = this.mediaRecorder) === null || _a === void 0 ? void 0 : _a.stream.getTracks().forEach(track => track.stop());\n this.recordingStatus = 'stopped';\n this.notifyRecordingStatusChange();\n resolve({ path, duration });\n };\n this.mediaRecorder.stop();\n });\n }\n async pauseRecord() {\n if (!this.mediaRecorder || this.recordingStatus !== 'recording') {\n throw new Error('No active recording to pause');\n }\n this.mediaRecorder.pause();\n this.pausedDuration = Date.now() - this.recordingStartTime;\n this.recordingStatus = 'paused';\n this.notifyRecordingStatusChange();\n }\n async resumeRecord() {\n if (!this.mediaRecorder || this.recordingStatus !== 'paused') {\n throw new Error('No paused recording to resume');\n }\n this.mediaRecorder.resume();\n this.recordingStartTime = Date.now() - this.pausedDuration;\n this.recordingStatus = 'recording';\n this.notifyRecordingStatusChange();\n }\n async preparePlay(options) {\n if (!options.path) {\n throw new Error('Audio path is required');\n }\n const playerId = this.generatePlayerId();\n const audioElement = new Audio(options.path);\n return new Promise((resolve, reject) => {\n audioElement.onloadedmetadata = () => {\n var _a;\n const duration = Math.round(((_a = audioElement.duration) !== null && _a !== void 0 ? _a : 0) * 1000);\n const playerState = {\n audioElement,\n status: 'stopped',\n path: options.path,\n };\n this.players.set(playerId, playerState);\n this.setupAudioEventListeners(playerId);\n this.notifyPlaybackStatusChange(playerId);\n resolve({ playerId, duration });\n };\n audioElement.onerror = () => {\n reject(new Error('Failed to load audio file'));\n };\n audioElement.load();\n });\n }\n async play(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n throw new Error(`No player found with ID: ${options.playerId}`);\n }\n try {\n await player.audioElement.play();\n player.status = 'playing';\n this.notifyPlaybackStatusChange(options.playerId);\n }\n catch (error) {\n throw new Error('Failed to play audio: ' + error.message);\n }\n }\n async pausePlay(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n throw new Error(`No player found with ID: ${options.playerId}`);\n }\n if (player.status !== 'playing') {\n throw new Error('No audio playing to pause');\n }\n player.audioElement.pause();\n player.status = 'paused';\n this.notifyPlaybackStatusChange(options.playerId);\n }\n async resumePlay(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n throw new Error(`No player found with ID: ${options.playerId}`);\n }\n if (player.status !== 'paused') {\n throw new Error('No paused audio to resume');\n }\n await player.audioElement.play();\n player.status = 'playing';\n this.notifyPlaybackStatusChange(options.playerId);\n }\n async stopPlay(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n throw new Error(`No player found with ID: ${options.playerId}`);\n }\n player.audioElement.pause();\n player.audioElement.currentTime = 0;\n player.status = 'stopped';\n this.notifyPlaybackStatusChange(options.playerId);\n }\n async seekTo(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n throw new Error(`No player found with ID: ${options.playerId}`);\n }\n const positionInSeconds = options.position / 1000;\n if (positionInSeconds < 0 || positionInSeconds > player.audioElement.duration) {\n throw new Error('Invalid seek position');\n }\n player.audioElement.currentTime = positionInSeconds;\n this.notifyPlaybackStatusChange(options.playerId);\n }\n async getPlaybackStatus(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n throw new Error(`No player found with ID: ${options.playerId}`);\n }\n return {\n playerId: options.playerId,\n status: player.status,\n currentPosition: Math.round(player.audioElement.currentTime * 1000),\n duration: Math.round(player.audioElement.duration * 1000),\n };\n }\n async getRecordingStatus() {\n let duration = 0;\n if (this.recordingStatus === 'recording') {\n duration = Date.now() - this.recordingStartTime;\n }\n else if (this.recordingStatus === 'paused') {\n duration = this.pausedDuration;\n }\n return {\n status: this.recordingStatus,\n duration,\n };\n }\n async destroyPlayer(options) {\n const player = this.players.get(options.playerId);\n if (!player) {\n return; // Already destroyed or never existed\n }\n player.audioElement.pause();\n player.audioElement.src = '';\n player.audioElement.load();\n this.players.delete(options.playerId);\n }\n setupAudioEventListeners(playerId) {\n const player = this.players.get(playerId);\n if (!player)\n return;\n player.audioElement.onplay = () => {\n const p = this.players.get(playerId);\n if (p) {\n p.status = 'playing';\n this.notifyPlaybackStatusChange(playerId);\n }\n };\n player.audioElement.onpause = () => {\n const p = this.players.get(playerId);\n // Only set to paused if currently playing (not stopped or ended)\n if (p && p.status === 'playing') {\n p.status = 'paused';\n this.notifyPlaybackStatusChange(playerId);\n }\n };\n player.audioElement.onended = () => {\n const p = this.players.get(playerId);\n if (p) {\n p.status = 'ended';\n this.notifyPlaybackStatusChange(playerId);\n }\n };\n player.audioElement.ontimeupdate = () => {\n const p = this.players.get(playerId);\n if (p && p.status === 'playing') {\n this.notifyPlaybackStatusChange(playerId);\n }\n };\n }\n notifyRecordingStatusChange() {\n this.getRecordingStatus().then(status => {\n this.notifyListeners('recordingStatusChange', status);\n });\n }\n notifyPlaybackStatusChange(playerId) {\n this.getPlaybackStatus({ playerId }).then(status => {\n this.notifyListeners('playbackStatusChange', status);\n }).catch(() => {\n // Player may have been destroyed\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;IACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACrE,CAAC;;ICFM,MAAM,iBAAiB,SAASC,cAAS,CAAC;IACjD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;IAC3B,QAAQ,IAAI,CAAC,aAAa,GAAG,IAAI;IACjC,QAAQ,IAAI,CAAC,WAAW,GAAG,EAAE;IAC7B,QAAQ,IAAI,CAAC,kBAAkB,GAAG,CAAC;IACnC,QAAQ,IAAI,CAAC,cAAc,GAAG,CAAC;IAC/B,QAAQ,IAAI,CAAC,eAAe,GAAG,SAAS;IACxC;IACA,QAAQ,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE;IAChC,QAAQ,IAAI,CAAC,eAAe,GAAG,CAAC;IAChC,IAAI;IACJ,IAAI,gBAAgB,GAAG;IACvB,QAAQ,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/D,IAAI;IACJ,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,IAAI;IACZ,YAAY,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACr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