-
Notifications
You must be signed in to change notification settings - Fork 229
Audio recorder player forground service #644
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
base: main
Are you sure you want to change the base?
Audio recorder player forground service #644
Conversation
…ange crash issue resolved.
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
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 enhances the audio recorder/player features by adding support for new parameters, background service control, and file management improvements. Key changes include extending recorder methods with an appointmentID parameter, introducing a foreground service for Android, and refactoring event handling and error messaging.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
ios/RNAudioRecorderPlayer.swift | Added appointmentID parameter and new file URL logic; improved audio session configuration and encoding handling. |
ios/RNAudioRecorderPlayer.m | Updated method signatures to reflect new parameters. |
index.ts | Modified API usage to incorporate new service methods and adjusted event finish detection. |
android/src/main/java/com/dooboolab.audiorecorderplayer/RNAudioRecorderPlayerModule.kt | Added appointmentId support, foreground service control, and updated recorder lifecycle management; removed playback speed support. |
android/src/main/java/com/dooboolab.audiorecorderplayer/ForegroundService.kt | Introduced a new foreground service to support recording in the background. |
android/src/main/AndroidManifest.xml | Updated permission declarations to support the foreground service. |
.github/workflows/codeql.yml | Added CodeQL analysis workflow configuration. |
Comments suppressed due to low confidence (2)
android/src/main/java/com/dooboolab/audiorecorderplayer/RNAudioRecorderPlayerModule.kt:95
- The expression 'mediaRecorder == null' appears to be a mistake where an assignment was intended to nullify the mediaRecorder. Change it to 'mediaRecorder = null' to correctly reset the variable.
mediaRecorder == null
android/src/main/java/com/dooboolab/audiorecorderplayer/RNAudioRecorderPlayerModule.kt:173
- [nitpick] The error message key 'resumeReocrder' is misspelled. It should be corrected to 'resumeRecorder' to maintain consistency and clarity.
promise.reject("resumeReocrder", "Recorder is null.")
@@ -244,18 +324,18 @@ class RNAudioRecorderPlayer: RCTEventEmitter, AVAudioRecorderDelegate { | |||
func startRecording() { | |||
let settings = [ | |||
AVSampleRateKey: sampleRate!, | |||
AVFormatIDKey: avFormat, | |||
AVFormatIDKey: avFormat!, |
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.
If the 'encoding' value is not recognized in the conditional branches, 'avFormat' remains nil and force unwrapping it will cause a runtime crash. Consider adding a default case or error handling for unrecognized encoding values.
Copilot uses AI. Check for mistakes.
@@ -329,7 +349,7 @@ class AudioRecorderPlayer { | |||
this._playerCallback(event); | |||
} | |||
|
|||
if (event.isFinished) { | |||
if (event.currentPosition === event.duration) { |
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.
Using strict equality for floating point values may be unreliable due to precision issues. Consider using a tolerance-based comparison to determine if the playback has finished.
if (event.currentPosition === event.duration) { | |
const TOLERANCE = 0.001; | |
if (Math.abs(event.currentPosition - event.duration) < TOLERANCE) { |
Copilot uses AI. Check for mistakes.
No description provided.