Blazored/Video

[Bug] How to set autoplay and loop options? Not working atm.

progMorten opened this issue · 1 comments

Hi!
I am working on a hobby project at the moment, trying to incorporate this video component, but Im struggling to implementing AutoPlay and Loop on load, without the controls. I am trying to implement this kind of fullscreen playing in the background with some text above, so I need the controls hidden. I have tried setting different state options in OnInitialized:

options[VideoEvents.CanPlay] = new VideoStateOptions { Autoplay = true,Loop = true };
options[VideoEvents.LoadStart] = new VideoStateOptions { Autoplay = true, Loop = true };
options[VideoEvents.Progress] = new VideoStateOptions { Autoplay = true, Loop = true };

But the video just does not start. I also tried adding different OnCanPlay, OnLoadStart and OnProgress methods with break points, but they never hit. So the video never starts.

is this anything you could help me with? Thanks for your contribution! :)

Kind regards,
Morten

Hi,

You can just use the attributes for that

<BlazoredVideo @ref="video" EventFired="OnEvent"
		 VideoEventOptions="options"

		 autoplay="autoplay" 
		 loop="loop" >

	<source src="samples/elephants.mp4" type="video/mp4" />
</BlazoredVideo>