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

MediaPlayerElement cannot display text in subtitles #7981

Closed
qian-o opened this issue Nov 19, 2022 · 9 comments
Closed

MediaPlayerElement cannot display text in subtitles #7981

qian-o opened this issue Nov 19, 2022 · 9 comments
Assignees
Labels
area-MediaPlayerElement bug Something isn't working closed-Fixed Described behavior has been fixed. fix-released The fix has been in a release (experimental, preview, stable, or servicing). needs-triage Issue needs to be triaged by the area owners product-winui3 WinUI 3 issues team-Rendering Issue for the Rendering team
Milestone

Comments

@qian-o
Copy link

qian-o commented Nov 19, 2022

Describe the bug

image
image
WinUI:
image
image

Steps to reproduce the bug

1.Create a MediaPlayerElement control.
2.Create a MediaSource and add a TimedTextSource instance to ExternalTimedTextSources.
3.The Source property of the MediaPlayerElement binds to the MediaSource

Expected behavior

No response

Screenshots

No response

NuGet package version

Windows App SDK 1.2.1: 1.2.221116.1

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022

Additional context

No response

@qian-o qian-o changed the title TimedTextSource cannot render correctly MediaPlayerElement cannot display text in subtitles Nov 23, 2022
@gabbybilka gabbybilka transferred this issue from microsoft/WindowsAppSDK Dec 1, 2022
@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Dec 1, 2022
@bpulliam bpulliam added area-MediaPlayerElement team-Rendering Issue for the Rendering team product-winui3 WinUI 3 issues bug Something isn't working and removed needs-triage Issue needs to be triaged by the area owners labels Dec 5, 2022
@Loganeek
Copy link

Loganeek commented Jun 4, 2023

It seems the problem of the default caption style.

Try:

  1. Go to "Settings > Accessibility > Captions > Caption style > Edit".
  2. Change the text effects "None" to "Uniform" or others.
before after
屏幕截图 2023-06-04 183140 屏幕截图 2023-06-04 183149
屏幕截图 2023-06-04 191826 屏幕截图 2023-06-04 193711

It works for me.

@qian-o
Copy link
Author

qian-o commented Jun 6, 2023

Thank you for your response, but I have already found an alternative to MediaPlayerElement.

@softworkz
Copy link

Here's a non-programmatic solution. When you merge this REG file, it will add a captioning theme with empty configuration, named "Controlled by Application" and sets it as active.

After that, all subtitle styles are controlled by the application again (TimedTextStyle).

WindowsCaptionsDefaultProfile.zip

@DmitriyKomin
Copy link
Contributor

@qian-o, thank you for reporting the issue. I can confirm CC text is not rendered when Effects is set to None or Drop Shadow (but does render with Raised/Depressed/Uniform). This is a regression from the initial WASDK preview release containing MediaPlayerElement (1.2.220902.1-preview1). I will continue investigating this further.

@DmitriyKomin DmitriyKomin self-assigned this Mar 11, 2024
@softworkz
Copy link

I will continue investigating this further.

@DmitriyKomin - no need. I did all the work already: #9126

@DmitriyKomin
Copy link
Contributor

DmitriyKomin commented Apr 16, 2024

@qian-o, I can confirm the issue is fixed internally for WinAppSDK 1.6. Specifically, captions weren't rendering for 2 out of the 5 possible Edge Effects settings - None and Drop Shadow. In these cases - where we don't generate SpriteVisuals to simulate an effect - layout never got run on the underlying TextBlock, causing a 0 size for the SpriteVisual backing the CompositionVisualSurface WinUI3 uses to render captions. The fix ensures UpdateLayout() is called on the TextBlock for all Edge Effects settings.

@softworkz, note this was a bug in WinUI3 CC rendering unrelated to the other issues raised around MPE CC rendering in #9126. I will make sure to follow up on the other ones separately.

@softworkz
Copy link

@softworkz, note this was a bug in WinUI3 CC rendering unrelated to the other issues raised around MPE CC rendering in #9126. I will make sure to follow up on the other ones separately.

Excellent, thanks!

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Apr 16, 2024
@qian-o
Copy link
Author

qian-o commented Apr 16, 2024

@qian-o, I can confirm the issue is fixed internally for WinAppSDK 1.6. Specifically, captions weren't rendering for 2 out of the 5 possible Edge Effects settings - None and Drop Shadow. In these cases - where we don't generate SpriteVisuals to simulate an effect - layout never got run on the underlying TextBlock, causing a 0 size for the SpriteVisual backing the CompositionVisualSurface WinUI3 uses to render captions. The fix ensures UpdateLayout() is called on the TextBlock for all Edge Effects settings.

@softworkz, note this was a bug in WinUI3 CC rendering unrelated to the other issues raised around MPE CC rendering in #9126. I will make sure to follow up on the other ones separately.

Thank you for your participation. Looking forward to further improvements in the next version. Much appreciated.

@softworkz
Copy link

@DmitriyKomin - A general note on the whole subject:

When working with subtitles/closedcaptions, you are using TimedTextStyle, which provides very detailed settings to control the appearance of subtitles, but one thing is missing:

There is no "Effect" property. This can only be controlled from the Windows settings app and in code, it can only be read but not changed: ClosedCaptionProperties.FontEffect.

Also, the latter properties partially (really weird and stupid) overrride those which you can set with TimedTextStyle.
All that doesn't fit together and doesn't make sense the way it is and needs architectural review in general.
But first of all, I hope the worst parts can be fixed in some way....

@codendone codendone added the fix-released The fix has been in a release (experimental, preview, stable, or servicing). label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-MediaPlayerElement bug Something isn't working closed-Fixed Described behavior has been fixed. fix-released The fix has been in a release (experimental, preview, stable, or servicing). needs-triage Issue needs to be triaged by the area owners product-winui3 WinUI 3 issues team-Rendering Issue for the Rendering team
Projects
None yet
Development

No branches or pull requests

7 participants