Skip to content

Commit 3cf80a6

Browse files
committed
v5 final
1 parent 9bd10e8 commit 3cf80a6

File tree

22 files changed

+1266
-1947
lines changed

22 files changed

+1266
-1947
lines changed

README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -367,49 +367,49 @@ things I intend to add some day or if you want to help but are not sure what to
367367

368368
if you are interested in helping out 😊 by working on one of the following TODOs, please start by reading the ["contributing"](#contributing-prs-welcome) chapter above
369369

370-
* create a react example
371-
* create a vue.js example
372-
* create an example using the (browser) fileReader, something like:
373-
374-
```javascript
375-
var fileInput = document.querySelector('input[type="file"]');
376-
fileInput.addEventListener('change', function(event) {
377-
var reader = new FileReader();
378-
reader.onload = function(event) {
379-
playerCore._decodeSound(this.result);
380-
};
381-
reader.readAsArrayBuffer(this.files[0]);
382-
}, false);
383-
```
384370

371+
* add a shuffle songs feature
372+
* add a loop song (<https://webaudio.github.io/web-audio-api/#looping-AudioBufferSourceNode>) feature (actually maybe this already works today, need to verify)
373+
* we have sound events, but would player event be useful, like onVolumeChange?
374+
* add (stereo) panning
375+
* allow to add an array of sounds to queue all at once
376+
* allow to add sound to queue after a sound by id (not just at beginning or end, as it is as of now)
377+
* for position and volume, allow to use a percentage or a value, for volume (gain) allow values beyond 0 to 1 to amplify wave or invert it?
385378
* add improve UI style of the "simple" example(s) (or any new example) and then add a screenshot of it to the readme to show what can be achieved
386-
* completely rewrite the sources system, where you can define multiple variants of a sound but with different codecs, app needs to check which codecs are supported by the device and choose one, use should be able to define which codec is preferred if playback support for multiple codecs is available
387379
* destroy the audiocontext at some point, to release memory?
388380
* feature to use the browser notification system to alert which song is being played
389381
* preload AudioBuffers into indexeddb (first song, next song, current song if loop or previous is triggered ...), let the developer set the amount of preloaded AudioBuffers, remove from "cache" by least used and by date when "cache" is full, maybe do such work using this browser feature [requestidlecallback](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback) (when available)
390382
* cache songs for offline mode? indexeddb is not very big (filesystem?), check if doable because saving a playlist of songs might exhaust the free space (depending on the playlist size)
391-
* some methods return a promise others don't, use promises for all to make it more consistent
383+
* some methods return a promise others don't, use promises for all to make it more consistent?
392384
* write more documentation
393385
* make a list of all possible errors (set a distinct code for each error), handle all error cases that are still unhandled
394386
* [abort](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/abort) the loading of the sound if the user clicks play and then pause (or stop / next / previous) before the end of the buffering process
395-
* add new loadPlayerMode similar to XMLHttpRequest but that uses [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to get the sound / song data from server
387+
* add new loadPlayerMode similar to XMLHttpRequest but that uses [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to get the sound / song data from server, fetch as of now is still young, it is not yet possible to get the loading progress (<https://stackoverflow.com/a/69400632/656689>)
396388
* add feature to crossfade two songs "on end" (if there is a the next song in a playlist) or just fade out (current song) / fade in (next song)
389+
* add sound option to set the initial gain value of a sound, for now it is always 1 (1 = no change to loudness), (optional method that lets you define a modifier (or coefficient) per song by which the gain will be changed), useful if some songs are louder than others and you want to normalize the volume of all songs in a playlist to be similar
397390
* currently the "find song in queue" can't retrieve songs by queue index, is this useful anyway?
398-
* use suspend and resume if for some time no sound was played? ... to free device resources. As suspend returns a promise, does this mean suspending and resuming takes time? if so how much time does it take, based on that information we can decide after how much time it makes sense to suspend the ctx to save device resources
391+
* use suspend and resume if for some time no sound was played? ... to free device resources. As suspend returns a promise, does this mean suspending and resuming takes time? if so how much time does it take, based on that information we can decide after how much time it makes sense to suspend the ctx to save device resources, should this be an event of the player so that user can attach a callback to show a dialog like netflix (still wathcing?)
399392
* use web workers, especially for the decoding of the ArrayBuffer into an AudioBuffer, to not block the main thread while decoding?
400-
* add a shuffle songs feature
401-
* add a loop song (<https://webaudio.github.io/web-audio-api/#looping-AudioBufferSourceNode>) feature (actually maybe this already works today, need to verify)
402393
* add support for more codecs? Note: the player should check which codecs are supported by the browser and compare that list with the ones defined in the sound sources, then the player should use the first codec that is supported and that is marked as "isPreferred", if none is marked as "isPreferred" use the first sources codec that is supported
403394
* write code tests!!! (goal ofc 100% coverage), add [tests coverage badge](https://coveralls.io)
404395
* add saucelabs (or similar) browser testing (and their badge [browser compatibility table badge](https://saucelabs.com/blog/new-open-sauce-ui-and-refreshed-build-status-badges) in readme) to add a test suite for all player features
405-
* add [travis](https://travis-ci.org) continuous integration and badge
396+
* use github actions for a CI/CD workflow
406397
* add live demo (via github pages?) for people to see how the player works
407-
* for position and volume, allow to use a percentage or a value
408-
* feature that let's the dev set a volume (via a modifier value / coefficient) per song, useful if some songs are louder than others and you want to normalize the volume of all songs in a playlist to be similar
409398
* add hooks to the sound object for all the native source node events [AudioBufferSourceNode](https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode)
410-
* add (stereo) panning
411-
* allow to add an array of sounds to queue all at once
412-
* allow to add sound to queue after a sound by id (not just at beginning or end, as it is as of now)
399+
* create a react example
400+
* create a vue.js example
401+
* create an example using the (browser) fileReader, something like:
402+
403+
```javascript
404+
var fileInput = document.querySelector('input[type="file"]');
405+
fileInput.addEventListener('change', function(event) {
406+
var reader = new FileReader();
407+
reader.onload = function(event) {
408+
playerCore._decodeSound(this.result);
409+
};
410+
reader.readAsArrayBuffer(this.files[0]);
411+
}, false);
412+
```
413413

414414
## note to self: publish package on npmjs.com
415415

dist/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { PlayerCore, ICoreOptions } from './library/core';
1+
export { PlayerCore, ICoreOptions, ISoundsQueueOptions, IPlayOptions } from './library/core';
22
export { PlayerSound, ISoundAttributes, ISound } from './library/sound';

0 commit comments

Comments
 (0)