Wavesurfer.js: Error calling wavesurfer.seekTo, parameter must be a number between 0 and 1

Created on 27 Nov 2019  路  7Comments  路  Source: katspaugh/wavesurfer.js

Hi!

Thank you for your work :)

Wavesurfer.js version:

3.2.0

Browser and operating system version(s):

LinuxMint, Opera 65.0, Firefox70.0.1

Code needed to reproduce the issue:

var wavesurfer = WaveSurfer.create({
    container: '#player-wrap-'+u.data.id,
    waveColor: '#94919C',
    progressColor: '#007DFF',
    height: 50,
    pixelRatio: 1,
    cursorColor: '#fff',
    normalize: true,
    responsive: true
});
// blob in webm format
// and checked with wavesurfer.load('audio.wav');
wavesurfer.loadBlob(u.data.blob);
wavesurfer.on('ready', function () {
    wavesurfer.play();
});
// audioprocess event returns correct data
// wavesurfer.on('audioprocess', updateTimer);

Result if seek

袙褘写械谢械薪懈械_140

bug

Most helpful comment

It is reproducible on main page if you click exactly on 0 position or 1 pixel to the left of it.
image

All 7 comments

Result if seek

Your example code doesn't include a call to seekTo, where and how are you calling this?

I click on the waveform

I have the same thing happening but I can't reproduce it in a codepen... It happens when the wavesurfer is playing and you click exactly 1 pixel before the start of the waveform. Seems that 1 pixel is causing it to seek to a value below 0. The value was -0.00375 for me.
This happened on a very small 200px waveform.

image

Yeah, this is a critical mistake.
image

could not reproduce it, but we have seen, it could happen
@thijstriemstra i create a branch with a possible fix, please have a look, after that i create the PR

It is reproducible on main page if you click exactly on 0 position or 1 pixel to the left of it.
image

@aburai Your commit here (https://github.com/katspaugh/wavesurfer.js/commit/f3b0561383071f13f5b311d2b0b0490d9380b129) looks good to me. Do you think you'll get a chance to PR this / release soon? Thanks :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

frumbert picture frumbert  路  4Comments

CramericaIndustries picture CramericaIndustries  路  4Comments

SGDAT picture SGDAT  路  3Comments

Mamadou99 picture Mamadou99  路  3Comments

itamaker picture itamaker  路  4Comments