@capacitor-trancee/native-audio
v0.0.1
Published
A native plugin for native audio engine
Downloads
5
Readme
@capacitor-trancee/native-audio
A native plugin for native audio engine
Install
npm install @capacitor-trancee/native-audio
npx cap syncAPI
configure(...)preload(...)play(...)pause(...)resume(...)loop(...)stop(...)unload(...)setVolume(...)getCurrentTime(...)getDuration(...)isPlaying(...)addListener('complete', ...)- Interfaces
configure(...)
configure(options: ConfigureOptions) => Promise<void>| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options | ConfigureOptions |
preload(...)
preload(options: PreloadOptions) => Promise<void>| Param | Type |
| ------------- | --------------------------------------------------------- |
| options | PreloadOptions |
play(...)
play(options: { assetId: string; time?: number; }) => Promise<void>| Param | Type |
| ------------- | ------------------------------------------------ |
| options | { assetId: string; time?: number; } |
pause(...)
pause(options: { assetId: string; }) => Promise<void>| Param | Type |
| ------------- | --------------------------------- |
| options | { assetId: string; } |
resume(...)
resume(options: { assetId: string; }) => Promise<void>| Param | Type |
| ------------- | --------------------------------- |
| options | { assetId: string; } |
loop(...)
loop(options: { assetId: string; }) => Promise<void>| Param | Type |
| ------------- | --------------------------------- |
| options | { assetId: string; } |
stop(...)
stop(options: { assetId: string; }) => Promise<void>| Param | Type |
| ------------- | --------------------------------- |
| options | { assetId: string; } |
unload(...)
unload(options: { assetId: string; }) => Promise<void>| Param | Type |
| ------------- | --------------------------------- |
| options | { assetId: string; } |
setVolume(...)
setVolume(options: { assetId: string; volume: number; }) => Promise<void>| Param | Type |
| ------------- | ------------------------------------------------- |
| options | { assetId: string; volume: number; } |
getCurrentTime(...)
getCurrentTime(options: { assetId: string; }) => Promise<{ currentTime: number; }>| Param | Type |
| ------------- | --------------------------------- |
| options | { assetId: string; } |
Returns: Promise<{ currentTime: number; }>
getDuration(...)
getDuration(options: { assetId: string; }) => Promise<{ duration: number; }>| Param | Type |
| ------------- | --------------------------------- |
| options | { assetId: string; } |
Returns: Promise<{ duration: number; }>
isPlaying(...)
isPlaying(options: { assetId: string; }) => Promise<{ isPlaying: boolean; }>| Param | Type |
| ------------- | --------------------------------- |
| options | { assetId: string; } |
Returns: Promise<{ isPlaying: boolean; }>
addListener('complete', ...)
addListener(eventName: 'complete', listenerFunc: (event: { assetId: string; }) => void) => Promise<PluginListenerHandle>Listen for asset completed playing event
| Param | Type |
| ------------------ | ----------------------------------------------------- |
| eventName | 'complete' |
| listenerFunc | (event: { assetId: string; }) => void |
Returns: Promise<PluginListenerHandle>
Since: 5.0.1
Interfaces
ConfigureOptions
| Prop | Type | Description | Default |
| ----------- | -------------------- | ------------------------------------------------- | ------------------ |
| fade | boolean | Indicating whether or not to fade audio. | false |
| focus | boolean | Indicating whether or not to disable mixed audio. | false |
PreloadOptions
| Prop | Type |
| --------------------- | -------------------- |
| assetPath | string |
| assetId | string |
| volume | number |
| audioChannelNum | number |
| isUrl | boolean |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
