Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avalonia: Child content support for VideoView #344

Conversation

taivasverkko
Copy link
Contributor

@taivasverkko taivasverkko commented May 7, 2024

Description of Change

Allow content to be placed to VideoView so that it renders it on top of the media player.

  • Created bindable Content property for VideoView.
  • When content is assigned or VideoView is attached to visual tree, tries to create a new transparent overlay window that is placed on top of the VideoView.
  • Content is binded to windows content property.
  • Uses VideoView Content and Bound property changed events to update overlay position.

Updated sample.

Solution is based on this PR: #294

Issues Resolved

  • fixes #408

API Changes

Added:

  • object VideoView.Content { get; set; } //Bindable Property

Platforms Affected

  • Avalonia

Behavioral/Visual Changes

If user places control inside VideoView it will be shown top of the video.

Before/After Screenshots

image

Testing Procedure

  • Tested with Windows 11

PR Checklist

  • Rebased on top of the target branch at time of PR
  • Changes adhere to coding standard

@jeremyVignelles
Copy link
Collaborator

jeremyVignelles commented May 8, 2024

Thanks for implementing this 🎉

I'm not a fan of the Min/MaxContentOpacity properties, because it seems specific to your use case and, if I remember correctly, there is no such thing on the WPF airspace hack. (that being said, if @mfkl is OK with this, we might as well add the feature to the WPF implementation)

Otherwise, it's looking good (though I didn't test) and I'm looking forward having that fixed in the Avalonia implementation :)

@taivasverkko
Copy link
Contributor Author

taivasverkko commented May 9, 2024

I'm not a fan of the Min/MaxContentOpacity properties, because it seems specific to your use case and, if I remember correctly, there is no such thing on the WPF airspace hack. (that being said, if @mfkl is OK with this, we might as well add the feature to the WPF implementation)

You are right. At first I thought there would be an use case for it but I've been tinkering with this by building an media player element for Avalonia and realized that is something that should be implemented with content and not with VideoView. I will remove those properties and event handling related to the opacity change.

@taivasverkko taivasverkko marked this pull request as draft May 9, 2024 12:17
@taivasverkko
Copy link
Contributor Author

Converted this PR to draft. I was thinkin that it would be beneficial to get PointerEntered/PointerExited events from VideoView. Maybe other events aswell?

@taivasverkko taivasverkko marked this pull request as ready for review May 9, 2024 15:49
@mfkl
Copy link
Member

mfkl commented May 10, 2024

Tested, seems to work fine, thanks!

We'll likely have some fixes once it is used by a few people in production, this kind of thing is tricky to get right on the first go with all the edge cases (see the WPF history https://github.com/videolan/libvlcsharp/commits/3.x/src/LibVLCSharp.WPF), but that's alright.

@mfkl mfkl force-pushed the avalonia-videoview-add-content-property branch from b095266 to 85e24c0 Compare May 12, 2024 10:45
@vlc-mirrorer vlc-mirrorer merged commit 85e24c0 into videolan:3.x May 12, 2024
0 of 4 checks passed
@mfkl
Copy link
Member

mfkl commented May 12, 2024

Thanks for this! Will push to nuget tomorrow.

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.

4 participants