@page "/"
@inject IJSRuntime theJavaScriptEngine;
<h1>Hello, world!</h1>
<div class="align-content-center">
<h1>@m_strRenderMe[currentVideo]</h1>
<button @onclick="ChangeVideo">Change video</button>
<video id="videoTagId" autoplay width="1080" height="720">
<source id="videoSourceId" src="@m_strRenderMe[currentVideo]" type="video/mp4" />
</video>
</div>
@code
{
int currentVideo = 0;
string[] m_strRenderMe = new string[] {
"https://whatsappstatusvideo.in/wp-content/uploads/2019/03/videoplayback-1.mp4",
"https://whatsappstatusvideo.in/wp-content/uploads/2019/03/videoplayback-2.mp4"
};
protected void ChangeVideo()
{
currentVideo = (currentVideo + 1) % 2;
theJavaScriptEngine.InvokeVoidAsync("loadVideo");
}
}