-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/video queue #23
base: main
Are you sure you want to change the base?
Conversation
Added VideoQueue Example
…into feature/VideoQueue
Thanks for this interesting contribution - I'll hopefully get time to review it within the next couple of days. |
Added additional check that no prior event is overwritten
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few items I would like you to review - I am open to different opinions / corrections to my comments, so feel free to defend your position 😄
src/Blazored.Video/VideoQueue.cs
Outdated
} | ||
|
||
/// <summary> | ||
/// Specifies the delay between source changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer this to be a TimeSpan to avoid confusion about units.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timespan Binding is a bit of a hassel in Blazor. This is the reason why I made it a int-ms delay variable. Its the easiest way to bind it from my perspective. Sure a Timespan would be more declarative and i could add a proxy property with a timespan but best would be to leave it with an int property
} | ||
|
||
#pragma warning disable BL0005 | ||
BlazoredVideo.EndedEvent = new EventCallback<VideoState>(this, OnPlaybackEnded); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider adding a method to BlazoredVideo e.g. SubscribeToEvent
to handle this instead of disabling the warning?
Does this need to be an EventCallback? It seems like you are calling StateHasChanged()
whenever the CurrentItem
changes, so this feels like unnecessary overhead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did consider it however to "not just" get rid of the warning i would have needed to build a general cs event based handling, which was out-of-scope of this PR. Not necessary needs to be an EventCallback no. Would you recommand using the Ended
property instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end it is not much different to what you would do in razor file but without the autogenerated code. I think it is missleading to raise that warning when a property is in use by another component.
src/Blazored.Video/VideoQueue.cs
Outdated
[CascadingParameter] | ||
public BlazoredVideo BlazoredVideo { get; set; } | ||
|
||
public IList<VideoItem> VideoItems { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be using the component VideoItem
as a data class, which makes me uncomfortable - Blazor is in control of the lifetime of components, and taking these references and storing them in another component feels suspect.
Instead of passing in VideoItems like this
VideoQueue.AddVideoItem(this);
I would prefer something like
VideoData = new(this);
VideoQueue.AddVideoItem(VideoData)
Where VideoData
is a DTO class carrying the values we need in VideoQueue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some DTOs to be used as an intermediary. However I am not sure how everything will behave when Source or type is bound and does update. I will have to evaluate that later.
src/Blazored.Video/RepeatValues.cs
Outdated
/// <summary> | ||
/// Will repeat the current loaded video forever. | ||
/// </summary> | ||
Once, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this name misleading - once should mean once, not forever.
Added Extensive exception information
@SQL-MisterMagoo @JPVenson Pushing this over the finish line would be a great addition to this amazing library. I recently upgraded my solution from .net 5 to .net 8 and the control is still going strong! I appreciate all time and hardwork dedicated to this library. |
Related to #22