Skip to content

Commit 7a7c2cc

Browse files
committed
Release 2.0.0: convert to typescript
1 parent 5f7084c commit 7a7c2cc

File tree

13 files changed

+5853
-640
lines changed

13 files changed

+5853
-640
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ nbproject
1818
.eslintcache
1919

2020
package-lock.json
21+
22+
dist/

LICENSE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2017 Daniel Saewitz
3+
Copyright (c) 2017-2025 Daniel Saewitz
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@ You can see a sample of the library in use currently at <Relisten.live> which is
1111
## Sample usage
1212

1313
```javascript
14-
const player = new Gapless.Queue({
15-
tracks: [
16-
"http://phish.in/audio/000/012/321/12321.mp3",
17-
"http://phish.in/audio/000/012/322/12322.mp3",
18-
"http://phish.in/audio/000/012/323/12323.mp3",
19-
"http://phish.in/audio/000/012/324/12324.mp3"
20-
],
21-
onProgress: function(track) {
22-
track && console.log(track.completeState);
23-
}
24-
});
25-
26-
player.play();
14+
import GaplessQueue from 'gapless.js';
15+
16+
const player = new GaplessQueue({
17+
tracks: [
18+
"http://phish.in/audio/000/012/321/12321.mp3",
19+
"http://phish.in/audio/000/012/322/12322.mp3",
20+
"http://phish.in/audio/000/012/323/12323.mp3",
21+
"http://phish.in/audio/000/012/324/12324.mp3"
22+
],
23+
onProgress: function(track) {
24+
track && console.log(track.completeState);
25+
}
26+
});
27+
28+
player.play();
2729
```
2830

2931
## Gapless.Queue Options

eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import main from '@switz/eslint-config';
2+
3+
export default main;

index.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
<!DOCTYPE html>
22
<html>
3+
34
<head>
45
<title></title>
56
<style type="text/css">
6-
html, body {
7+
html,
8+
body {
79
width: 600px;
810
}
9-
11+
1012
.loaded {
1113
color: green;
1214
}
1315
</style>
1416
</head>
17+
1518
<body>
1619
<h4>
17-
You'll want to wait until WebAudio is loaded for both the current track and the next track before jumping to the end. Otherwise you may notice a slight gap. If both WebAudios are fully loaded you should hear no discernable gap most of the time.
20+
You'll want to wait until WebAudio is loaded for both the current track and the next track before jumping to the
21+
end. Otherwise you may notice a slight gap. If both WebAudios are fully loaded you should hear no discernable gap
22+
most of the time.
1823
</h4>
1924

2025
<div onClick="player.currentTrack.seekToEnd()">Click to jump to end of track</div>
@@ -24,19 +29,13 @@ <h4>
2429
<script type="text/javascript" src="./index.js"></script>
2530
<script type="text/javascript">
2631
window.player = new Gapless.Queue({
27-
// tracks: [
28-
// "http://phish.in/audio/000/012/321/12321.mp3",
29-
// "http://phish.in/audio/000/012/322/12322.mp3",
30-
// "http://phish.in/audio/000/012/323/12323.mp3",
31-
// "http://phish.in/audio/000/012/324/12324.mp3"
32-
// ]
3332
tracks: [
3433
"https://archive.org/download/jrad2017-03-17.cmc621.cmc64.sbd.matrix.flac16/jrad2017-03-17.cmc621.cmc64.sbd.matrix-s2t03.mp3",
3534
"https://archive.org/download/jrad2017-03-17.cmc621.cmc64.sbd.matrix.flac16/jrad2017-03-17.cmc621.cmc64.sbd.matrix-s2t04.mp3",
3635
"https://archive.org/download/jrad2017-03-17.cmc621.cmc64.sbd.matrix.flac16/jrad2017-03-17.cmc621.cmc64.sbd.matrix-s2t05.mp3",
3736
"https://archive.org/download/jrad2017-03-17.cmc621.cmc64.sbd.matrix.flac16/jrad2017-03-17.cmc621.cmc64.sbd.matrix-s2t06.mp3"
3837
],
39-
onProgress: function(track) {
38+
onProgress: function (track) {
4039
if (player.nextTrack && player.nextTrack.webAudioLoadingState === 'LOADED') {
4140
document.querySelector('#ready').classList.add('loaded');
4241
document.querySelector('#ready').innerHTML = 'Both tracks are LOADED';
@@ -52,4 +51,5 @@ <h4>
5251

5352
</script>
5453
</body>
55-
</html>
54+
55+
</html>

0 commit comments

Comments
 (0)