-
-
Notifications
You must be signed in to change notification settings - Fork 363
feat(IAudioDevice): add IAudioDevice service #5955
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 device functionality by adding the File-Level Changes
Assessment against linked issues
Possibly 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 introduces audio device management to the BootstrapBlazor project by adding a new IAudioDevice service and AudioDevices component while updating existing media device interfaces and samples for unified audio/video operations.
- Introduces AudioDevices component and IAudioDevice/DefaultAudioDevice implementation for audio management.
- Updates media interfaces, DefaultMediaDevices, and related JS modules to support a unified "Selector" property across audio and video devices.
- Provides new tests and documentation updates to validate the audio device functionality.
Reviewed Changes
Copilot reviewed 16 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/UnitTest/Services/VideoDeviceTest.cs | Updated tests for video device, replacing VideoSelector with Selector and adding an audio device in the enumeration. |
| test/UnitTest/Services/AudioDeviceTest.cs | New tests verifying audio device functionality using the new IAudioDevice interface. |
| src/BootstrapBlazor/wwwroot/modules/media.js | Enhanced JS module to support open(type, options) and audio recording; refactored close handling for device streams. |
| src/BootstrapBlazor/Services/MediaDevices/MediaTrackConstraints.cs | Replaced the VideoSelector property with a unified Selector property. |
| src/BootstrapBlazor/Services/MediaDevices/IVideoDevice.cs | Updated parameter name to Selector for consistency. |
| src/BootstrapBlazor/Services/MediaDevices/IMediaDevices.cs | Modified the Open and Close methods to include a type parameter. |
| src/BootstrapBlazor/Services/MediaDevices/IAudioDevice.cs | New interface for managing audio devices. |
| src/BootstrapBlazor/Services/MediaDevices/DefaultVideoDevice.cs | Adjusted to call Open with a type parameter ("video") and use Selector. |
| src/BootstrapBlazor/Services/MediaDevices/DefaultMediaDevices.cs | Updated open/close calls to support the type parameter and Selector. |
| src/BootstrapBlazor/Services/MediaDevices/DefaultAudioDevice.cs | New implementation for audio device management using the updated media service. |
| src/BootstrapBlazor/Extensions/BootstrapBlazorServiceCollectionExtensions.cs | Registered the new IAudioDevice service. |
| src/BootstrapBlazor/Server/Extensions/MenusLocalizerExtensions.cs | Updated menu entries to include audio device routes. |
| src/BootstrapBlazor/Server/Components/Samples/VideoDevices.razor(.cs) | Updated samples for video devices to use Selector instead of VideoSelector. |
| src/BootstrapBlazor/Server/Components/Samples/AudioDevices.razor(.cs) | Added new audio device sample component and page. |
Files not reviewed (4)
- src/BootstrapBlazor.Server/Components/Samples/AudioDevices.razor.css: Language not supported
- src/BootstrapBlazor.Server/Locales/en-US.json: Language not supported
- src/BootstrapBlazor.Server/Locales/zh-CN.json: Language not supported
- src/BootstrapBlazor.Server/docs.json: Language not supported
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:
- Consider if the shared
IMediaDevicesinterface could be refactored to avoid using string parameters ('audio', 'video') for differentiating device types in theOpenandClosemethods. - In
media.js, consider renaming therecordfunction toopenAudioDevicefor better naming consistency withopenVideoDevice.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 2 issues found
- 🟡 Complexity: 1 issue found
- 🟢 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 #5955 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 669 670 +1
Lines 30559 30576 +17
Branches 4349 4350 +1
=========================================
+ Hits 30559 30576 +17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #5954
Summary By Copilot
This pull request introduces a new
AudioDevicescomponent to theBootstrapBlazorproject, enabling audio device management and recording capabilities. It also includes updates to the existingVideoDevicescomponent and shared media device interfaces to support both audio and video operations. The changes span across UI components, service interfaces, and JavaScript modules.New
AudioDevicesComponent:AudioDevices.razorto provide a UI for listing, opening, and closing audio devices. The component integrates with theIAudioDeviceservice for device management.AudioDevices.razor.cswith methods for requesting devices, opening audio streams, and handling disposal.AudioDevices.razor.cssfor audio device UI elements.Shared Media Device Enhancements:
IAudioDeviceinterface andDefaultAudioDeviceimplementation for audio device operations, including methods for listing, opening, and closing devices. [1] [2]IMediaDevicesandDefaultMediaDevicesto support both audio and video operations by introducing atypeparameter forOpenandClosemethods. [1] [2]IVideoDeviceandDefaultVideoDeviceto align with the updatedIMediaDevicesinterface. [1] [2]JavaScript Module Updates:
media.jsto support audio recording via a newrecordfunction and added methods for stopping audio streams. Refactored video-related methods to accommodate the shared interface. [1] [2]Localization and Documentation:
en-US.jsonandzh-CN.jsonlocalization files with new strings for theAudioDevicescomponent. [1] [2] [3] [4]audio-devicetodocs.jsonfor documentation purposes.Minor Updates to
VideoDevices:VideoSelectortoSelectorinMediaTrackConstraintsfor consistency with audio operations.VideoDevices.razorandVideoDevices.razor.csto align with the updatedIMediaDevicesinterface. [1] [2] [3]Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add support for audio device management and recording in the BootstrapBlazor framework, extending the existing media device capabilities to include audio input devices
New Features:
Enhancements:
Documentation:
Tests: