Hello Radzen Team!
I'm trying to play a webcam in my server-side Blazor app, using the webcamjs lib.
This is what's in my .razor page:
<div id="camera" style="width: 320px; height: 240px;">
<div></div>
<video autoplay="autoplay" playsinline="playsinline" style="width: 320px; height: 240px;"></video>
</div>
<button @onclick="Play">Play</button>
@code {
void Play() {
JSRuntime.InvokeVoidAsync("play");
}
}
And this is what I have in the _Host.cshtml page:
<script type="text/javascript" src="assets/sdks/webcamjs/webcam.js"></script>
<script language="JavaScript">
function play() {
Webcam.set({
width: 320,
height: 240,
image_format: 'jpeg',
jpeg_quality: 90
});
Webcam.attach($("#camera") );
}
</script>
How can I make sure that the .js code is actually being executed?