[BUG] Media Element Seek not firing
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Did you read the “Reporting a bug” section on Contributing file?
- I have read the “Reporting a bug” section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
Media Element fails to seek playback positions under conditions where windows or android works fine. Examples include: -if using mediaElement.MediaOpened it will not fire under any situation. -if you are using StateChanged it will fire but only if you check its value before trying to seek.
I have no idea why the behavior in iOS is so different from Windows and Android? Is this intended to work this way? I have include3d sample repo showing what works does not work. Notes in app with what you have to do to make iOS seek.
Expected Behavior
Media element behavior should be the same across devices. Or please document differences for iOS.
Steps To Reproduce
- Open included solution and run it.
- Or create new maui solution and add media element package.
- Add an event to seek an arbitrary position at start of video
- Set event to fire when opening video.
Link to public reproduction project repository
https://github.com/ne0rrmatrix/MediaElementIOSBug
Environment
- .NET MAUI CommunityToolkit: 3.1.0
- OS: iOS
- .NET MAUI: 7.0
Packages used:
<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="1.0.0-preview3840" />
<PackageReference Include="CommunityToolkit.Maui.MediaElement" Version="1.0.0-preview3840" />
<PackageReference Include="CommunityToolkit.MVVM" Version="8.1.0" />
</ItemGroup>
### Anything else?
In code there is commented out code that demonstrates a work around. Is media element behavior intended to be different across platforms? And if so can it be documented?
Issue Analytics
- State:
- Created 7 months ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Mediaelement.js "seeked" event listener never triggered in ...
If you seek by clicking the progress bar, usually it loads the video at that point with no problem, firing both the "seeking"...
Read more >No event (waiting buffering stalled suspend) is fired when ...
Issue 279213: No event (waiting buffering stalled suspend) is fired when audio/video element has no more data to play. ... 2. Enable any...
Read more >HTMLMediaElement: seeking event - Web APIs | MDN
The seeking event is fired when a seek operation starts, meaning the Boolean seeking attribute has changed to true and the media is...
Read more >Namespace: events | Cast
Event data for all events forwarded from the MediaElement . ... This will not be fired in case seeking finishes when the media...
Read more >4.8.6 The video element — HTML5
Returns a MediaError object representing the current error state of the element. Returns null if there is no error. All media elements have...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For Windows you might need to invoke it on the main thread, or I guess that is something we could add on our side.
That fixes it! Now I just have to rewrite the handling logic for playback position records so that I can take advantage of that. I have to either rework my app to do it using main thread or just use what currently works. ATM what I posed before works for what I need. I am currently tracking playback of video files across a list. And what I posed earlier does that and works on all device types. But your code works. Unfortunately I will have to rewrite my code to take advantage of it. My code is dependent on current behavior. I will rewrite it later if behavior changes.