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.

Electron + Wavesurfer waveform not showing.

See original GitHub issue

Wavesurfer.js version(s): 3.0.0(?)

Browser and operating system version(s):

Chromium on Windows 10 1903

Code needed to reproduce the issue:

        <nav class="navbar fixed-bottom navbar-expand-sm navbar-dark bg-dark text-center">
            <div class="btn-group" role="group" aria-label="Basic example">
                <button type="button" class="btn btn-secondary" id="prev" onclick="wavesurfer.skipBackward()"><i class="material-icons">skip_previous</i></button>
                <button type="button" class="btn btn-secondary" id="play" onclick="wavesurfer.playPause(); if (document.getElementById('playpause').innerText == 'pause') {document.getElementById('playpause').innerText = 'play_arrow'} else {document.getElementById('playpause').innerText = 'pause'};"><i class="material-icons" id="playpause">pause</i></button>
                <button type="button" class="btn btn-secondary" id="next" onclick="wavesurfer.skipForward()"><i class="material-icons">skip_next</i></button>
            </div>
            <div id="waveform" style="display: none"></div>
            <ul class="nav navbar-nav ml-auto w-100 justify-content-end">
              <input type="range" min="1" max="100" value="50" class="slider" id="myRange">
            </ul>
          </nav>

Use behaviour needed to reproduce the issue:

I’m using Electron.js v6.0.6 with Wavesurfer.js to make an app. Electron uses Chromium as the browser.

My issue is that the waveform does not show up when it should be made. My code to generate the waveform is here:

        stream.on('finish', () => {
            console.log('stream end');
            wavesurfer.load('./temp_music/song.mp3');
            wavesurfer.on('ready', () => {
              wavesurfer.drawer.container.style.display = '';
              wavesurfer.drawBuffer();
              ytdl.getBasicInfo(id, (err, info) => {
                if (err) throw err;
                console.log(info)
                var jsonSend = {
                  dur: wavesurfer.getDuration(),
                  author: info.author.name,
                  title: info.title
                }
                require('electron').ipcRenderer.send('presence', jsonSend)
              })
              wavesurfer.play()
            })
        });

Here is what it looks like https://dabon.me/ASBIgD7c.png

The middle empty space is where the waveform should be, but it isn’t showing.

What do I do?

Thanks.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
thijstriemstracommented, Sep 10, 2019

Why are you using this code?

wavesurfer.drawer.container.style.display = '';
wavesurfer.drawBuffer();
0reactions
ygwStudycommented, Jul 14, 2021

Why are you using this code?

wavesurfer.drawer.container.style.display = '';
wavesurfer.drawBuffer();

Thans!Using “wavesurfer.drawBuffer()” after “wavesurfer.drawer.updateSize()” can resize the canvas.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WaveSurfer.js waveform not appearing when the container is ...
WaveSurfer has this problem, when the container or parent container where the waveform should be drawn, isn't visible and therefore it doesn't ...
Read more >
Open local file in electron and render in wavesurfer.js
I'm working on an app built with electron, it should work with wavesurfer.js to display a waveform representing the audio file.
Read more >
wavesurfer.js
wavesurfer.js is an HTML 5 audio player and waveform visualizer, made with JavaScript and Web Audio. ... Create a container where the waveform...
Read more >
Javascript – Open local file in electron and render in wavesurfer.js ...
electron fsjavascriptreadfile. I'm working on an app built with electron, it should work with wavesurfer.js to display a waveform representing the audio file ......
Read more >
wavesurfer oscilloscope - Cal.equipment
This electronic product is subject to disposal ... information for your WaveSurfer 400 Series oscilloscope along ... you display your waveform and reveal....
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