'How to call OnPlay when using YouTube embedded code in a Blazor WASM project
I am using the following to embed a YouTube video in my Blazor WASM project. I want to know how know when the video is actually played. There is an IFrame "onplay" method but when I try to tie it to my Blazor method the Blazor method does not get called.
Here is my code:
<iframe width="@width" height="@height" src="@url" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen onplay=@OnPlay> </iframe>
private async Task OnPlay()
{
// I do something here
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
