Skip to content

[BUG] MediaElement SeekTo() not working on macOS / Mac Catalyst #3253

Description

@hirendmindfire

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

MediaElement.SeekTo() does not work correctly on macOS / Mac Catalyst.
Calling SeekTo() either has no effect, does not seek to the correct position,
or the SeekCompleted event never fires after the seek operation.

Expected Behavior

  • SeekTo() should seek the media to the specified TimeSpan position
  • The SeekCompleted event should fire after the seek operation completes
  • Behavior should be consistent across all platforms (Android, Windows, macOS)

Steps To Reproduce

  1. Create a .NET MAUI app targeting macOS / Mac Catalyst
  2. Add a MediaElement and load any video/audio source
  3. Call await mediaElement.SeekTo(TimeSpan.FromSeconds(10), CancellationToken.None);
  4. Observe that the position does not update OR SeekCompleted event does not fire

Link to public reproduction project repository

https://github.com/CommunityToolkit/Maui/issues

Environment

- .NET MAUI CommunityToolkit MediaElement: 9.1.1]
- .NET MAUI: [8.0]
- macOS Version: [e.g. macOS 13.x Sonoma]
- Xcode Version: [e.g. 15.x]
- IDE: [e.g. Visual Studio 2022 / VS Code / Rider]

Anything else?

  • The issue seems related to the AVPlayer implementation in MediaElementHandler.macios.cs
  • Seeking works correctly on Android (ExoPlayer) and Windows (MediaPlayerElement)
  • Similar issues have been reported for iOS seek behavior in [BUG] Media Element Seek not firing #1012
  • Workaround (if any): calling SeekTo() inside StateChanged event after checking
    the state, but this is inconsistent and unreliable on macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions