Home

Awesome

musique.js Build Status devDependency Status

A JavaScript Music Player API to create custom players.

How-to

Add musique.js into your HTML file.

You should download the library and reference the JavaScript file using a <script> tag somewhere on your HTML pages.

<script src="musique.min.js"></script>

Create a new instance of Musique.

Once added the library you can create a new instance of Musique with an optinal configuration and a playlist.

var musique = new Musique({
    'volume': 75,
    'autoplay': true,
    'playlist': [{
        'title': 'Title Track 01',
        'artist': 'Artist Track 01',
        'album': 'Album Track 01',
        'poster': 'https://foo.com/track01.jpg',
        'src': 'https://foo.com/track01.mp3'
    },
    {
        'title': 'Title Track 02',
        'artist': 'Artist Track 02',
        'album': 'Album Track 02',
        'poster': 'https://foo.com/track02.jpg',
        'src': 'https://foo.com/track02.mp3'
    }]
});

Create and Enjoy!

Now, you can use the API to create awesome music players.

musique.next();

API

Table of contents

Musique(options)

Creates a new instance of Musique.

var musique = new Musique({
    'volume': '75'
});

Musique#play([indexTrack])

Starts playback the current or a given indexTrack.

musique.play();
musique.play(12);

Musique#setTrack(indexTrack)

Sets a given indexTrack as current track.

musique.setTrack(4);

Musique#pause()

Pauses playback.

musique.pause();

Musique#stop()

Stops playback and seeks to the beginning.

musique.stop();

Musique#next()

Jumps to the next track.

musique.next();

Musique#prev()

Jumps to the previous track.

musique.prev();

Musique#volume(value)

Defines the volumen as a value from 0 to 100.

musique.volume(75);

Musique#mute()

Mutes an instance of Musique.

musique.mute();

Musique#reset()

Reset the current track to the initial.

musique.reset();

Musique#toggle()

Toggles between pause and play.

musique.toggle();

## Maintained by

License

Licensed under the MIT license.

Copyright (c) 2014 @pazguille.