feat: support audio and video file playback in Agent Folder #1191
+90
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Audio/video files (e.g.
.wav) were being read as UTF-8 text and dumped into a<pre>tag, rendering as garbled binary content. Now they play back using native HTML5 media elements.Changes
electron/main/fileReader.ts— Media file types now resolve with the file path (same as PDF) instead of falling through tofs.readFileSync(filePath, 'utf-8')src/components/Folder/index.tsx— Route media files throughread-file-dataurlto get a data URL, then render<audio controls>or<video controls>accordingly. Extension lists extracted as module-level constants (AUDIO_EXTENSIONS,VIDEO_EXTENSIONS,MEDIA_EXTENSIONS) to avoid triple duplication.test/unit/electron/main/fileReader.test.ts— Tests for media extension classificationSupported formats
Follows the existing PDF pattern:
openFile()returns the file path → frontend callsread-file-dataurlto convert to a data URL → element renders withsrc={dataUrl}.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.