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.

Regions plugin "Generic events - out" doesn't fires.

See original GitHub issue

Generic events in - When playback enters the region. - that works fine. out - When playback leaves the region. - that doesn’t.

region_info.on('in',() => { console.log('start') }); // awesome region_info.on('out',() => { console.log('stop') }); // sucks

Any ideas?

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
mspaecommented, Aug 18, 2017

Can’t reproduce. This works fine for me

    // Init
    wavesurfer = WaveSurfer.create({
        container: document.querySelector('#waveform'),
        waveColor: '#A8DBA8',
        progressColor: '#3B8686',
        backend: 'MediaElement',
        plugins: [
            WaveSurfer.regions.create({
                regions: [
                    {
                        start: 1,
                        end: 3,
                        color: 'hsla(400, 100%, 30%, 0.5)'
                    }, {
                        start: 5,
                        end: 7,
                        color: 'hsla(200, 50%, 70%, 0.4)'
                    }
                ],
                dragSelection: {
                    slop: 5
                }
            })
        ]
    });

    wavesurfer.on('region-created', function (region) {
        region.on('in', function(e) {
          console.log('in ', region.id);
        });
        region.on('out', function(e) {
          console.log('out ', region.id);
        });
    });

    // Load audio from URL
    wavesurfer.load('../media/demo.wav');
0reactions
PaulLernercommented, Dec 16, 2019

Hello, do you have any hints on how to fix this issue ? I’m having the same problem in gecko : https://github.com/gong-io/gecko/issues/27 (we closed the issue because we found some trick but it’s not really satisfying)

I encounter the same problem that sometimes the region ‘out’ event doesn’t fire when audio region finishes playing. It happened when I set the region to be between two decimal numbers, like start = 165.69 end = 169.44 I believe this happens because the plugin use

this.end <= Math.round(time * 100) / 100)

as condition to fire out event. It would sometimes round the actually end time to be a bit lower than the specified end time which then cause this issue.

ps. sorry but somehow my github don’t let me insert code or use markdown

I’m not sure this is the cause of the bug, Math.round(169.44 * 100) / 100 gives 169.44

Bests,

Read more comments on GitHub >

github_iconTop Results From Across the Web

Regions plugin "Generic events - out" doesn't fires. - - Bountysource
Generic events in - When playback enters the region. - that works fine. out - When playback leaves the region. - that doesn't....
Read more >
Regions plugin - wavesurfer.js
Regions plugin. Regions are visual overlays on waveform that can be used to play and loop portions of audio. Regions can be dragged...
Read more >
Automation Jira receives 2 events when only listen...
Hey all, first time posting :) For some reason a status which Fires two Events, Jira Automation if listening for a specific event...
Read more >
Apollo Server plugin event reference - Apollo GraphQL Docs
Server lifecycle events. serverWillStart. The serverWillStart event fires when Apollo Server is preparing to start serving GraphQL requests. The server doesn't ...
Read more >
#GTMtips: Create A Generic Event Tag | Simo Ahava's blog
You need one for each of the most-used Google Analytics Event fields. If you never use Event Value, you can leave it out,...
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