Maui
Maui copied to clipboard
Add Subtitle Support for MediaElement
-
Feature/Proposal
Add Support for Subtitles to Media Element.
Description of Change
Adds subtitle support to Windows, Android, iOS, and Mac Catalyst.
Linked Issues
- Fixes #1899
PR Checklist
- [x] Has a linked Issue, and the Issue has been
approved
(bug) orChampioned
(feature/proposal) - [x] Has tests (if omitted, state reason in description)
- [x] Has samples (if omitted, state reason in description)
- [x] Rebased on top of
main
at time of PR - [x] Changes adhere to coding standard
- [x] Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pull/432
Additional information
Input on API, naming, and design is appreciated. Nothing is final yet. There were a few people that had ideas from the June meeting. If the people who were at the meeting or are just seeing this now can elaborate on their ideas I will look at them and talk with the other team members about them. I am looking for design, API, and input on naming so we can move this further.
Current Status
- API is working!
- All devices support the API.
API:
/// <summary>
/// Backing store for the <see cref="CustomSubtitleParser"/> property.
/// </summary>
public static readonly BindableProperty ParserProperty =
BindableProperty.Create(nameof(CustomSubtitleParser), typeof(IParser), typeof(MediaElement), null);
/// <summary>
/// Backing store for the <see cref="SubtitleFont"/> property.
/// </summary>
public static readonly BindableProperty SubtitleFontProperty = BindableProperty.Create(nameof(SubtitleFont), typeof(string), typeof(MediaElement), string.Empty);
/// <summary>
/// Backing store for the <see cref="SubtitleFontSize"/> property.
/// </summary>
public static readonly BindableProperty SubtitleFontSizeProperty = BindableProperty.Create(nameof(SubtitleFontSize), typeof(double), typeof(MediaElement), 16.0);
/// <summary>
/// Backing store for the <see cref="SubtitleUrl"/> property.
/// </summary>
public static readonly BindableProperty SubtitleProperty = BindableProperty.Create(nameof(SubtitleUrl), typeof(string), typeof(MediaElement), string.Empty);
UPDATED VIDEO'S Below!!!
Video:
Windows
https://github.com/user-attachments/assets/93583563-2805-4f43-a7ee-1b395d98d807
Android
https://github.com/user-attachments/assets/defbd3f9-0bd7-4991-97d6-73fa2096d6fe
iOS
https://github.com/user-attachments/assets/d014e569-961a-4056-8a5d-0655c9fa71c2