Skip to content

Fix Windows Autoplay bug#2238

Merged
TheCodeTraveler merged 6 commits into
CommunityToolkit:mainfrom
ne0rrmatrix:FixWindowsAutoPlayBug
Oct 3, 2024
Merged

Fix Windows Autoplay bug#2238
TheCodeTraveler merged 6 commits into
CommunityToolkit:mainfrom
ne0rrmatrix:FixWindowsAutoPlayBug

Conversation

@ne0rrmatrix
Copy link
Copy Markdown
Member

@ne0rrmatrix ne0rrmatrix commented Sep 28, 2024

Description of Change

Current behavior of autoplay has player pause on opening. Changing the comparision to IsZero<double>(MediaElement.Speed) and IsZero<double>(previousSpeed) fixes it.

Linked Issues

PR Checklist

Additional information

Recently added comparison for doubles was incorrectly returning bad value when comparing to a value of zero. Issue is fixed by casting int onto the double instead of comparing small variation in value.

…pdateSpeed`

Current behavior of autoplay has player pause on opening.
Changing the comparision to `(int)MediaElement.Speed` and `(int)previousSpeed` fixes it.
@ne0rrmatrix ne0rrmatrix self-assigned this Sep 28, 2024
@ne0rrmatrix ne0rrmatrix added the 📽️ MediaElement Issue/PR that has to do with MediaElement label Sep 28, 2024
Replaced IsFloatingPointNumberZero with a generic IsZero<TValue> method using the INumber<TValue> interface for improved flexibility and reusability. Updated PlatformUpdateSpeed and OnPlaybackSessionPlaybackStateChanged methods to use IsZero<TValue>. Added System.Numerics namespace to support INumber<TValue>. Introduced new method PlatformUpdateShouldShowPlaybackControls.
@ne0rrmatrix ne0rrmatrix requested a review from a team October 1, 2024 08:14
Copy link
Copy Markdown
Collaborator

@TheCodeTraveler TheCodeTraveler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great fix - Thanks James!

@TheCodeTraveler TheCodeTraveler enabled auto-merge (squash) October 3, 2024 20:31
@TheCodeTraveler TheCodeTraveler merged commit 3015f45 into CommunityToolkit:main Oct 3, 2024
KeithBoynton added a commit to KeithBoynton/CommunityToolkitMaui that referenced this pull request Oct 31, 2024
* main:
  Update dependabot.yml
  Tell Dependabot to ignore required libraries from auto-updating
  [housekeeping] Automated PR to fix formatting errors (CommunityToolkit#2295)
  [housekeeping] Automated PR to fix formatting errors (CommunityToolkit#2292)
  Fix animation behavior hot reload (CommunityToolkit#2288)
  Update resourceManagement.yml
  [housekeeping] Automated PR to fix formatting errors (CommunityToolkit#2285)
  [Housekeeping] Update NuGet Packages (CommunityToolkit#2254)
  Implement the ability to Close a popup (CommunityToolkit#1688)
  Add `[Obsolete]` tag
  Fix FileSaver Progress (CommunityToolkit#2277)
  Ensure `TouchBehavior.LongPressCompleted` event fires when `LongPressCommand is null` (CommunityToolkit#2239)
  Add Popup Support for MediaElement on iOS + MacCatalyst (CommunityToolkit#2251)
  [Sample app] Add MediaElementMultipleWindowsPage (CommunityToolkit#2250)
  [Sample App] Add Second CarouselView to `MediaElementCarouselViewPage.xaml` (CommunityToolkit#2248)
  Fix Windows Autoplay bug (CommunityToolkit#2238)
  Fix Crash on iOS when using MediaElement inside a CarouselView (again) (CommunityToolkit#2245)
  Refactor URLs and improve logging consistency (CommunityToolkit#2228)
  Bump xunit from 2.9.1 to 2.9.2 in /samples (CommunityToolkit#2234)
  Increase `CommunityToolkitSampleApp_Xcode_Version` to `16`
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

📽️ MediaElement Issue/PR that has to do with MediaElement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Windows Autoplay does not work when app first launches

2 participants