Package Exports
- swave
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (swave) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Swave 
Swave is a Javascript audio player library with waveform visualization.
Live Demo: https://bogdan-cornianu.github.io/swave/examples/
Installation
npm install swave
Usage
let swave = new Swave({audioUrl: 'url...'});
swave.play();Swave uses Web Audio APIs for visualizations, HTMLAudioElement for audio streaming and a Canvas element to draw the sound bars.
The first argument of the constructor is the html element where the canvas should be drawn.
The second argument is a configuration object:
audioUrl: required, the url for the audio to be playedautoPlay: false by defaultcrossOrigin: "anonymous" by defaultshowControls: false by default. If enabled, will display the audio element's playback controls
Swave exposes several methods which you can use to build an audio player:
play(): starts playing the audiostop(): stops playing the audiopause(): pauses the current playing audiosetVolume(number): values between 0.1 and 1enableVisualization(HTMLElement): shows the sound barsdisableVisualization(): hides the sound barsgetDuration(): the length of the audio, in secondssetCurrentTime(number): set the current time of the audiogetCurrentTime(): get the time of the audio as it playschangeAudio(string): the new url of the audio
Contributing
If you find any bugs or have ideas of how Swave can be improved, please open an issue at https://github.com/bogdan-cornianu/swave/issues
If you would like to contribute code please have a look at our open issues, pick something you like and have fun :)
- clone the repo
npm installto install the dev dependenciesnpm run startwill start the webpack dev servernpm run buildwill build the production bundle- fix a bug, implement a feature
- open a pull request
Credits
Cosmin Seviciu https://github.com/ZetCoby