Skip to content

v5.1.0

Compare
Choose a tag to compare
@chrisweb chrisweb released this 03 Oct 20:15
· 70 commits to main since this release
  • 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