Skip to content

Releases: chrisweb/web-audio-api-player

v5.3.1

30 Mar 18:10
Compare
Choose a tag to compare
  • maintenance update: after updating to latest typescript the build format slighlty changed but no other code changes in this release

v5.3.0

03 Jan 18:22
Compare
Choose a tag to compare
  • after experimenting with the player on mobile I noticed that muting the sound when the visibility api reports that the app is hidden is actually not ideal because the song keeps playing and if hidden for a while it might even reach the end of the song, when that happens the player triggers an event but the player UI might not be able to react as the page is hidden, so I changed how the visibility API feature works, it now pauses the song when hidden (if the visibility watch feature is enabled / it is not by default), I put added a second option to choose what action gets performed if hidden, by default it will pause the song but you can chose to mute the song if that's what you prefer... I also updated the simple example and updated the docs to reflect the changes

breaking changes:

  • removed the option visibilityAutoMute
  • added new option: visibilityWatch (boolean, default: false)
  • added second option: visibilityHiddenAction (default: PlayerCore.VISIBILITY_HIDDEN_ACTION_PAUSE)

check out the player options documentation for more details

v5.2.1

16 Nov 18:50
Compare
Choose a tag to compare

v5.1.1

06 Oct 15:49
Compare
Choose a tag to compare
  • fixed a bug where safari would not call onended if the currentTime of the audio element got set to a value equal to the duration
  • fixed a bug where visibility change would call unmute and but the gain value was not a number
  • fixed bug where player was calling next() even though willPlayNext indicated that queue is empty (and loop queue was not active)
  • removed the console.warn when there are no more sounds in the queue, the willPlayNext of the onEnded callback already tells you there is no next sound
  • reverted change that would round duration and currentTime, I think it is best to return the original value and let the UI decide how it wants to format it, revert audio element preload value (from "metadata") to "auto"

v5.1.0

03 Oct 20:15
Compare
Choose a tag to compare
  • breaking change: renamed "createAudioContextOnFirstUserInteraction" to "unlockAudioOnFirstUserInteraction"
  • fixed a bug where on start the playing percentage returned NaN
  • fixed a bug where the player on iOS devices would not always play or not trigger progress callbacks
  • fixed the isMuted function which was always returning the opposite of what should be the correct value
  • fixed a case where a song duration that had been set manually would get overwriten
  • if playTimeOffset or a setPosition function is called with a value that is > sound duration the player will now output a console warning to let you know something is not right
  • both setPosition and setPositionInSeconds are now faster when using the "player_mode_audio", previously the song would get paused and then started playing at the new position, now the position gets changed and no pause gets triggered, unfortunatly fastseek is only available on firefox so it does not get used yet, for "player_mode_ajax" there is no seek, the sound still needs to get stopped and then re-started at the new position as the audio buffer source can not be re-used
  • added a new player core options called "addAudioElementToDom", which is false by default, meaning the audi element will be kept offscreen, if you still want to add it to the DOM set this option to true
  • added a new onSeeking callback for sounds, this callback gets called when the position gets changed, useful for example when the sound is not playing and the user clicks on the progress bar, which triggers a position change, using the onSeeking you can then ajust values like the current progress position and playTime
  • added new functions setLoop() and getLoop() to the sound object, those can be used after a sound got added to the queue to change the value for "loop song" or check what the current value is
  • added a getCurrentSound function to the player
  • added a player option called "volumeTransitionTime", to change the volume transition duration, by default 100ms, set it to 0 for an instant transition, if > 0 a player volume change will fade from current value to new value
  • most player methods now return a promise, this does not change the current behavior, but if you want to use them you now can, I recommend using a try catch and await the promise or call promise.catch to be able to catch eventual errors thrown by the player
  • increased the target version for typescript to es2016 (as it almost 2024 now), this decreased the bundle size by a quarter
  • addeda mute/unmute button to the example
  • added play songs by ID to the example and a show extra song info from an external source (extra info like song title, album cover, artist name, ...)
  • added a play a song by ID and with a playTimeOffset (does not start at the beginning of the song but at 10 seconds) to the example
  • added two new buttons to the example, to show a toggle loop sound and a toggle for loop queue
  • improved readme documentation by listing all available player functions as well as the sound functions
  • improved callbacks documentation in readme, by adding description of callback parameters
  • added a new chapter to readme to explain why audio can be locked on mobile and how to unlock it

v5.0.4

17 Sep 21:50
Compare
Choose a tag to compare
  • improve player.disconnect() feature (before disconnecting a sound it checks if the sound had been connected, which is not always the case)

v5.0.3

17 Sep 21:01
Compare
Choose a tag to compare
  • Fix bug where next song would always skip one position in queue (Fixes #24)

v5.0.2

09 Sep 00:40
Compare
Choose a tag to compare
  • improve the find best source method (exit loop early if we find a preferred and supported source)

v5.0.0

30 Aug 18:16
Compare
Choose a tag to compare

v5.0 contains a lot of improvements compared to the v4.x branch, but the API is fully compatible with the 4.x series

  • fixed several bugs related to the volume, like setting volume before playing a sound or getting intial volume to update UI accordingly
  • each sound now has it's own gain node, this will allow in future version to let the user adjust the loudness of sounds in a playlist on a per sound basis and also to crossfade sounds or add a fade in / out to sounds
  • promises got replaced by more modern async / await which resulted in cleaner code
  • fixed several typescript types (I use typescript and tested this a lot, but if you find a wrong type or know how to improve the types (interfaces) then please open a ticket / PR)
  • improved documentation / readme
  • added some more buttons to example to show how to use them if needed

v5 on npmjs

the audio player has no external dependencies

v4.3.1

02 Aug 22:18
Compare
Choose a tag to compare
  • fix bug, where loop queue is enabled and next() would throw error that there are no more song if current song is last, if loop is enabled the next song after "last" should be "first" again