-
Notifications
You must be signed in to change notification settings - Fork 338
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
Fix HLS CTD on Windows #1543
Fix HLS CTD on Windows #1543
Conversation
@pictos btw this fixes a crash when media element source is invalid for windows. It has an exception that is thrown by Maui in sample app with: void MediaElement_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == MediaElement.DurationProperty.PropertyName)
{
logger.LogInformation("Duration: {newDuration}", MediaElement.Duration);
PositionSlider.Maximum = MediaElement.Duration.TotalSeconds;
}
}
//here => PositionSlider.Maximum = MediaElement.Duration.TotalSeconds; void OnPositionChanged(object? sender, MediaPositionChangedEventArgs e)
{
logger.LogInformation("Position changed to {position}", e.Position);
PositionSlider.Value = e.Position.TotalSeconds;
}
// here => PositionSlider.Value = e.Position.TotalSeconds; That throws exception before code changes. After if the HLS stream url is not valid it just fails gracefully. |
@ne0rrmatrix what do you mean by "After if the HLS stream url is not valid it just fails gracefully.", it will log some info or will throw an exception that end dev can catch? |
@pictos this is what it shows currently in windows as the current source for media element HLS is not valid atm anyways. So, yes to your question. It does show a very obvious error that both user and dev can see. It is built into media player for windows and does not crash the app. |
Description of Change
Reset position and duration when switching sources
Linked Issues
Issue: #1538
PR Checklist
approved
(bug) orChampioned
(feature/proposal)main
at time of PRAdditional information
This issue is not directly an issue with media element as it is the slider that crashes. This PR fixes that issue. I checked android to see if the position and duration is reset when changing sources. It is not. It reset either on opening or when media fails. Do we want to go back and change this in the future? If we do we should check every device for this issue. Or is this intended behavior and only an issue in windows due to slider behavior on that platform?
This might give some insight into slider behavior and a current issue being tracked with it. dotnet/maui#12285