I'd like to understand if there is a way of setting value of HTMLMediaElement properties playbackRate
from Blazor WebAssembly without resorting to javascript interoperability (https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playbackRate).
Since Blazor cannot access DOM elements directly (and it is not meant to do it), I think the answer is no and I need to use javascript interoperability. Howerver I'm not much of an expert, so I'm asking.
I know there are projects helping in managing videos in Blazor, like Vidazor, but in the end they use javascript interop too, and I'd like to avoid that as much as possible.
Thank you very much
Unfortunately, JavaScript Interop is required here.
At the moment,
HTMLElement
(and inheriting types, includingHTMLMediaElement
) properties that cannot be set via attributes (i.e. where updating the markup is possible) require JavaScript, regardless of your tech stack. Even if .NET came with a fuller DOM API, it would still require JS interop under the hood.Note: for Blazor WebAssembly (and other WASM technologies), this might eventually be possible, directly.