beep_player 0.0.1 copy "beep_player: ^0.0.1" to clipboard
beep_player: ^0.0.1 copied to clipboard

A plugin for playing single short audio asset file on Android and iOS

A player for short audio asset files, such as beeps.

On Android, this uses the SoundPool API, with audio attributes set to AudioAttributes.USAGE_ASSISTANCE_SONIFICATION and AudioAttributes.CONTENT_TYPE_SONIFICATION with max streams of 1.

On iOS, this uses the AVAudioPlayer API, with audio category set to AVAudioSessionCategoryAmbient.

Getting Started #

Before any calls to BeepPlayer.play, the audio file needs to be loaded first using BeepPlayer.load, otherwise it will silently fail. Don't forget to unload it when no longer needed.

Example:

static const BeepFile _beepFile = BeepFile(
    'assets/sounds/beep.wav',
    package: 'package1',
);

@override
void initState() {
    super.initState();
    BeepPlayer.load(_beepFile);
}

@override
void dispose() {
    BeepPlayer.unload(_beepFile);
    super.dispose();
}

@override
Widget build(BuildContext context) {
    ...
}

void _onPressed() {
    BeepPlayer.play(_beepFile);
}
6
likes
160
points
129
downloads

Publisher

unverified uploader

Weekly Downloads

A plugin for playing single short audio asset file on Android and iOS

Repository
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on beep_player