https://github.com/dank074/music-player
Plays Habbo Trax music
https://github.com/dank074/music-player
habbo jukebox trax
Last synced: 4 months ago
JSON representation
Plays Habbo Trax music
- Host: GitHub
- URL: https://github.com/dank074/music-player
- Owner: dank074
- License: gpl-3.0
- Created: 2022-10-29T21:26:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-04T07:32:38.000Z (over 2 years ago)
- Last Synced: 2025-01-27T11:32:39.953Z (5 months ago)
- Topics: habbo, jukebox, trax
- Language: TypeScript
- Homepage:
- Size: 117 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# music-player
Plays habbo trax musicTest it out at https://dank074.github.io/music-player/
## Usage
```
npm install @dank074/music-player
```
## Listening for events
You can listen for specific events emmited by the music player. Available events are:
- "playing"
- "stopped"
- "paused"
- "loading"
- "time"
- "songended"example:
```js
const player = new MusicPlayer( 'https://flash.nitrodev.co/dcr/hof_furni/mp3/sound_machine_sample_%sample%.mp3');player.on("playing", (currentTime, totalTime) => {
console.log("now playing at time" + currentTime + "/" + totalTime);
});player.on("time", (pos) => {
console.log("current time: " + pos);
})
```
## Running example
1. build the trax player library by running ```npm install && npm run build``` in the main directory. This will create the built files in the dist directory
2. navigate to `/example` directory and run
``` npm install && npm run start```
This will start the example## Trax track format
The track string follows the following format:There can be 1 to n channels in a track. Channels are split by the `:` character.
Each channel consists of channel entries which are split by the `;` character.
A channel entry describes the sound id and duration of the sound, split by the `,` character. Duration is in blocks, and each block is 2 seconds long.
For example, the track `1:4,4:2:3,2;2,1:` results in the following:
Second: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| --- | --- | --- | --- | ---- | --- | --- | --- | --- |
| channel 1: | 4| 4 | 4 | 4 | 4| 4 | 4 | 4
| channel 2: | 3 | 3 | 3 | 3 | 2 | 2 | | |