15.1.1 • Published 5 months ago

@game-vir/audio v15.1.1

Weekly downloads
-
License
(MIT or CC0 1.0)
Repository
github
Last release
5 months ago

@game-vir/audio

A package for storing, loading, unloading, and playing audio files.

API reference: https://electrovir.github.io/game-vir/audio

Install

npm i @game-vir/audio

Usage

The AudioPlayer class is the main entry point to this package:

import {AudioPlayer} from '../audio-player.js';

export const audioPlayer = new AudioPlayer({
    sound1: {
        /**
         * An array of possible source file URLs. The first one that is supported by the current
         * browser will be used.
         */
        sources: [
            '/sound1.flac',
            '/sound1.mp3',
        ],
    },
    sound2: {
        sources: [
            '/sound2.mp3',
        ],
    },
});

await audioPlayer.loadAll();

await audioPlayer.play.sound1();
15.1.1

5 months ago

15.1.0

5 months ago

15.0.1

5 months ago

15.0.0

5 months ago

14.10.0

5 months ago

14.9.1

5 months ago

14.9.0

5 months ago

14.8.0

5 months ago