feat: Add Media Preview Handler for File Explorer (Issue #44094)
Summary
Implements media playback preview in File Explorer's preview panel, addressing #44094.
This enables users to preview audio and video files directly in File Explorer's preview pane with full playback controls.
Changes
New Projects
- MediaPreviewHandlerCpp (C++ DLL) - COM IPreviewHandler implementation
- MediaPreviewHandler (.NET EXE) - WebView2-based HTML5 media player with dark theme
Supported Formats
| Type | Extensions |
|---|---|
| Video | .mp4, .avi, .mkv, .mov, .webm, .wmv, .m4v, .3gp, .3g2 |
| Audio | .mp3, .wav, .flac, .m4a, .aac, .ogg, .wma |
Modified Files
shared_constants.h- AddedMEDIA_PREVIEW_RESIZE_EVENTConstants.h/cpp/idl- AddedMediaPreviewResizeEvent()logger_settings.h- Added media preview loggermodulesRegistry.h- Added file extension registrationPowerToys.slnx- Added projects to solution
TODO (Can be done in follow-up PRs)
1. Settings UI Toggle
Add enable/disable toggle in PowerToys Settings for Media Preview Handler.
Files to modify:
src/modules/previewpane/powerpreview/powerpreview.cpp- Add settings handlersrc/settings-ui/- Add UI toggle similar to other preview handlers
2. Installer Integration
Add files to WiX installer manifest.
Files to modify:
installer/PowerToysSetup/Resources.wxs- Add MediaPreviewHandler files
3. Additional Format Support
Consider adding more formats:
- Video:
.flv,.ts,.m2ts,.vob - Audio:
.aiff,.opus,.ape
4. Codec Handling
Add detection for missing codecs (e.g., HEVC/H.265) similar to Peek's GetMissingCodecAsync() in VideoPreviewer.cs.
5. Thumbnail Generation
Optionally add a MediaThumbnailProvider for generating video thumbnails (similar to SvgThumbnailProvider).
Checklist
- [x] Code follows existing patterns (SvgPreviewHandler)
- [x] Added to solution file
- [ ] Builds and runs locally
- [ ] Tests added
- [ ] Documentation updated
Fixes #44094
@check-spelling-bot Report
:red_circle: Please review
See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.
Unrecognized words (4)
matroska MEDIAPREVIEWHANDLERCPP msvideo quicktime
These words are not needed and should be removed
CVSTo accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands
... in a clone of the [email protected]:ThanhNguyxn/PowerToys.git repository
on the feature/media-preview-handler branch (:information_source: how do I use this?):
curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/19960237425/attempts/1' &&
git commit -m 'Update check-spelling metadata'
If the flagged items are :exploding_head: false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it, try adding it to the
patterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
@check-spelling-bot Report
:red_circle: Please review
See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.
Unrecognized words (4)
matroska MEDIAPREVIEWHANDLERCPP msvideo quicktime
These words are not needed and should be removed
CVSTo accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands
... in a clone of the [email protected]:ThanhNguyxn/PowerToys.git repository
on the feature/media-preview-handler branch (:information_source: how do I use this?):
curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/19960943785/attempts/1' &&
git commit -m 'Update check-spelling metadata'
If the flagged items are :exploding_head: false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it, try adding it to the
patterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
@check-spelling-bot Report
:red_circle: Please review
See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.
Unrecognized words (4)
matroska MEDIAPREVIEWHANDLERCPP msvideo quicktime
These words are not needed and should be removed
CVSTo accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands
... in a clone of the [email protected]:ThanhNguyxn/PowerToys.git repository
on the feature/media-preview-handler branch (:information_source: how do I use this?):
curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/19961051241/attempts/1' &&
git commit -m 'Update check-spelling metadata'
If the flagged items are :exploding_head: false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it, try adding it to the
patterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
@check-spelling-bot Report
:red_circle: Please review
See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.
Unrecognized words (2)
MEDIAPREVIEWHANDLERCPP troska
These words are not needed and should be removed
CVSTo accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands
... in a clone of the [email protected]:ThanhNguyxn/PowerToys.git repository
on the feature/media-preview-handler branch (:information_source: how do I use this?):
curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/19961553281/attempts/1' &&
git commit -m 'Update check-spelling metadata'
If the flagged items are :exploding_head: false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it, try adding it to the
patterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
@check-spelling-bot Report
:red_circle: Please review
See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.
Unrecognized words (1)
troska
These words are not needed and should be removed
CVS matroska msvideo quicktimeTo accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands
... in a clone of the [email protected]:ThanhNguyxn/PowerToys.git repository
on the feature/media-preview-handler branch (:information_source: how do I use this?):
curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/19962024790/attempts/1' &&
git commit -m 'Update check-spelling metadata'
If the flagged items are :exploding_head: false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it, try adding it to the
patterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
@ThanhNguyxn please walk me through with screenshots how this was tested and verified on your end.