
setPlaybackRate(rate) – Sets the speed of playback ( 0.5 is half speed, 1 is normal speed, 2 is double speed and so on). setFilter(filters) - For inserting your own WebAudio nodes into the graph. seekTo(progress) – Seeks to a progress (0=beginning, 1=end). seekAndCenter(progress) – Seeks to a progress and centers view (0 = beginning, 1 = end). playPause() – Plays if paused, pauses if playing. Optional start and end measured in seconds can be used to set the range of audio to play. play(]) – Starts playback from the current position. unAll() – Unsubscribes from all events. un(eventName, callback) – Unsubscribes from an event. See WaveSurfer Events section below for a list. on(eventName, callback) – Subscribes to an event. loadBlob(url) – Loads audio from a Blob or File object. load(url) – Loads audio from URL via XHR. isPlaying() – Returns true if currently playing, false otherwise. getDuration() – Returns the duration of an audio clip in seconds. getCurrentTime() – Returns current progress in seconds. empty() – Clears the waveform as if a zero-length audio is loaded. destroy() – Removes events, elements and disconnects Web Audio nodes. init(options) – Initializes with the options listed above. The fill color of the waveform after the cursor.Īll methods are intentionally public, but the most readily available are the following: Number of seconds to skip with the skipForward() and skipBackward() methods. Otherwise the waveform is shrunk to the container width (see fillParent). Whether to scroll the container with a lengthy waveform. The fill color of the part of the waveform behind the cursor. If true, normalize by the maximum peak instead of 1.0. Minimum number of pixels per second of audio. You can switch this parameter at any time later on. Whether the mouse interaction will be enabled at initialization. Whether to hide the horizontal scrollbar when one would normally be shown. Whether to fill the entire container or draw only according to minPxPerSec. The fill color of the cursor indicating the playhead position. If specified, the waveform will be drawn like this: ▁ ▂ ▇ ▃ ▅ ▂ĬSS-selector or HTML-element where the waveform should be drawn. MediaElement is a fallback for unsupported browsers. In most cases you don't have to set this manually. Use your own previously initialized AudioContext or leave blank.
load( 'example/media/demo.wav ') įor a list of other projects using wavesurfer.js, check out See here: (the "Pre-recoded Peaks" section). You can however load pre-decoded waveform data to draw the waveform immediately. Web Audio needs the whole file to decode it in the browser. A thin line will be displayed until the whole audio file is downloaded and decoded to draw the waveform. The audio will start playing as you press play. Yes, if you use the backend: 'MediaElement' option. Can the audio start playing before the waveform is drawn?
Can I pay you for a wavesurfer.js job?įor payed consultancy, feel free to email me For trivial questions about programming, please The test case can be either a Jasmine spec, or a simple HTML To report a bug, please create a failing test case and submit a pull It will fallback to Audio Element in other browsers (withoutĪ Flash-based fallback with graphics. Wavesurfer.js works only in modern browsers supporting Web Audio Interactive navigable audio visualization using