-
Notifications
You must be signed in to change notification settings - Fork 14
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
fix(camera-tab): added mimeType fallback for safari #763
Conversation
WalkthroughThe changes in the pull request modify the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant CameraSource
User->>App: Request to start recording
App->>CameraSource: Call _startRecording()
CameraSource->>CameraSource: Destructure mimeType from options
alt Valid mimeType
CameraSource->>CameraSource: Use specified mimeType
else No valid mimeType
CameraSource->>CameraSource: Set default to 'video/mp4'
end
CameraSource->>CameraSource: Start recording
CameraSource-->>App: Return recording status
App-->>User: Notify recording started
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (3)blocks/CameraSource/CameraSource.js (3)
The new implementation correctly handles MIME type selection using feature detection instead of User-Agent sniffing, with a proper fallback chain:
The condition now correctly hides the audio device selector when either audio recording is disabled or there's only one/no audio device available, improving the UI clarity.
The condition matches the improved logic in _handleVideo method, ensuring consistent behavior of the audio device selector visibility across different tab states. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
blocks/CameraSource/CameraSource.js (2)
Line range hint
232-245
: Enhance error handling for recording failuresThe current error handling only logs to console, which doesn't provide feedback to users when recording fails.
Consider adding user feedback and fallback behavior:
if (this._stream) { this._mediaRecorder = new MediaRecorder(this._stream, this._options); this._mediaRecorder.start(); this._mediaRecorder.addEventListener('dataavailable', (e) => { this._chunks.push(e.data); }); this._startTimer(); this.classList.add('uc-recording'); this._setCameraState(CameraSource.events.PLAY); } } catch (error) { - console.error('Failed to start recording', error); + console.error('Failed to start recording:', error); + // Notify user and reset UI state + this.set$({ + l10nMessage: 'camera-recording-failed', + messageHidden: false, + cameraHidden: true + }); + this._setCameraState(CameraSource.events.IDLE); }
Line range hint
367-386
: Add MIME type validation in video previewThe video preview uses
mediaRecorder.mimeType
directly without validation, which could lead to invalid blob creation.Consider adding MIME type validation:
_previewVideo = () => { try { + const mimeType = this._mediaRecorder?.mimeType || this._options.mimeType || 'video/mp4'; const blob = new Blob(this._chunks, { - type: this._mediaRecorder?.mimeType, + type: mimeType }); const videoURL = URL.createObjectURL(blob);
68c9ca0
to
66807b4
Compare
@coderabbitai full review |
✅ Actions performedFull review triggered. |
Description
Checklist
Summary by CodeRabbit
New Features
Bug Fixes
Chores