@capgo/native-audio 6.4.17 → 6.4.18

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -252,7 +252,7 @@ Load an audio file
252
252
  ### isPreloaded(...)
253
253
 
254
254
  ```typescript
255
- isPreloaded(options: PreloadOptions) => Promise<boolean>
255
+ isPreloaded(options: PreloadOptions) => Promise<{ found: boolean; }>
256
256
  ```
257
257
 
258
258
  Check if an audio file is preloaded
@@ -261,7 +261,7 @@ Check if an audio file is preloaded
261
261
  | ------------- | --------------------------------------------------------- |
262
262
  | **`options`** | <code><a href="#preloadoptions">PreloadOptions</a></code> |
263
263
 
264
- **Returns:** <code>Promise&lt;boolean&gt;</code>
264
+ **Returns:** <code>Promise&lt;{ found: boolean; }&gt;</code>
265
265
 
266
266
  **Since:** 6.1.0
267
267
 
package/dist/docs.json CHANGED
@@ -75,7 +75,7 @@
75
75
  },
76
76
  {
77
77
  "name": "isPreloaded",
78
- "signature": "(options: PreloadOptions) => Promise<boolean>",
78
+ "signature": "(options: PreloadOptions) => Promise<{ found: boolean; }>",
79
79
  "parameters": [
80
80
  {
81
81
  "name": "options",
@@ -83,7 +83,7 @@
83
83
  "type": "PreloadOptions"
84
84
  }
85
85
  ],
86
- "returns": "Promise<boolean>",
86
+ "returns": "Promise<{ found: boolean; }>",
87
87
  "tags": [
88
88
  {
89
89
  "name": "since",
@@ -106,7 +106,9 @@ export interface NativeAudio {
106
106
  * @param option {@link Assets}
107
107
  * @returns {Promise<boolean>}
108
108
  */
109
- isPreloaded(options: PreloadOptions): Promise<boolean>;
109
+ isPreloaded(options: PreloadOptions): Promise<{
110
+ found: boolean;
111
+ }>;
110
112
  /**
111
113
  * Play an audio file
112
114
  * @since 5.0.0
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface CompletedEvent {\n /**\n * Emit when a play completes\n *\n * @since 5.0.0\n */\n assetId: string;\n}\nexport type CompletedListener = (state: CompletedEvent) => void;\nexport interface Assets {\n /**\n * Asset Id, unique identifier of the file\n */\n assetId: string;\n}\nexport interface AssetVolume {\n /**\n * Asset Id, unique identifier of the file\n */\n assetId: string;\n /**\n * Volume of the audio, between 0.1 and 1.0\n */\n volume: number;\n}\n\nexport interface AssetRate {\n /**\n * Asset Id, unique identifier of the file\n */\n assetId: string;\n /**\n * Rate of the audio, between 0.1 and 1.0\n */\n rate: number;\n}\n\nexport interface AssetPlayOptions {\n /**\n * Asset Id, unique identifier of the file\n */\n assetId: string;\n /**\n * Time to start playing the audio, in milliseconds\n */\n time?: number;\n /**\n * Delay to start playing the audio, in milliseconds\n */\n delay?: number;\n}\n\nexport interface ConfigureOptions {\n /**\n * Play the audio with Fade effect, only available for IOS\n */\n fade?: boolean;\n /**\n * focus the audio with Audio Focus\n */\n focus?: boolean;\n /**\n * Play the audio in the background\n */\n background?: boolean;\n}\n\nexport interface PreloadOptions {\n /**\n * Path to the audio file, relative path of the file, absolute url (file://) or remote url (https://)\n */\n assetPath: string;\n /**\n * Asset Id, unique identifier of the file\n */\n assetId: string;\n /**\n * Volume of the audio, between 0.1 and 1.0\n */\n volume?: number;\n /**\n * Audio channel number, default is 1\n */\n audioChannelNum?: number;\n /**\n * Is the audio file a URL, pass true if assetPath is a `file://` url\n */\n isUrl?: boolean;\n}\n\nexport interface NativeAudio {\n /**\n * Configure the audio player\n * @since 5.0.0\n * @param option {@link ConfigureOptions}\n * @returns\n */\n configure(options: ConfigureOptions): Promise<void>;\n /**\n * Load an audio file\n * @since 5.0.0\n * @param option {@link PreloadOptions}\n * @returns\n */\n preload(options: PreloadOptions): Promise<void>;\n /**\n * Check if an audio file is preloaded\n *\n * @since 6.1.0\n * @param option {@link Assets}\n * @returns {Promise<boolean>}\n */\n isPreloaded(options: PreloadOptions): Promise<boolean>;\n /**\n * Play an audio file\n * @since 5.0.0\n * @param option {@link PlayOptions}\n * @returns\n */\n play(options: {\n assetId: string;\n time?: number;\n delay?: number;\n }): Promise<void>;\n /**\n * Pause an audio file\n * @since 5.0.0\n * @param option {@link Assets}\n * @returns\n */\n pause(options: Assets): Promise<void>;\n /**\n * Resume an audio file\n * @since 5.0.0\n * @param option {@link Assets}\n * @returns\n */\n resume(options: Assets): Promise<void>;\n /**\n * Stop an audio file\n * @since 5.0.0\n * @param option {@link Assets}\n * @returns\n */\n loop(options: Assets): Promise<void>;\n /**\n * Stop an audio file\n * @since 5.0.0\n * @param option {@link Assets}\n * @returns\n */\n stop(options: Assets): Promise<void>;\n /**\n * Unload an audio file\n * @since 5.0.0\n * @param option {@link Assets}\n * @returns\n */\n unload(options: Assets): Promise<void>;\n /**\n * Set the volume of an audio file\n * @since 5.0.0\n * @param option {@link AssetVolume}\n * @returns {Promise<void>}\n */\n setVolume(options: { assetId: string; volume: number }): Promise<void>;\n /**\n * Set the rate of an audio file\n * @since 5.0.0\n * @param option {@link AssetPlayOptions}\n * @returns {Promise<void>}\n */\n setRate(options: { assetId: string; rate: number }): Promise<void>;\n /**\n * Set the current time of an audio file\n * @since 5.0.0\n * @param option {@link AssetPlayOptions}\n * @returns {Promise<{ currentTime: number }>}\n */\n getCurrentTime(options: {\n assetId: string;\n }): Promise<{ currentTime: number }>;\n /**\n * Get the duration of an audio file\n * @since 5.0.0\n * @param option {@link AssetPlayOptions}\n * @returns {Promise<{ duration: number }>}\n */\n getDuration(options: Assets): Promise<{ duration: number }>;\n /**\n * Check if an audio file is playing\n *\n * @since 5.0.0\n * @param option {@link AssetPlayOptions}\n * @returns {Promise<boolean>}\n */\n isPlaying(options: Assets): Promise<{ isPlaying: boolean }>;\n /**\n * Listen for complete event\n *\n * @since 5.0.0\n * return {@link CompletedEvent}\n */\n addListener(\n eventName: \"complete\",\n listenerFunc: CompletedListener,\n ): Promise<PluginListenerHandle>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface CompletedEvent {\n /**\n * Emit when a play completes\n *\n * @since 5.0.0\n */\n assetId: string;\n}\nexport type CompletedListener = (state: CompletedEvent) => void;\nexport interface Assets {\n /**\n * Asset Id, unique identifier of the file\n */\n assetId: string;\n}\nexport interface AssetVolume {\n /**\n * Asset Id, unique identifier of the file\n */\n assetId: string;\n /**\n * Volume of the audio, between 0.1 and 1.0\n */\n volume: number;\n}\n\nexport interface AssetRate {\n /**\n * Asset Id, unique identifier of the file\n */\n assetId: string;\n /**\n * Rate of the audio, between 0.1 and 1.0\n */\n rate: number;\n}\n\nexport interface AssetPlayOptions {\n /**\n * Asset Id, unique identifier of the file\n */\n assetId: string;\n /**\n * Time to start playing the audio, in milliseconds\n */\n time?: number;\n /**\n * Delay to start playing the audio, in milliseconds\n */\n delay?: number;\n}\n\nexport interface ConfigureOptions {\n /**\n * Play the audio with Fade effect, only available for IOS\n */\n fade?: boolean;\n /**\n * focus the audio with Audio Focus\n */\n focus?: boolean;\n /**\n * Play the audio in the background\n */\n background?: boolean;\n}\n\nexport interface PreloadOptions {\n /**\n * Path to the audio file, relative path of the file, absolute url (file://) or remote url (https://)\n */\n assetPath: string;\n /**\n * Asset Id, unique identifier of the file\n */\n assetId: string;\n /**\n * Volume of the audio, between 0.1 and 1.0\n */\n volume?: number;\n /**\n * Audio channel number, default is 1\n */\n audioChannelNum?: number;\n /**\n * Is the audio file a URL, pass true if assetPath is a `file://` url\n */\n isUrl?: boolean;\n}\n\nexport interface NativeAudio {\n /**\n * Configure the audio player\n * @since 5.0.0\n * @param option {@link ConfigureOptions}\n * @returns\n */\n configure(options: ConfigureOptions): Promise<void>;\n /**\n * Load an audio file\n * @since 5.0.0\n * @param option {@link PreloadOptions}\n * @returns\n */\n preload(options: PreloadOptions): Promise<void>;\n /**\n * Check if an audio file is preloaded\n *\n * @since 6.1.0\n * @param option {@link Assets}\n * @returns {Promise<boolean>}\n */\n isPreloaded(options: PreloadOptions): Promise<{ found: boolean }>;\n /**\n * Play an audio file\n * @since 5.0.0\n * @param option {@link PlayOptions}\n * @returns\n */\n play(options: {\n assetId: string;\n time?: number;\n delay?: number;\n }): Promise<void>;\n /**\n * Pause an audio file\n * @since 5.0.0\n * @param option {@link Assets}\n * @returns\n */\n pause(options: Assets): Promise<void>;\n /**\n * Resume an audio file\n * @since 5.0.0\n * @param option {@link Assets}\n * @returns\n */\n resume(options: Assets): Promise<void>;\n /**\n * Stop an audio file\n * @since 5.0.0\n * @param option {@link Assets}\n * @returns\n */\n loop(options: Assets): Promise<void>;\n /**\n * Stop an audio file\n * @since 5.0.0\n * @param option {@link Assets}\n * @returns\n */\n stop(options: Assets): Promise<void>;\n /**\n * Unload an audio file\n * @since 5.0.0\n * @param option {@link Assets}\n * @returns\n */\n unload(options: Assets): Promise<void>;\n /**\n * Set the volume of an audio file\n * @since 5.0.0\n * @param option {@link AssetVolume}\n * @returns {Promise<void>}\n */\n setVolume(options: { assetId: string; volume: number }): Promise<void>;\n /**\n * Set the rate of an audio file\n * @since 5.0.0\n * @param option {@link AssetPlayOptions}\n * @returns {Promise<void>}\n */\n setRate(options: { assetId: string; rate: number }): Promise<void>;\n /**\n * Set the current time of an audio file\n * @since 5.0.0\n * @param option {@link AssetPlayOptions}\n * @returns {Promise<{ currentTime: number }>}\n */\n getCurrentTime(options: {\n assetId: string;\n }): Promise<{ currentTime: number }>;\n /**\n * Get the duration of an audio file\n * @since 5.0.0\n * @param option {@link AssetPlayOptions}\n * @returns {Promise<{ duration: number }>}\n */\n getDuration(options: Assets): Promise<{ duration: number }>;\n /**\n * Check if an audio file is playing\n *\n * @since 5.0.0\n * @param option {@link AssetPlayOptions}\n * @returns {Promise<boolean>}\n */\n isPlaying(options: Assets): Promise<{ isPlaying: boolean }>;\n /**\n * Listen for complete event\n *\n * @since 5.0.0\n * return {@link CompletedEvent}\n */\n addListener(\n eventName: \"complete\",\n listenerFunc: CompletedListener,\n ): Promise<PluginListenerHandle>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -22,7 +22,9 @@ export declare class NativeAudioWeb extends WebPlugin implements NativeAudio {
22
22
  duration: number;
23
23
  }>;
24
24
  configure(options: ConfigureOptions): Promise<void>;
25
- isPreloaded(options: PreloadOptions): Promise<boolean>;
25
+ isPreloaded(options: PreloadOptions): Promise<{
26
+ found: boolean;
27
+ }>;
26
28
  preload(options: PreloadOptions): Promise<void>;
27
29
  private onEnded;
28
30
  play(options: {
package/dist/esm/web.js CHANGED
@@ -33,10 +33,10 @@ export class NativeAudioWeb extends WebPlugin {
33
33
  }
34
34
  async isPreloaded(options) {
35
35
  try {
36
- return !!this.getAudioAsset(options.assetId);
36
+ return { found: !!this.getAudioAsset(options.assetId) };
37
37
  }
38
38
  catch (e) {
39
- return false;
39
+ return { found: false };
40
40
  }
41
41
  }
42
42
  async preload(options) {
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,MAAM,OAAO,cAAe,SAAQ,SAAS;IAK3C;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAA4B;QACvC,MAAM,KAAK,GAAqB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;QAC1E,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAA4B;QACtC,MAAM,KAAK,GAAqB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;QAC1E,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,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,EAAsB,CAAC;AA2JlC,MAAM,WAAW,GAAG,IAAI,cAAc,EAAE,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport { AudioAsset } from \"./audio-asset\";\nimport type { ConfigureOptions, PreloadOptions } from \"./definitions\";\nimport { NativeAudio } from \"./definitions\";\n\nexport class NativeAudioWeb extends WebPlugin implements NativeAudio {\n private static readonly FILE_LOCATION: string = \"\";\n private static readonly AUDIO_ASSET_BY_ASSET_ID: Map<string, AudioAsset> =\n new Map<string, AudioAsset>();\n\n constructor() {\n super();\n }\n\n async resume(options: { assetId: string }): Promise<void> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n if (audio.paused) {\n return audio.play();\n }\n }\n\n async pause(options: { assetId: string }): Promise<void> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n return audio.pause();\n }\n\n async getCurrentTime(options: {\n assetId: string;\n }): Promise<{ currentTime: number }> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n return { currentTime: audio.currentTime };\n }\n\n async getDuration(options: {\n assetId: string;\n }): Promise<{ duration: number }> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n if (Number.isNaN(audio.duration)) {\n throw \"no duration available\";\n }\n if (!Number.isFinite(audio.duration)) {\n throw \"duration not available => media resource is streaming\";\n }\n return { duration: audio.duration };\n }\n\n async configure(options: ConfigureOptions): Promise<void> {\n throw `configure is not supported for web: ${JSON.stringify(options)}`;\n }\n\n async isPreloaded(options: PreloadOptions): Promise<boolean> {\n try {\n return !!this.getAudioAsset(options.assetId);\n } catch (e) {\n return false;\n }\n }\n\n async preload(options: PreloadOptions): Promise<void> {\n if (NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.has(options.assetId)) {\n throw \"AssetId already exists. Unload first if like to change!\";\n }\n if (!options.assetPath?.length) {\n throw \"no assetPath provided\";\n }\n if (\n !options.isUrl &&\n !new RegExp(\"^/?\" + NativeAudioWeb.FILE_LOCATION).test(options.assetPath)\n ) {\n const slashPrefix: string = options.assetPath.startsWith(\"/\") ? \"\" : \"/\";\n options.assetPath = `${NativeAudioWeb.FILE_LOCATION}${slashPrefix}${options.assetPath}`;\n }\n const audio: HTMLAudioElement = new Audio(options.assetPath);\n audio.autoplay = false;\n audio.loop = false;\n audio.preload = \"auto\";\n if (options.volume) {\n audio.volume = options.volume;\n }\n NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.set(\n options.assetId,\n new AudioAsset(audio),\n );\n }\n private onEnded(event: Event): void {\n const audio: HTMLAudioElement = event.target as HTMLAudioElement;\n this.notifyListeners(\"complete\", { assetId: audio.id });\n }\n\n async play(options: { assetId: string; time?: number }): Promise<void> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n await this.stop(options);\n audio.loop = false;\n audio.currentTime = options.time ?? 0;\n audio.addEventListener(\"ended\", (e) => this.onEnded(e), { once: true });\n return audio.play();\n }\n\n async loop(options: { assetId: string }): Promise<void> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n await this.stop(options);\n audio.loop = true;\n return audio.play();\n }\n\n async stop(options: { assetId: string }): Promise<void> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n audio.pause();\n audio.loop = false;\n audio.currentTime = 0;\n }\n\n async unload(options: { assetId: string }): Promise<void> {\n await this.stop(options);\n NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.delete(options.assetId);\n }\n\n async setVolume(options: { assetId: string; volume: number }): Promise<void> {\n if (typeof options?.volume !== \"number\") {\n throw \"no volume provided\";\n }\n\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n audio.volume = options.volume;\n }\n\n async setRate(options: { assetId: string; rate: number }): Promise<void> {\n if (typeof options?.rate !== \"number\") {\n throw \"no rate provided\";\n }\n\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n audio.playbackRate = options.rate;\n }\n\n async isPlaying(options: {\n assetId: string;\n }): Promise<{ isPlaying: boolean }> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n return { isPlaying: !audio.paused };\n }\n\n private getAudioAsset(assetId: string): AudioAsset {\n this.checkAssetId(assetId);\n\n if (!NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.has(assetId)) {\n throw `no asset for assetId \"${assetId}\" available. Call preload first!`;\n }\n\n return NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.get(assetId) as AudioAsset;\n }\n\n private checkAssetId(assetId: string): void {\n if (typeof assetId !== \"string\") {\n throw \"assetId must be a string\";\n }\n\n if (!assetId?.length) {\n throw \"no assetId provided\";\n }\n }\n}\n\nconst NativeAudio = new NativeAudioWeb();\n\nexport { NativeAudio };\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,MAAM,OAAO,cAAe,SAAQ,SAAS;IAK3C;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAA4B;QACvC,MAAM,KAAK,GAAqB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;QAC1E,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAA4B;QACtC,MAAM,KAAK,GAAqB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;QAC1E,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAEpB;QACC,MAAM,KAAK,GAAqB,IA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AC7C,IAAI,GAAG,EAAsB,CAAC;AA2JlC,MAAM,WAAW,GAAG,IAAI,cAAc,EAAE,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport { AudioAsset } from \"./audio-asset\";\nimport type { ConfigureOptions, PreloadOptions } from \"./definitions\";\nimport { NativeAudio } from \"./definitions\";\n\nexport class NativeAudioWeb extends WebPlugin implements NativeAudio {\n private static readonly FILE_LOCATION: string = \"\";\n private static readonly AUDIO_ASSET_BY_ASSET_ID: Map<string, AudioAsset> =\n new Map<string, AudioAsset>();\n\n constructor() {\n super();\n }\n\n async resume(options: { assetId: string }): Promise<void> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n if (audio.paused) {\n return audio.play();\n }\n }\n\n async pause(options: { assetId: string }): Promise<void> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n return audio.pause();\n }\n\n async getCurrentTime(options: {\n assetId: string;\n }): Promise<{ currentTime: number }> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n return { currentTime: audio.currentTime };\n }\n\n async getDuration(options: {\n assetId: string;\n }): Promise<{ duration: number }> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n if (Number.isNaN(audio.duration)) {\n throw \"no duration available\";\n }\n if (!Number.isFinite(audio.duration)) {\n throw \"duration not available => media resource is streaming\";\n }\n return { duration: audio.duration };\n }\n\n async configure(options: ConfigureOptions): Promise<void> {\n throw `configure is not supported for web: ${JSON.stringify(options)}`;\n }\n\n async isPreloaded(options: PreloadOptions): Promise<{ found: boolean }> {\n try {\n return { found: !!this.getAudioAsset(options.assetId) };\n } catch (e) {\n return { found: false };\n }\n }\n\n async preload(options: PreloadOptions): Promise<void> {\n if (NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.has(options.assetId)) {\n throw \"AssetId already exists. Unload first if like to change!\";\n }\n if (!options.assetPath?.length) {\n throw \"no assetPath provided\";\n }\n if (\n !options.isUrl &&\n !new RegExp(\"^/?\" + NativeAudioWeb.FILE_LOCATION).test(options.assetPath)\n ) {\n const slashPrefix: string = options.assetPath.startsWith(\"/\") ? \"\" : \"/\";\n options.assetPath = `${NativeAudioWeb.FILE_LOCATION}${slashPrefix}${options.assetPath}`;\n }\n const audio: HTMLAudioElement = new Audio(options.assetPath);\n audio.autoplay = false;\n audio.loop = false;\n audio.preload = \"auto\";\n if (options.volume) {\n audio.volume = options.volume;\n }\n NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.set(\n options.assetId,\n new AudioAsset(audio),\n );\n }\n private onEnded(event: Event): void {\n const audio: HTMLAudioElement = event.target as HTMLAudioElement;\n this.notifyListeners(\"complete\", { assetId: audio.id });\n }\n\n async play(options: { assetId: string; time?: number }): Promise<void> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n await this.stop(options);\n audio.loop = false;\n audio.currentTime = options.time ?? 0;\n audio.addEventListener(\"ended\", (e) => this.onEnded(e), { once: true });\n return audio.play();\n }\n\n async loop(options: { assetId: string }): Promise<void> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n await this.stop(options);\n audio.loop = true;\n return audio.play();\n }\n\n async stop(options: { assetId: string }): Promise<void> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n audio.pause();\n audio.loop = false;\n audio.currentTime = 0;\n }\n\n async unload(options: { assetId: string }): Promise<void> {\n await this.stop(options);\n NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.delete(options.assetId);\n }\n\n async setVolume(options: { assetId: string; volume: number }): Promise<void> {\n if (typeof options?.volume !== \"number\") {\n throw \"no volume provided\";\n }\n\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n audio.volume = options.volume;\n }\n\n async setRate(options: { assetId: string; rate: number }): Promise<void> {\n if (typeof options?.rate !== \"number\") {\n throw \"no rate provided\";\n }\n\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n audio.playbackRate = options.rate;\n }\n\n async isPlaying(options: {\n assetId: string;\n }): Promise<{ isPlaying: boolean }> {\n const audio: HTMLAudioElement = this.getAudioAsset(options.assetId).audio;\n return { isPlaying: !audio.paused };\n }\n\n private getAudioAsset(assetId: string): AudioAsset {\n this.checkAssetId(assetId);\n\n if (!NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.has(assetId)) {\n throw `no asset for assetId \"${assetId}\" available. Call preload first!`;\n }\n\n return NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.get(assetId) as AudioAsset;\n }\n\n private checkAssetId(assetId: string): void {\n if (typeof assetId !== \"string\") {\n throw \"assetId must be a string\";\n }\n\n if (!assetId?.length) {\n throw \"no assetId provided\";\n }\n }\n}\n\nconst NativeAudio = new NativeAudioWeb();\n\nexport { NativeAudio };\n"]}
@@ -45,10 +45,10 @@ class NativeAudioWeb extends core.WebPlugin {
45
45
  }
46
46
  async isPreloaded(options) {
47
47
  try {
48
- return !!this.getAudioAsset(options.assetId);
48
+ return { found: !!this.getAudioAsset(options.assetId) };
49
49
  }
50
50
  catch (e) {
51
- return false;
51
+ return { found: false };
52
52
  }
53
53
  }
54
54
  async preload(options) {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/audio-asset.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst NativeAudio = registerPlugin(\"NativeAudio\", {\n web: () => import(\"./web\").then((m) => new m.NativeAudioWeb()),\n});\nexport * from \"./definitions\";\nexport { NativeAudio };\n//# sourceMappingURL=index.js.map","export class AudioAsset {\n constructor(audio) {\n this.audio = audio;\n }\n}\n//# sourceMappingURL=audio-asset.js.map","import { WebPlugin } from \"@capacitor/core\";\nimport { AudioAsset } from \"./audio-asset\";\nexport class NativeAudioWeb extends WebPlugin {\n constructor() {\n super();\n }\n async resume(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n if (audio.paused) {\n return audio.play();\n }\n }\n async pause(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n return audio.pause();\n }\n async getCurrentTime(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n return { currentTime: audio.currentTime };\n }\n async getDuration(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n if (Number.isNaN(audio.duration)) {\n throw \"no duration available\";\n }\n if (!Number.isFinite(audio.duration)) {\n throw \"duration not available => media resource is streaming\";\n }\n return { duration: audio.duration };\n }\n async configure(options) {\n throw `configure is not supported for web: ${JSON.stringify(options)}`;\n }\n async isPreloaded(options) {\n try {\n return !!this.getAudioAsset(options.assetId);\n }\n catch (e) {\n return false;\n }\n }\n async preload(options) {\n var _a;\n if (NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.has(options.assetId)) {\n throw \"AssetId already exists. Unload first if like to change!\";\n }\n if (!((_a = options.assetPath) === null || _a === void 0 ? void 0 : _a.length)) {\n throw \"no assetPath provided\";\n }\n if (!options.isUrl &&\n !new RegExp(\"^/?\" + NativeAudioWeb.FILE_LOCATION).test(options.assetPath)) {\n const slashPrefix = options.assetPath.startsWith(\"/\") ? \"\" : \"/\";\n options.assetPath = `${NativeAudioWeb.FILE_LOCATION}${slashPrefix}${options.assetPath}`;\n }\n const audio = new Audio(options.assetPath);\n audio.autoplay = false;\n audio.loop = false;\n audio.preload = \"auto\";\n if (options.volume) {\n audio.volume = options.volume;\n }\n NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.set(options.assetId, new AudioAsset(audio));\n }\n onEnded(event) {\n const audio = event.target;\n this.notifyListeners(\"complete\", { assetId: audio.id });\n }\n async play(options) {\n var _a;\n const audio = this.getAudioAsset(options.assetId).audio;\n await this.stop(options);\n audio.loop = false;\n audio.currentTime = (_a = options.time) !== null && _a !== void 0 ? _a : 0;\n audio.addEventListener(\"ended\", (e) => this.onEnded(e), { once: true });\n return audio.play();\n }\n async loop(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n await this.stop(options);\n audio.loop = true;\n return audio.play();\n }\n async stop(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n audio.pause();\n audio.loop = false;\n audio.currentTime = 0;\n }\n async unload(options) {\n await this.stop(options);\n NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.delete(options.assetId);\n }\n async setVolume(options) {\n if (typeof (options === null || options === void 0 ? void 0 : options.volume) !== \"number\") {\n throw \"no volume provided\";\n }\n const audio = this.getAudioAsset(options.assetId).audio;\n audio.volume = options.volume;\n }\n async setRate(options) {\n if (typeof (options === null || options === void 0 ? void 0 : options.rate) !== \"number\") {\n throw \"no rate provided\";\n }\n const audio = this.getAudioAsset(options.assetId).audio;\n audio.playbackRate = options.rate;\n }\n async isPlaying(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n return { isPlaying: !audio.paused };\n }\n getAudioAsset(assetId) {\n this.checkAssetId(assetId);\n if (!NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.has(assetId)) {\n throw `no asset for assetId \"${assetId}\" available. Call preload first!`;\n }\n return NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.get(assetId);\n }\n checkAssetId(assetId) {\n if (typeof assetId !== \"string\") {\n throw \"assetId must be a string\";\n }\n if (!(assetId === null || assetId === void 0 ? void 0 : assetId.length)) {\n throw \"no assetId provided\";\n }\n }\n}\nNativeAudioWeb.FILE_LOCATION = \"\";\nNativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID = new Map();\nconst NativeAudio = new NativeAudioWeb();\nexport { NativeAudio };\n//# sourceMappingURL=web.js.map"],"names":["NativeAudio","registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAACA,aAAW,GAAGC,mBAAc,CAAC,aAAa,EAAE;AAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AAClE,CAAC;;ACHM,MAAM,UAAU,CAAC;AACxB,IAAI,WAAW,CAAC,KAAK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C7C,SAAS;AACT,QAAQ,IAAI,EAAE,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE;AACjF,YAAY,MAAM,qBAAqB,CAAC;AACxC,SAAS;AACT,KAAK;AACL,CAAC;AACD,cAAc,CAAC,aAAa,GAAG,EAAE,CAAC;AAClC,cAAc,CAAC,uBAAuB,GAAG,IAAI,GAAG,EAAE,CAAC;AACnD,MAAM,WAAW,GAAG,IAAI,cAAc,EAAE;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/audio-asset.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst NativeAudio = registerPlugin(\"NativeAudio\", {\n web: () => import(\"./web\").then((m) => new m.NativeAudioWeb()),\n});\nexport * from \"./definitions\";\nexport { NativeAudio };\n//# sourceMappingURL=index.js.map","export class AudioAsset {\n constructor(audio) {\n this.audio = audio;\n }\n}\n//# sourceMappingURL=audio-asset.js.map","import { WebPlugin } from \"@capacitor/core\";\nimport { AudioAsset } from \"./audio-asset\";\nexport class NativeAudioWeb extends WebPlugin {\n constructor() {\n super();\n }\n async resume(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n if (audio.paused) {\n return audio.play();\n }\n }\n async pause(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n return audio.pause();\n }\n async getCurrentTime(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n return { currentTime: audio.currentTime };\n }\n async getDuration(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n if (Number.isNaN(audio.duration)) {\n throw \"no duration available\";\n }\n if (!Number.isFinite(audio.duration)) {\n throw \"duration not available => media resource is streaming\";\n }\n return { duration: audio.duration };\n }\n async configure(options) {\n throw `configure is not supported for web: ${JSON.stringify(options)}`;\n }\n async isPreloaded(options) {\n try {\n return { found: !!this.getAudioAsset(options.assetId) };\n }\n catch (e) {\n return { found: false };\n }\n }\n async preload(options) {\n var _a;\n if (NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.has(options.assetId)) {\n throw \"AssetId already exists. Unload first if like to change!\";\n }\n if (!((_a = options.assetPath) === null || _a === void 0 ? void 0 : _a.length)) {\n throw \"no assetPath provided\";\n }\n if (!options.isUrl &&\n !new RegExp(\"^/?\" + NativeAudioWeb.FILE_LOCATION).test(options.assetPath)) {\n const slashPrefix = options.assetPath.startsWith(\"/\") ? \"\" : \"/\";\n options.assetPath = `${NativeAudioWeb.FILE_LOCATION}${slashPrefix}${options.assetPath}`;\n }\n const audio = new Audio(options.assetPath);\n audio.autoplay = false;\n audio.loop = false;\n audio.preload = \"auto\";\n if (options.volume) {\n audio.volume = options.volume;\n }\n NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.set(options.assetId, new AudioAsset(audio));\n }\n onEnded(event) {\n const audio = event.target;\n this.notifyListeners(\"complete\", { assetId: audio.id });\n }\n async play(options) {\n var _a;\n const audio = this.getAudioAsset(options.assetId).audio;\n await this.stop(options);\n audio.loop = false;\n audio.currentTime = (_a = options.time) !== null && _a !== void 0 ? _a : 0;\n audio.addEventListener(\"ended\", (e) => this.onEnded(e), { once: true });\n return audio.play();\n }\n async loop(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n await this.stop(options);\n audio.loop = true;\n return audio.play();\n }\n async stop(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n audio.pause();\n audio.loop = false;\n audio.currentTime = 0;\n }\n async unload(options) {\n await this.stop(options);\n NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.delete(options.assetId);\n }\n async setVolume(options) {\n if (typeof (options === null || options === void 0 ? void 0 : options.volume) !== \"number\") {\n throw \"no volume provided\";\n }\n const audio = this.getAudioAsset(options.assetId).audio;\n audio.volume = options.volume;\n }\n async setRate(options) {\n if (typeof (options === null || options === void 0 ? void 0 : options.rate) !== \"number\") {\n throw \"no rate provided\";\n }\n const audio = this.getAudioAsset(options.assetId).audio;\n audio.playbackRate = options.rate;\n }\n async isPlaying(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n return { isPlaying: !audio.paused };\n }\n getAudioAsset(assetId) {\n this.checkAssetId(assetId);\n if (!NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.has(assetId)) {\n throw `no asset for assetId \"${assetId}\" available. Call preload first!`;\n }\n return NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.get(assetId);\n }\n checkAssetId(assetId) {\n if (typeof assetId !== \"string\") {\n throw \"assetId must be a string\";\n }\n if (!(assetId === null || assetId === void 0 ? void 0 : assetId.length)) {\n throw \"no assetId provided\";\n }\n }\n}\nNativeAudioWeb.FILE_LOCATION = \"\";\nNativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID = new Map();\nconst NativeAudio = new NativeAudioWeb();\nexport { NativeAudio };\n//# sourceMappingURL=web.js.map"],"names":["NativeAudio","registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAACA,aAAW,GAAGC,mBAAc,CAAC,aAAa,EAAE;AAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AAClE,CAAC;;ACHM,MAAM,UAAU,CAAC;AACxB,IAAI,WAAW,CAAC,KAAK,EAAE;AACvB,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AAC3B,KAAK;AACL;;ACFO,MAAM,cAAc,SAASC,cAAS,CAAC;AAC9C,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,EAAE,CAAC;AAChB,KAAK;AACL,IAAI,MAAM,MAAM,CAAC,OAAO,EAAE;AAC1B,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;AAChE,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE;AAC1B,YAAY,OAAO,KAAK,CAAC,IAAI,EAAE,CAA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/plugin.js CHANGED
@@ -44,10 +44,10 @@ var capacitorCapacitorNativeAudio = (function (exports, core) {
44
44
  }
45
45
  async isPreloaded(options) {
46
46
  try {
47
- return !!this.getAudioAsset(options.assetId);
47
+ return { found: !!this.getAudioAsset(options.assetId) };
48
48
  }
49
49
  catch (e) {
50
- return false;
50
+ return { found: false };
51
51
  }
52
52
  }
53
53
  async preload(options) {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/audio-asset.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst NativeAudio = registerPlugin(\"NativeAudio\", {\n web: () => import(\"./web\").then((m) => new m.NativeAudioWeb()),\n});\nexport * from \"./definitions\";\nexport { NativeAudio };\n//# sourceMappingURL=index.js.map","export class AudioAsset {\n constructor(audio) {\n this.audio = audio;\n }\n}\n//# sourceMappingURL=audio-asset.js.map","import { WebPlugin } from \"@capacitor/core\";\nimport { AudioAsset } from \"./audio-asset\";\nexport class NativeAudioWeb extends WebPlugin {\n constructor() {\n super();\n }\n async resume(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n if (audio.paused) {\n return audio.play();\n }\n }\n async pause(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n return audio.pause();\n }\n async getCurrentTime(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n return { currentTime: audio.currentTime };\n }\n async getDuration(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n if (Number.isNaN(audio.duration)) {\n throw \"no duration available\";\n }\n if (!Number.isFinite(audio.duration)) {\n throw \"duration not available => media resource is streaming\";\n }\n return { duration: audio.duration };\n }\n async configure(options) {\n throw `configure is not supported for web: ${JSON.stringify(options)}`;\n }\n async isPreloaded(options) {\n try {\n return !!this.getAudioAsset(options.assetId);\n }\n catch (e) {\n return false;\n }\n }\n async preload(options) {\n var _a;\n if (NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.has(options.assetId)) {\n throw \"AssetId already exists. Unload first if like to change!\";\n }\n if (!((_a = options.assetPath) === null || _a === void 0 ? void 0 : _a.length)) {\n throw \"no assetPath provided\";\n }\n if (!options.isUrl &&\n !new RegExp(\"^/?\" + NativeAudioWeb.FILE_LOCATION).test(options.assetPath)) {\n const slashPrefix = options.assetPath.startsWith(\"/\") ? \"\" : \"/\";\n options.assetPath = `${NativeAudioWeb.FILE_LOCATION}${slashPrefix}${options.assetPath}`;\n }\n const audio = new Audio(options.assetPath);\n audio.autoplay = false;\n audio.loop = false;\n audio.preload = \"auto\";\n if (options.volume) {\n audio.volume = options.volume;\n }\n NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.set(options.assetId, new AudioAsset(audio));\n }\n onEnded(event) {\n const audio = event.target;\n this.notifyListeners(\"complete\", { assetId: audio.id });\n }\n async play(options) {\n var _a;\n const audio = this.getAudioAsset(options.assetId).audio;\n await this.stop(options);\n audio.loop = false;\n audio.currentTime = (_a = options.time) !== null && _a !== void 0 ? _a : 0;\n audio.addEventListener(\"ended\", (e) => this.onEnded(e), { once: true });\n return audio.play();\n }\n async loop(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n await this.stop(options);\n audio.loop = true;\n return audio.play();\n }\n async stop(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n audio.pause();\n audio.loop = false;\n audio.currentTime = 0;\n }\n async unload(options) {\n await this.stop(options);\n NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.delete(options.assetId);\n }\n async setVolume(options) {\n if (typeof (options === null || options === void 0 ? void 0 : options.volume) !== \"number\") {\n throw \"no volume provided\";\n }\n const audio = this.getAudioAsset(options.assetId).audio;\n audio.volume = options.volume;\n }\n async setRate(options) {\n if (typeof (options === null || options === void 0 ? void 0 : options.rate) !== \"number\") {\n throw \"no rate provided\";\n }\n const audio = this.getAudioAsset(options.assetId).audio;\n audio.playbackRate = options.rate;\n }\n async isPlaying(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n return { isPlaying: !audio.paused };\n }\n getAudioAsset(assetId) {\n this.checkAssetId(assetId);\n if (!NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.has(assetId)) {\n throw `no asset for assetId \"${assetId}\" available. Call preload first!`;\n }\n return NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.get(assetId);\n }\n checkAssetId(assetId) {\n if (typeof assetId !== \"string\") {\n throw \"assetId must be a string\";\n }\n if (!(assetId === null || assetId === void 0 ? void 0 : assetId.length)) {\n throw \"no assetId provided\";\n }\n }\n}\nNativeAudioWeb.FILE_LOCATION = \"\";\nNativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID = new Map();\nconst NativeAudio = new NativeAudioWeb();\nexport { NativeAudio };\n//# sourceMappingURL=web.js.map"],"names":["NativeAudio","registerPlugin","WebPlugin"],"mappings":";;;AACK,UAACA,aAAW,GAAGC,mBAAc,CAAC,aAAa,EAAE;IAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAClE,CAAC;;ICHM,MAAM,UAAU,CAAC;IACxB,IAAI,WAAW,CAAC,KAAK,EAAE;IACvB,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAC3B,KAAK;IACL;;ICFO,MAAM,cAAc,SAASC,cAAS,CAAC;IAC9C,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,EAAE,CAAC;IAChB,KAAK;IACL,IAAI,MAAM,MAAM,CAAC,OAAO,EAAE;IAC1B,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;IAChE,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE;IAC1B,YAAY,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;IAChC,SAAS;IACT,KAAK;IACL,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE;IACzB,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,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C;IAC1C,KAAK;IACL,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;IAC7B,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;IAChE,QAAQ,OAAO,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IAC5C,KAAK;IACL,IAAI,aAAa,CAAC,OAAO,EAAE;IAC3B,QAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACnC,QAAQ,IAAI,CAAC,cAAc,CAAC,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;IAClE,YAAY,MAAM,CAAC,sBAAsB,EAAE,OAAO,CAAC,gCAAgC,CAAC,CAAC;IACrF,SAAS;IACT,QAAQ,OAAO,cAAc,CAAC,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACnE,KAAK;IACL,IAAI,YAAY,CAAC,OAAO,EAAE;IAC1B,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;IACzC,YAAY,MAAM,0BAA0B,CAAC;IAC7C,SAAS;IACT,QAAQ,IAAI,EAAE,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE;IACjF,YAAY,MAAM,qBAAqB,CAAC;IACxC,SAAS;IACT,KAAK;IACL,CAAC;IACD,cAAc,CAAC,aAAa,GAAG,EAAE,CAAC;IAClC,cAAc,CAAC,uBAAuB,GAAG,IAAI,GAAG,EAAE,CAAC;IACnD,MAAM,WAAW,GAAG,IAAI,cAAc,EAAE;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/audio-asset.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst NativeAudio = registerPlugin(\"NativeAudio\", {\n web: () => import(\"./web\").then((m) => new m.NativeAudioWeb()),\n});\nexport * from \"./definitions\";\nexport { NativeAudio };\n//# sourceMappingURL=index.js.map","export class AudioAsset {\n constructor(audio) {\n this.audio = audio;\n }\n}\n//# sourceMappingURL=audio-asset.js.map","import { WebPlugin } from \"@capacitor/core\";\nimport { AudioAsset } from \"./audio-asset\";\nexport class NativeAudioWeb extends WebPlugin {\n constructor() {\n super();\n }\n async resume(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n if (audio.paused) {\n return audio.play();\n }\n }\n async pause(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n return audio.pause();\n }\n async getCurrentTime(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n return { currentTime: audio.currentTime };\n }\n async getDuration(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n if (Number.isNaN(audio.duration)) {\n throw \"no duration available\";\n }\n if (!Number.isFinite(audio.duration)) {\n throw \"duration not available => media resource is streaming\";\n }\n return { duration: audio.duration };\n }\n async configure(options) {\n throw `configure is not supported for web: ${JSON.stringify(options)}`;\n }\n async isPreloaded(options) {\n try {\n return { found: !!this.getAudioAsset(options.assetId) };\n }\n catch (e) {\n return { found: false };\n }\n }\n async preload(options) {\n var _a;\n if (NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.has(options.assetId)) {\n throw \"AssetId already exists. Unload first if like to change!\";\n }\n if (!((_a = options.assetPath) === null || _a === void 0 ? void 0 : _a.length)) {\n throw \"no assetPath provided\";\n }\n if (!options.isUrl &&\n !new RegExp(\"^/?\" + NativeAudioWeb.FILE_LOCATION).test(options.assetPath)) {\n const slashPrefix = options.assetPath.startsWith(\"/\") ? \"\" : \"/\";\n options.assetPath = `${NativeAudioWeb.FILE_LOCATION}${slashPrefix}${options.assetPath}`;\n }\n const audio = new Audio(options.assetPath);\n audio.autoplay = false;\n audio.loop = false;\n audio.preload = \"auto\";\n if (options.volume) {\n audio.volume = options.volume;\n }\n NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.set(options.assetId, new AudioAsset(audio));\n }\n onEnded(event) {\n const audio = event.target;\n this.notifyListeners(\"complete\", { assetId: audio.id });\n }\n async play(options) {\n var _a;\n const audio = this.getAudioAsset(options.assetId).audio;\n await this.stop(options);\n audio.loop = false;\n audio.currentTime = (_a = options.time) !== null && _a !== void 0 ? _a : 0;\n audio.addEventListener(\"ended\", (e) => this.onEnded(e), { once: true });\n return audio.play();\n }\n async loop(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n await this.stop(options);\n audio.loop = true;\n return audio.play();\n }\n async stop(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n audio.pause();\n audio.loop = false;\n audio.currentTime = 0;\n }\n async unload(options) {\n await this.stop(options);\n NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.delete(options.assetId);\n }\n async setVolume(options) {\n if (typeof (options === null || options === void 0 ? void 0 : options.volume) !== \"number\") {\n throw \"no volume provided\";\n }\n const audio = this.getAudioAsset(options.assetId).audio;\n audio.volume = options.volume;\n }\n async setRate(options) {\n if (typeof (options === null || options === void 0 ? void 0 : options.rate) !== \"number\") {\n throw \"no rate provided\";\n }\n const audio = this.getAudioAsset(options.assetId).audio;\n audio.playbackRate = options.rate;\n }\n async isPlaying(options) {\n const audio = this.getAudioAsset(options.assetId).audio;\n return { isPlaying: !audio.paused };\n }\n getAudioAsset(assetId) {\n this.checkAssetId(assetId);\n if (!NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.has(assetId)) {\n throw `no asset for assetId \"${assetId}\" available. Call preload first!`;\n }\n return NativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID.get(assetId);\n }\n checkAssetId(assetId) {\n if (typeof assetId !== \"string\") {\n throw \"assetId must be a string\";\n }\n if (!(assetId === null || assetId === void 0 ? void 0 : assetId.length)) {\n throw \"no assetId provided\";\n }\n }\n}\nNativeAudioWeb.FILE_LOCATION = \"\";\nNativeAudioWeb.AUDIO_ASSET_BY_ASSET_ID = new Map();\nconst NativeAudio = new NativeAudioWeb();\nexport { N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Ac,CAAC,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;IAClE,YAAY,MAAM,CAAC,sBAAsB,EAAE,OAAO,CAAC,gCAAgC,CAAC,CAAC;IACrF,SAAS;IACT,QAAQ,OAAO,cAAc,CAAC,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACnE,KAAK;IACL,IAAI,YAAY,CAAC,OAAO,EAAE;IAC1B,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;IACzC,YAAY,MAAM,0BAA0B,CAAC;IAC7C,SAAS;IACT,QAAQ,IAAI,EAAE,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE;IACjF,YAAY,MAAM,qBAAqB,CAAC;IACxC,SAAS;IACT,KAAK;IACL,CAAC;IACD,cAAc,CAAC,aAAa,GAAG,EAAE,CAAC;IAClC,cAAc,CAAC,uBAAuB,GAAG,IAAI,GAAG,EAAE,CAAC;IACnD,MAAM,WAAW,GAAG,IAAI,cAAc,EAAE;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/native-audio",
3
- "version": "6.4.17",
3
+ "version": "6.4.18",
4
4
  "description": "A native plugin for native audio engine",
5
5
  "main": "dist/plugin.js",
6
6
  "module": "dist/esm/index.js",