Skip to content
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

fixed possible crash on Andorid 6 #493

Merged
merged 2 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Version.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ object Version {

const val major = 0
const val minor = 5
const val patch = 4
const val code = 139
const val patch = 5
const val code = 140

override fun toString(): String {
return "$major.$minor.$patch-$code"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,9 @@ internal actual class AudioRecorder : IAudioRecorder, KoinComponent {
logger.v { "pauseRecording ${recorder?.recordingState}" }
_isRecording.value = false
try {
if (recorder?.recordingState == RECORDSTATE_RECORDING) {
recorder?.stop()
}
recorder?.stop()
} catch (e: Exception) {
logger.a(e) { "pauseRecording" }
logger.e(e) { "pauseRecording" }
}
}

Expand All @@ -180,11 +178,9 @@ internal actual class AudioRecorder : IAudioRecorder, KoinComponent {
if (_isRecording.value) {
_isRecording.value = false
try {
if (recorder?.recordingState == RECORDSTATE_RECORDING) {
recorder?.stop()
}
recorder?.stop()
} catch (e: Exception) {
logger.a(e) { "pauseRecording" }
logger.e(e) { "pauseRecording" }
}
//without release audio output sometimes doesn't work after calling start
recorder?.release()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ actual fun Path.commonDelete() {

actual fun Path.commonSize(): Long? = FileSystem.SYSTEM.metadata(this).size

actual fun Path.commonSource(): Source = this.toNioPath().source()
actual fun Path.commonSource(): Source = this.toFile().source()

actual fun Path.commonReadWrite(): FileHandle = FileSystem.SYSTEM.openReadWrite(this, !FileSystem.SYSTEM.exists(this))

Expand Down
2 changes: 1 addition & 1 deletion resources/src/commonMain/resources/MR/files/changelog.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[
"fix Audio Recorder crash"
"fixed possible crash on Android 6"
]