Skip to content

[8271] Extend the video player in the Form Engine and the preview dialog to play .avi and .mov#4814

Draft
jvega190 wants to merge 1 commit intocraftercms:developfrom
jvega190:enhancement/8271
Draft

[8271] Extend the video player in the Form Engine and the preview dialog to play .avi and .mov#4814
jvega190 wants to merge 1 commit intocraftercms:developfrom
jvega190:enhancement/8271

Conversation

@jvega190
Copy link
Member

@jvega190 jvega190 commented Feb 19, 2026

craftercms/craftercms#8271

Summary by CodeRabbit

  • New Features
    • Added support for additional video formats (QuickTime and x-msvideo) in media preview and search filtering.
    • Implemented media type blacklist for improved content filtering.

@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2026

Walkthrough

The PR expands media type support by updating MIME type filters and detection logic across preview-related components. It adds support for QuickTime video (.mov) and Windows AVI video (.avi) formats, along with a blacklist mechanism in media content detection.

Changes

Cohort / File(s) Summary
Media Content Detection
ui/app/src/components/PathNavigator/utils.ts
Added a blacklist array for media types and updated isMediaContent function to filter out blacklisted MIME types while preserving existing image/video/audio format support.
Preview Filters
ui/app/src/components/PreviewSearchPanel/PreviewSearchPanel.tsx, ui/app/src/state/reducers/preview.ts
Extended MIME type filters to include video/quicktime and video/x-msvideo formats in the allowed media types for preview search results and assets panel queries.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • rart
🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description provides only a ticket reference link without substantive details about the changes, objectives, or approach, falling short of the template requirement for full description. Add detailed description explaining the changes made to support video formats, noting that MOV support is added but AVI support is explicitly prevented as indicated in the commit message.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title references extending video player support for .avi and .mov formats, which aligns with the actual changes that add 'video/quicktime' (MOV) and 'video/x-msvideo' (AVI) MIME types to filters, though the description of support differs from the actual implementation of prevention.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
ui/app/src/components/PathNavigator/utils.ts (1)

46-48: Optional: prefer inclusive naming for the blacklist constant.

blackListMediaTypesblocklistMediaTypes or denylistMediaTypes aligns with modern inclusive language conventions.

♻️ Proposed rename
-const blackListMediaTypes = [
+const blocklistMediaTypes = [
 	'video/x-msvideo' // .avi files are not supported by browsers and the video player can't play them.
 ];

 export function isMediaContent(mimeType: string) {
 	return (
 		(/^image\//.test(mimeType) || /^video\//.test(mimeType) || /^audio\//.test(mimeType)) &&
-		!blackListMediaTypes.includes(mimeType)
+		!blocklistMediaTypes.includes(mimeType)
 	);
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/app/src/components/PathNavigator/utils.ts` around lines 46 - 48, Rename
the constant blackListMediaTypes to an inclusive name (e.g., blocklistMediaTypes
or denylistMediaTypes) and update all references to it across this module;
specifically rename the symbol blackListMediaTypes in utils.ts, update any
imports/exports or usages (functions that read or iterate this array), and
adjust any type annotations or tests that reference the old name so everything
compiles and passes.
ui/app/src/components/PreviewSearchPanel/PreviewSearchPanel.tsx (1)

109-118: Optional: extract a shared MIME type constant to eliminate duplication between PreviewSearchPanel and assetsPanelInitialState.

mimeTypes here and assetsPanelInitialState['mime-type'] in preview.ts are near-identical lists (differing only by video/x-msvideo). Keeping them in sync manually is a maintenance burden — adding a new format in the future will require two edits.

♻️ Proposed refactor — extract to a shared constant

In a shared location (e.g., utils/media.ts):

+export const previewableMediaMimeTypes = [
+  'image/png',
+  'image/jpeg',
+  'image/gif',
+  'video/mp4',
+  'image/svg+xml',
+  'image/webp',
+  'video/quicktime'
+];

In PreviewSearchPanel.tsx:

-const mimeTypes = [
-  'image/png',
-  'image/jpeg',
-  'image/gif',
-  'video/mp4',
-  'image/svg+xml',
-  'image/webp',
-  'video/quicktime',
-  'video/x-msvideo'
-];
+import { previewableMediaMimeTypes } from '../../utils/media';
+const mimeTypes = [...previewableMediaMimeTypes, 'video/x-msvideo'];

In preview.ts assetsPanelInitialState:

-'mime-type': [
-  'image/png',
-  'image/jpeg',
-  'image/gif',
-  'video/mp4',
-  'image/svg+xml',
-  'image/webp',
-  'video/quicktime'
-]
+'mime-type': previewableMediaMimeTypes
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/app/src/components/PreviewSearchPanel/PreviewSearchPanel.tsx` around lines
109 - 118, Extract the duplicated MIME list into a single exported constant
(e.g., MEDIA_MIME_TYPES) and replace the local mimeTypes array in
PreviewSearchPanel (symbol mimeTypes) and the 'mime-type' entry in
assetsPanelInitialState (symbol assetsPanelInitialState) to import and reference
that constant; ensure the shared constant includes all needed types (add
'video/x-msvideo' if required) and update imports where those symbols are used
so both modules reference the same source of truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@ui/app/src/components/PathNavigator/utils.ts`:
- Around line 46-48: Rename the constant blackListMediaTypes to an inclusive
name (e.g., blocklistMediaTypes or denylistMediaTypes) and update all references
to it across this module; specifically rename the symbol blackListMediaTypes in
utils.ts, update any imports/exports or usages (functions that read or iterate
this array), and adjust any type annotations or tests that reference the old
name so everything compiles and passes.

In `@ui/app/src/components/PreviewSearchPanel/PreviewSearchPanel.tsx`:
- Around line 109-118: Extract the duplicated MIME list into a single exported
constant (e.g., MEDIA_MIME_TYPES) and replace the local mimeTypes array in
PreviewSearchPanel (symbol mimeTypes) and the 'mime-type' entry in
assetsPanelInitialState (symbol assetsPanelInitialState) to import and reference
that constant; ensure the shared constant includes all needed types (add
'video/x-msvideo' if required) and update imports where those symbols are used
so both modules reference the same source of truth.

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.

1 participant

Comments