question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Waveform hides when scrolling to the end on mediaElement loaded server generated waveform

See original GitHub issue

Wavesurfer.js version(s):

“wavesurfer.js”: “^2.1.0”,

Browser version(s):

Version 71.0.3578.98

Code needed to reproduce the issue:

My audio element:

<audio id="audio"><source src={this.state.audioURL} type="audio/mp3"></source></audio>

I set the media element;

this.mediaElt = document.getElementById(‘audio’);

I am loading it like this:

 this.wavesurfer = WaveSurfer.create({
    container: '#waveform',
    waveColor: 'gray',
    progressColor: 'rgb(14, 204, 208)',
    barWidth: 3,
    partialRender: true,
    responsive: true,
    scrollParent: true,
    scrollSpeed: 3,
    scrollThreshold: 50,
    height: 60,
    normalize: true,
    backend: 'MediaElement'
   })

I generate waveform on server:

audiowaveform -i ${inputAudio} -o ${outputWaveform} -b 8 --height 25 --pixels-per-second 100

Once axios fetch returns, I am loading the generated waveform and audio file, and then calling this.mediaElt.load() to tell the media element that the audio source has been updated

this.wavesurfer.load(this.mediaElt, this.state.waveformURL.data);

Everything loads and plays nicely, though I am experiencing two key problems.

  1. When I scroll left or right, the scroll bar unhides, however when I leave the waveform area, it never unhides again. Sometimes it does, other times it doesn’t. It is very random in that sense. This was still occurring when I was using webaudio and not the mediaElement.

  2. More importantly, when I scroll to the end of the waveform, it disappears completely and doesn’t return. I believe this is an issue with the length of the audio/waveform that is being loaded.

e.target.scrollWidth (scroll width of the container) 34762

scrollWaveLeft (position at the end once I have completed scrolling) 33904

difference 858

So I can’t scroll anymore, though it is saying that I still have 858 to scroll. At this point, the waveform completely disappears and I cannot see anything, though the audio still plays all the way to the end. On that note, the waveform does not sit flush with the left hand side of the screen, there is a 155px margin on the left. So I am unsure whether this has anything to do with this issue.

Any suggestions greatly appreciated.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
rockyhubercommented, Apr 8, 2019

Hi, sorry for the delay mate. Don’t receive github notifications in email for some reason. I have done some custom work to wavesurfer, so will need to merge the code bases. Will let you know if the 2.2.0 fixes work in due course.

0reactions
thijstriemstracommented, Mar 31, 2019

no feedback, closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scrolling through a waveform - Stack Overflow
I have a waveform visualiser I am trying to make for some audio editing, and need to be able to scroll through the...
Read more >
third_party/blink/web_tests/TestExpectations - chromium/src - Git at ...
crbug.com/949003 http/tests/printing/cross-site-frame-scrolled.html ... -parsing/generated/page-load/math-font-script-src.tentative.html [ Failure ].
Read more >
Peaks.js: JavaScript UI Component for Interacting with Audio ...
Depending on the options specified, the waveform is either requested from a server or is generated by the browser using the Web Audio...
Read more >
1 INTRODUCTION TO COMPUTER
software can be loaded on the same hardware to perform different kinds of tasks. ... to the computer, which is processed to generate...
Read more >
McLuhan.js: Live Net Art Performance with Remote Web ...
McLuhan.js contains client-side and server-side tools for creating net art, ... phonographs: perhaps a human could draw waveform grooves into a wax cylinder....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found