Skip to content

[MPE][Wasm] Seeking bar can seek only once - #12541

Merged
jeromelaban merged 4 commits into
masterfrom
dev/ramr/issue12531-Seeking
Jun 6, 2023
Merged

jeromelaban merged 4 commits into
masterfrom
dev/ramr/issue12531-Seeking

Conversation

@rafael-rosa-knowcode

@rafael-rosa-knowcode rafael-rosa-knowcode commented Jun 5, 2023 •

Copy link
Copy Markdown
Contributor

GitHub Issue (If applicable): closes #12531

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

There is a loop in the seeking

What is the new behavior?

Now there is no loop on the MediaPlayer

🤖 Generated by Copilot at 3bb1420

This pull request enhances the Uno UI media player on WebAssembly and other platforms by improving the playback state synchronization, the cross-platform compatibility, and the user interaction of the MediaTransportControls and the HtmlMediaPlayer classes. It also removes some unused or redundant code and simplifies the logic in the MediaPlayerExtension and MediaTransportControls.MediaPlayer files.

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

@rafael-rosa-knowcode
rafael-rosa-knowcode marked this pull request as ready for review June 5, 2023 19:27
if (_mediaPlayer != null)
{
_mediaPlayer.PlaybackSession.Position = TimeSpan.FromSeconds(m_tpMediaPositionSlider.Value);
_wasPlaying = _mediaPlayer.PlaybackSession.IsPlaying;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we paused the video at the start of drag (ThumbOnDragStarted)
reading from _mediaPlayer.PlaybackSession.IsPlaying will cause the video to never resume (Play) on release
if you want to guarantee that we only change position during pause, you should do somehting like:

if (_mediaPlayer.PlaybackSession.IsPlaying)
{
	// on the off chance, ThumbOnDragStarted/ThumbOnDragCompleted desync'd
	// we need to ensure the player is paused, while we update the position.
	/* edit: idk whats the edge case here, add your explanation above, and delete this line */
	_skipPlayPauseStateUpdate = true;
	_isScrubbing = true;
	_wasPlaying = true;
	
	_mediaPlayer.Pause();
}

// continue with the rest of orginal code...
_mediaPlayer.PlaybackSession.Position = TimeSpan.FromSeconds(m_tpMediaPositionSlider.Value);
if (_wasPlaying)
{
	_mediaPlayer.Play();
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I changed the strategy.
The problem happened when the m_tpMediaPositionSlider.Value was updated.
So while the mouse is on the Thumb or Slider this value is not updated. And back to be updated when leave the slider.
And use your change for the is playing.
So the tapped worked and so did the drag.
Can you validate again?

@jeromelaban
jeromelaban merged commit 3569571 into master Jun 6, 2023
@jeromelaban
jeromelaban deleted the dev/ramr/issue12531-Seeking branch June 6, 2023 15:03
@jeromelaban

Copy link
Copy Markdown
Member

@Mergifyio backport release/stable/4.9

@mergify

mergify Bot commented Jun 6, 2023 •

Copy link
Copy Markdown
Contributor

backport release/stable/4.9

✅ Backports have been created

Details

jeromelaban added a commit that referenced this pull request Jun 6, 2023
…4.9/pr-12541

[MPE][Wasm] Seeking bar can seek only once (backport #12541)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MPE][Wasm] Seeking bar can seek only once

3 participants