beaverlyhillsstudios/wavesurfer-blazor-wrapper

OnFinish Exception

Closed this issue · 2 comments

When audio is playing and reaches the end, an exception is thrown: Uncaught (in promise) Error: System.ArgumentException: The type 'WavesurferPlayer' does not contain a public invokable method with [JSInvokableAttribute("OnWavesurferFinish")].

This exception appears to trigger from wavesurfer-user.js line 63. The JS interop is calling back to the "OnWavesurferPause" invokable method, but there is no method in WavesurferPlayer.razor that has [JSInvokable("OnWavesurferFinish")] attached to it, which calls the OnFinish EventCallback.

I think just adding this to WavesurferPlayer.razor would possibly work:

[JSInvokable]
public async Task OnWavesurferFinish()
{
    await OnFinish.InvokeAsync();
}

I could add this if you want. If that's ok with you, how would you prefer that be done? I could create a branch, add the changes and make a PR. Let me know if that's helpful or if you'd rather look into this on your own. Thank you!

Fixed in release 0.2.1

Confirmed it's working on new build. Thanks!