0.1.1 • Published 1 year ago

ionic-audio-plugin v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ionic-audio

Audio playback

Install

npm install ionic-audio-plugin
npx cap sync

Setup

For native/remote control of you media playback to work, your @UIApplicationMain needs to implement UIResponder and send a notification when a remote control event is received.

import UIKit
import Capacitor
import IonicAudioPlugin

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  override func remoteControlReceived(with event: UIEvent?) {
    NotificationCenter.default.post(name: .remoteControlReceived, object: event)
  }
  
}

API

echo(...)

echo(options: { value: string; }) => Promise<{ value: string; }>
ParamType
options{ value: string; }

Returns: Promise<{ value: string; }>


play(...)

play(options: PlayOptions) => Promise<void>
ParamType
optionsPlayOptions

resume()

resume() => Promise<void>

pause()

pause() => Promise<void>

stop()

stop() => Promise<void>

seekTo(...)

seekTo(options: SeekToOptions) => Promise<void>
ParamType
optionsSeekToOptions

status(...)

status(callback: AudioStatusCallback) => void
ParamType
callbackAudioStatusCallback

Interfaces

PlayOptions

PropType
urlstring
titlestring
albumstring
artworkstring

SeekToOptions

PropType
secondsnumber

AudioStatus

PropType
state'playing' | 'paused' | 'stopped'
urlstring
durationnumber
currentTimenumber
volumenumber
isPlayingboolean
isPausedboolean
isStoppedboolean
hasEndedboolean
toNextboolean
toPrevboolean

Type Aliases

AudioStatusCallback

(status: AudioStatus): void

0.1.1

1 year ago

0.1.0

1 year ago

0.0.1

1 year ago