howler 1.1.2 copy "howler: ^1.1.2" to clipboard
howler: ^1.1.2 copied to clipboard

Audio library for the modern web. This makes working with audio in Dart easy and reliable across many platforms. (Port of howler.js to Dart)

howler.dart

pub package CI GitHub Tag New Commits Last Commits Pull Requests Code size License Funding Funding

Description #

howler.dart is an audio library for the modern web. It defaults to Web Audio API and falls back to HTML5 Audio. This makes working with audio in Dart easy and reliable across all platforms.

Additional information, live demos and a user showcase are available at howlerjs.com.

Usage #

A simple usage example:

import 'package:howler/howler.dart';

main() {

    var howl = new Howl(
        src: ['audio/track.mp3','audio/track.wav'], // source in MP3 and WAV fallback
        loop: true,
        volume: 0.60, // Play with 60% of original volume.
        preload: true // Automatically loads source.
    ) ;
    
    howl.play(); // Play sound.
    // or:
    howl.playSafe(); // Play sound, but checks for initial user interaction first.

    howl.fade(0.0, 0.60, 10000) ; // Make a fade, from volume 0% to 60% in 10s

    // Or you can use an easier way:

    howl.loadAndPlay( safe: true, callback: () {
      howl.fade(0.0, 0.60, 10000) ;
    });



}

Browser and Initial User Interaction. #

Modern browsers will block any play/autoplay of any media (video or audio) before an user interaction with the browser window.

The tracking is made listening events from onMouseUp, onTouchEnd and onKeyUp. Once the target condition is reached the listeners are canceled, removing any overhead.

To prevent issues with audio play, it's recommended to activate, as soon as possible in your code, the detection of initial user interaction:

  Howl.detectUserInitialInteraction() ;

After that you can call safe methods that only are executed once the initial user interaction is detected:

  howl.playSafe();
  howl.fadeSafe(0.0, 0.80, 3000);

Extra Documentation #

You can take a look at Howler.js - Documentation & Examples, for more about using this library.

Note that this Dart library is a port from original JavaScript library Howler.js. Some extra features were added, but the main behavior and API are very similar.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Author #

Graciliano M. Passos: gmpassos@GitHub.

License #

MIT license.

Original project in JavaScript #

This library was originally written in JavaScript by James Simpson. It was ported to Dart 2 code by Graciliano M. Passos.

You can find the original project at GitHub(howler.js).

Project site: howlerjs.com

8
likes
40
pub points
31%
popularity

Publisher

unverified uploader

Audio library for the modern web. This makes working with audio in Dart easy and reliable across many platforms. (Port of howler.js to Dart)

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

swiss_knife

More

Packages that depend on howler