-
-
Notifications
You must be signed in to change notification settings - Fork 364
feat(IVideoDevice): add GetData method #5967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis pull request introduces audio download functionality by adding a File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new audio download feature to the audio device functionality. Key changes include updates to service interfaces and implementations to expose audio stream data, modifications in the JavaScript module to support audio blob retrieval, and UI updates in both AudioDevices.razor and VideoDevices.razor to integrate download functionality.
Reviewed Changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/UnitTest/Services/AudioDeviceTest.cs | Added JSInterop setup for getAudioData and extended test assertions for stream data. |
| src/BootstrapBlazor/wwwroot/modules/media.js | Introduced getAudioData function to return the recorded audio blob. |
| src/BootstrapBlazor/Services/MediaDevices/IMediaDevices.cs | Added GetAudioData method to retrieve audio stream data. |
| src/BootstrapBlazor/Services/MediaDevices/IAudioDevice.cs | Added GetData method mirroring the audio stream retrieval. |
| src/BootstrapBlazor/Services/MediaDevices/DefaultMediaDevices.cs | Implemented GetAudioData leveraging JSInterop for stream access. |
| src/BootstrapBlazor/Services/MediaDevices/DefaultAudioDevice.cs | Added GetData implementation delegating to the media devices service. |
| src/BootstrapBlazor.Server/Components/Samples/VideoDevices.razor.cs | Updated download filename generation in the OnDownload method. |
| src/BootstrapBlazor.Server/Components/Samples/AudioDevices.razor.cs | Integrated download functionality and flag handling for audio. |
| src/BootstrapBlazor.Server/Components/Samples/AudioDevices.razor | Added a new Download button with localization support. |
Files not reviewed (2)
- src/BootstrapBlazor.Server/Locales/en-US.json: Language not supported
- src/BootstrapBlazor.Server/Locales/zh-CN.json: Language not supported
Comments suppressed due to low confidence (2)
src/BootstrapBlazor/Services/MediaDevices/IAudioDevice.cs:37
- [nitpick] There is a naming inconsistency between this GetData() method and GetAudioData() in IMediaDevices. Consider aligning the method names across interfaces for clarity.
Task<Stream?> GetData();
src/BootstrapBlazor.Server/Components/Samples/AudioDevices.razor.cs:27
- [nitpick] The variable name '_isDownload' might be less clear about its purpose. Consider renaming it to something more descriptive like '_downloadReady' to better indicate when the audio data is available for download.
private bool _isDownload = false;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ArgoZhang - I've reviewed your changes - here's some feedback:
- The PR title mentions
IVideoDevice, but the primary feature appears focused onIAudioDevice. - Consider moving the filename change in
VideoDevices.razor.csto a separate pull request as it appears unrelated to the audio download feature.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 2 issues found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5967 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 670 670
Lines 30589 30602 +13
Branches 4351 4352 +1
=========================================
+ Hits 30589 30602 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #5966
Summary By Copilot
This pull request introduces functionality for downloading audio recordings, along with supporting changes to services, UI components, localization files, and unit tests. The most significant updates include adding a new "Download" button to the audio device UI, implementing the backend methods to retrieve audio data, and extending the localization files to support the new feature.
New Audio Download Feature:
AudioDevices.razorcomponent, which is enabled after recording is stopped. (src/BootstrapBlazor.Server/Components/Samples/AudioDevices.razor)GetDatamethod inIAudioDeviceandIMediaDevicesinterfaces to fetch audio streams. (src/BootstrapBlazor/Services/MediaDevices/IAudioDevice.cs,src/BootstrapBlazor/Services/MediaDevices/IMediaDevices.cs) [1] [2]GetAudioDatainDefaultAudioDeviceandDefaultMediaDevicesto handle audio stream retrieval. (src/BootstrapBlazor/Services/MediaDevices/DefaultAudioDevice.cs,src/BootstrapBlazor/Services/MediaDevices/DefaultMediaDevices.cs) [1] [2]getAudioDatafunction tomedia.jsfor JavaScript interop to retrieve the audio blob. (src/BootstrapBlazor/wwwroot/modules/media.js)Localization and Test Updates:
en-US.jsonandzh-CN.jsonfiles to include translations for the new "Download" button text. (src/BootstrapBlazor.Server/Locales/en-US.json,src/BootstrapBlazor.Server/Locales/zh-CN.json) [1] [2]AudioDeviceTestto verify the newGetDatafunctionality, including mocking the JavaScript stream reference and asserting the audio stream's length. (test/UnitTest/Services/AudioDeviceTest.cs) [1] [2]Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add audio download functionality to the media device services, enabling users to download recorded audio streams with a new download button in the UI.
New Features:
Enhancements:
Tests: