Blazored / Video

The easiest html5 video implementation for Blazor applications
https://blazored.github.io/Video
MIT License
124 stars 28 forks source link

[Bug] JS exceptions are not propagated to C# when calling DoInvokeAsync methods in WebAssembly #30

Open Mike-FB opened 9 months ago

Mike-FB commented 9 months ago

Describe the bug JS exceptions does not get propagated to C# when calling methods such as StartPlayback, Instead they end up as an 'Uncaught (in promise) DOMException'. This seems to happen due to trying to handle the JS promise synchronously in BlazoredVideo.DoInvokeAsync/DoInvokeAsync when running in WebAssembly. When I pulled down the code and tested with the IJSInProcessObjectReference code removed, the issue seemed to be resolved.

To Reproduce Steps to reproduce the behavior (In Chrome, as chrome will throw an exception when trying to start unmuted playback without user interaction):

  1. Go to the file 'AllEventsAllOptions.razor' in the project 'SharedRCL' from your own samples.
  2. Add an action to the BlazoredVideo elements CanPlay with the following code await video.StartPlayback();
  3. Start the WebAssembly project without interacting with any content, wait for all content to load.
  4. Open the devtools and look in console. There should be an 'Uncaught (in promise) DOMException'.

Expected behavior The JSException should be propagated to C# so that it can be handled appropriately.

Screenshots Example of the uncaught exception: image

Hosting Model (is this issue happening with a certain hosting model?):