question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Media Element Seek not firing

See original GitHub issue

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

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

  1. Open included solution and run it.
  2. Or create new maui solution and add media element package.
  3. Add an event to seek an arbitrary position at start of video
  4. 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:closed
  • Created 7 months ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jfversluiscommented, Feb 20, 2023

For Windows you might need to invoke it on the main thread, or I guess that is something we could add on our side.

0reactions
ne0rrmatrixcommented, Feb 20, 2023

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found