Skip to content

@capgo/native-audio

A native plugin for native audio engine.

A native plugin for native audio engine.

  • configure - Configure the audio player.
  • preload - Load an audio file.
  • playOnce - Play an audio file once with automatic cleanup.
  • isPreloaded - Check if an audio file is preloaded.
MethodDescription
configureConfigure the audio player.
preloadLoad an audio file.
playOncePlay an audio file once with automatic cleanup.
isPreloadedCheck if an audio file is preloaded.
playPlay an audio file.
pausePause an audio file.
resumeResume an audio file.
loopStop an audio file.
stopStop an audio file.
unloadUnload an audio file.
setVolumeSet the volume of an audio file.
setRateSet the rate of an audio file.
setCurrentTimeSet the current time of an audio file.
getCurrentTimeGet the current time of an audio file.
getDurationGet the duration of an audio file in seconds.
isPlayingCheck if an audio file is playing.
addListenerListen for complete event.
addListenerListen for current time updates Emits every 100ms while audio is playing.
addListenerListen for playback state changes, including notification and lock-screen transport controls. Emitted by Android and iOS. The current Web implementation does not emit this event.
clearCacheClear the audio cache for remote audio files.
setDebugModeSet debug mode logging.
getPluginVersionGet the native Capacitor plugin version.
deinitPluginDeinitialize the plugin and restore original audio session settings This method stops all playing audio and reverts any audio session changes made by the plugin Use this when you need to ensure compatibility with other audio plugins.

This reference is synced from src/definitions.ts in capacitor-native-audio.