Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RegionsPlugin Chrome fires "region-out" event immediately on region.play() with MediaElement backend #3866

Open
jaredgei opened this issue Sep 11, 2024 · 5 comments
Labels

Comments

@jaredgei
Copy link

Bug description

When backend is set to MediaElement or not specified, the "region-out" event fires immediately when calling region.play(). It works fine in Safari, or when backend is set to WebAudio.

Environment

  • Browser: Chrome on Mac

Minimal code snippet

  const onPlaySegment = useCallback((idx: number) => {
    const region = regionsPlugin.current.regions[idx];
    region.play();
    regionsPlugin.current.once('region-out', () => { 
      // this fires before the region actually starts playing
      wavesurfer.current.pause();
    });
  }, [regionsPlugin, wavesurfer]);

I'd also really love a playOnce option in regions to just play the region from start to end so I don't need to manually stop the audio.

@jaredgei jaredgei added the bug label Sep 11, 2024
@katspaugh
Copy link
Owner

Likely related to the browser briefly seeking backwards when starting playback.

@MarcRibera
Copy link

Same here!
The "region-out" event is fired immediately when region.play().
This is happening on Chrome with Mac, but works fine on Firefox.

Any idea how to hack it on Chrome?
Any idea if this will be solved soon?

Thanks! I love this library 👍

@jaredgei
Copy link
Author

Same here! The "region-out" event is fired immediately when region.play(). This is happening on Chrome with Mac, but works fine on Firefox.

Any idea how to hack it on Chrome? Any idea if this will be solved soon?

Thanks! I love this library 👍

Try setting backend: WebAudio in the wavesurfer settings, that's working for me for now!

@kinjal017
Copy link

Having Same issue!
The "region-out" event is fired immediately when region.play().
I have tried by setting backend: WebAudio still having same error.

@MarcRibera
Copy link

@jaredgei It works for me too!
Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants