Feature#548/media preview panel
Description
Implements a media preview panel that allows users to preview individual media items (video, audio, images) outside the timeline context. Users can double-click any media item to enter preview mode and toggle between timeline and media preview modes seamlessly.
Key Features:
- Double-click media items to enter preview mode
- Toggle between timeline and media preview modes
- Support for video, image, and audio preview with playback controls
- Integrated state management with existing timeline playback
- Works in both normal and fullscreen preview modes
- Improved fullscreen toolbar layout with centered toggle controls
Fixes #548
Type of change
Please delete options that are not relevant.
- [x] New feature (non-breaking change which adds functionality)
- [x] Code refactoring
How Has This Been Tested?
Manual Testing Performed:
- [x] Double-click media items triggers preview mode
- [x] Toggle between timeline and media preview modes
- [x] Video preview with playback controls (play/pause/seek)
- [x] Image preview displays correctly
- [x] Audio preview with playback controls and visual representation
- [x] Fullscreen mode supports media preview with improved layout
- [x] Timeline playback unaffected when not in preview mode
- [x] State persistence across mode switches
- [x] Keyboard navigation and accessibility
- [x] Responsive behavior across different screen sizes
Test Configuration:
- Node version: v22.13.0
- Browser (if applicable): Brave, Chrome
- Operating System: Windows 11
Screenshots (if applicable)
Media Preview Mode Toggle
The toggle buttons allow switching between Timeline and Media preview modes
Normal Preview Panel in Media Mode
Double clicking any media file triggers preview-panel to convert into media preview mode
Fullscreen Media Preview with Improved Layout
Media preview mode also works in fullscreen with redesigned toolbar layout
Checklist:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have added screenshots if UI has been changed
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works (manual testing)
- [x] Any dependent changes have been merged and published in downstream modules
Additional context
Technical Implementation:
- New Store:
media-preview-store.ts- Dedicated Zustand store for media preview state management - Component Updates: Enhanced
preview-panel.tsxto handle dual modes with conditional rendering - Player Integration: Updated video and audio players to support media preview mode
- State Management: Seamless integration with existing timeline playback without conflicts
- UX Improvements: Redesigned fullscreen toolbar layout for better usability
Architecture Benefits:
- Clean separation of concerns between timeline and media preview states
- No breaking changes to existing timeline functionality
- Extensible design for future media preview enhancements
- Consistent playback controls across both modes
This feature enhances the user experience by allowing quick preview of media items without affecting the timeline workflow. The implementation maintains clean code architecture and follows the project's existing patterns.
Files Changed:
apps/web/src/stores/media-preview-store.ts- New Zustand store for media preview stateapps/web/src/components/editor/preview-panel.tsx- Updated for dual mode supportapps/web/src/components/ui/video-player.tsx- Added media preview mode supportapps/web/src/components/ui/audio-player.tsx- Added media preview mode supportapps/web/src/components/ui/draggable-item.tsx- Added double-click to previewapps/web/src/hooks/use-editor-actions.ts- Updated playback actions for preview modeapps/web/src/components/editor/media-panel/views/media.tsx- Integration with preview functionality
Summary by CodeRabbit
-
New Features
- Media Preview mode for video, image, and audio in editor and fullscreen with play/pause, seek, and progress.
- Open media via doubleβclick or Enter in media lists to start preview; preview pauses timeline playback.
- Preview state store added (preview media, time, playing, toggle/clear/exit actions).
- Preview mode toggle in preview/fullscreen UI showing current preview name or hint.
-
Refactor
- Unified playback controls and time handling across Timeline and Media modes.
- Audio/Video players accept external control and emit time/play/pause events for synced preview.
-
Accessibility
- Media items gain keyboard focus/activation and descriptive aria labels for preview.
@ayush18pop is attempting to deploy a commit to the OpenCut OSS Team on Vercel.
A member of the Team first needs to authorize it.
Deploy request for appcut pending review.
Visit the deploys page to approve it
| Name | Link |
|---|---|
| Latest commit | 1ecc9a5933d90f8d021d04d61bf9f6f2e53ed756 |
Walkthrough
Adds a media-preview feature: a Zustand media-preview store, UI wiring to open media previews (double-click/Enter) from media items, PreviewPanel dual-mode rendering with a PreviewModeToggle, and player components extended with preview-mode callbacks and sync. (34 words)
Changes
| Cohort / File(s) | Summary |
|---|---|
Media item trigger & propsapps/web/src/components/editor/media-panel/views/media.tsx, apps/web/src/components/ui/draggable-item.tsx |
Pass mediaItem into DraggableMediaItem; add double-click and Enter key handling to set preview media via useMediaPreviewStore; add accessibility attributes. |
Preview panel β dual-mode UIapps/web/src/components/editor/preview-panel.tsx |
Add media-preview mode, renderMediaPreview, PreviewModeToggle; propagate isMediaPreviewMode, togglePreviewMode, previewMedia, clearPreview to fullscreen and toolbar components; update signatures for dual-mode handling. |
Player components β preview mode hooksapps/web/src/components/ui/video-player.tsx, apps/web/src/components/ui/audio-player.tsx |
Add props isPlaying?, onTimeUpdate?, onPlay?, onPause?; implement media-preview branching, event forwarding (timeupdate/play/pause), tighter time sync, and dynamic preload. |
Media preview state storeapps/web/src/stores/media-preview-store.ts |
New Zustand store useMediaPreviewStore managing previewMedia, isMediaPreviewMode, mediaCurrentTime, mediaIsPlaying and actions (set/clear/toggle/toggleMediaPlayback/exitPreviewMode) and pausing timeline when entering preview. |
Editor actions integrationapps/web/src/hooks/use-editor-actions.ts |
Integrate useMediaPreviewStore to pause/exit media preview when toggling play to resume timeline playback. |
Sequence Diagram(s)
sequenceDiagram
participant U as User
participant MP as Media Panel (DraggableMediaItem)
participant MPS as MediaPreviewStore
participant PP as PreviewPanel
participant VP as Video/Audio Player
U->>MP: Double-click / Enter on media item
MP->>MPS: setPreviewMedia(mediaItem)
MPS-->>PP: isMediaPreviewMode=true, previewMedia set
PP->>VP: renderMediaPreview(isPlaying, onTimeUpdate, onPlay, onPause)
VP-->>MPS: onPlay/onPause/onTimeUpdate updates media state
sequenceDiagram
participant U as User
participant PT as PreviewModeToggle / PreviewToolbar
participant MPS as MediaPreviewStore
participant TL as Timeline Playback Store
U->>PT: Toggle mode
PT->>MPS: togglePreviewMode()
alt entering media preview while timeline playing
MPS->>TL: pause()
end
MPS-->>PT: isMediaPreviewMode updated
Estimated code review effort
π― 4 (Complex) | β±οΈ ~60 minutes
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| Preview video/audio in the media panel without adding to timeline (#548) | β | |
| Provide a button in the media panel to trigger preview (#548) | β | No explicit preview button component or visible button wiring in media panel β only double-click/Enter handlers added. |
| Play audio file in preview (#548) | β |
Possibly related PRs
- OpenCut-app/OpenCut#553 β Modifies
DraggableMediaItem; related because both add public props and change media item interactions.
Poem
I nibble thumbnails, tap and stare,
A tiny player springs to life,
The timeline rests while sounds fill air,
Enter to peek β no drag, no strife.
A rabbit hums and winks with joy. ππΆ
[!TIP]
π Remote MCP (Model Context Protocol) integration is now available!
Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.
β¨ Finishing Touches
- [ ] π Generate Docstrings
π§ͺ Generate unit tests
- [ ] 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.
πͺ§ Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. - PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
CodeRabbit Commands (Invoked using PR/Issue comments)
Type @coderabbitai help to get the list of available commands.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Status, Documentation and Community
- Visit our Status Page to check the current availability of CodeRabbit.
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
@mazeincoding, check this out! lmk if there are any changes
@mazeincoding, check this out! lmk if there are any changes
You should remove the comments made by your AI first
Yeah sure, but any implementation related changes?
@mazeincoding, check this out! lmk if there are any changes
You should remove the comments made by your AI first
Yeah sure, but any implementation related changes?
@mazeincoding, check this out! lmk if there are any changes
You should remove the comments made by your AI first
As a video editor, I personally prefer a small note saying you're viewing your media or just no note (just being able to preview your media). You should be able to just deselect what you have selected instead of switching between viewing your timeline items and your media.
It's your choice though, maybe you could wait for Maze to check.
@ayush18pop i think it would look good if it looks something like this, although it is a very subjective opinion, once check this how they done in clipchamp , it looks simple and very smooth
https://github.com/user-attachments/assets/0310e854-1622-44b9-8305-c7fdd769e165
@mazeincoding @enkeii64
Yeahh I think it's easier to implement this than what I did I'll do this as soon as I get some free time
@ayush18pop i think it would look good if it looks something like this, although it is a very subjective opinion, once check this how they done in clipchamp , it looks simple and very smooth
https://github.com/user-attachments/assets/0310e854-1622-44b9-8305-c7fdd769e165
@mazeincoding @enkeii64