Maui icon indicating copy to clipboard operation
Maui copied to clipboard

Reinstate MediaElement MediaWidth & MediaHeight functionality

Open jfversluis opened this issue 1 year ago • 5 comments
trafficstars

Description of Change

It seems like we never implemented the functionality to populate MediaWidth and MediaHeight. This PR fixes that.

While I did change some APIs I don't think it should be breaking changes.

  • Populate MediaWidth and MediaHeight for iOS, Android, macOS, Windows and Tizen
    • Might not always show for live streamed content on iOS/macOS
  • Moved the Position and Duration labels in the sample app to under the slider that also shows the current playback position
  • Added a field right under the video to show the dimensions
  • Switched around some properties in MediaElement.shared.cs so that we can set the values from our MediaManager but they are read-only properties to the outside work
  • Updated comment on the above properties to reflect that sometimes width/height are not reported for iOS/macOS

Linked Issues

  • Fixes #1708

PR Checklist

  • [x] Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • [x] Has tests
  • [x] Has samples
  • [x] Rebased on top of main at time of PR
  • [x] Changes adhere to coding standard
  • [x] Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pull/430

jfversluis avatar Jun 18 '24 19:06 jfversluis

Thanks @jfversluis for adding the functionality to get the media width and height.

I ran a few tests and it worked very good on Android, iOS and MacCatalyst. I'm unable to test it on Windows, maybe somebody else can give us a hand with the Windows testing.

vhugogarcia avatar Jun 21 '24 16:06 vhugogarcia

@ne0rrmatrix would you mind maybe testing this for a bit? Especially Windows but if you have some time poke at the rest too just so we have an extra set of eyes that looked at this :)

jfversluis avatar Jun 26 '24 07:06 jfversluis

I'll take a look at it now

ne0rrmatrix avatar Jun 26 '24 08:06 ne0rrmatrix

Works exactly as expected on Android and Windows. On iOS it behaves as expected on everything except HLS where it shows 0x0 and does not get width or height. I'm Going to test on a physical device to double check this is not a bug in emulator.

ne0rrmatrix avatar Jun 26 '24 08:06 ne0rrmatrix

except HLS where it shows 0x0 and does not get width or height

This is (unfortunately) expected

jfversluis avatar Jun 26 '24 08:06 jfversluis