Skip to content

Commit

Permalink
small chnages
Browse files Browse the repository at this point in the history
  • Loading branch information
LuftVerbot committed Sep 18, 2024
1 parent ae9550a commit 09e36df
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ext/src/main/java/dev/brahmkshatriya/echo/extension/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fun String.toMD5(): String {

@Suppress("NewApi")
@OptIn(ExperimentalCoroutinesApi::class)
fun getByteStreamAudio(
suspend fun getByteStreamAudio(
scope: CoroutineScope,
streamable: Streamable,
client: OkHttpClient
Expand All @@ -97,11 +97,11 @@ fun getByteStreamAudio(
.build()

val byteChannel = ByteChannel()
val response = clientWithTimeouts.newCall(request).executeAsync()

scope.launch(Dispatchers.IO) {
try {
clientWithTimeouts.newCall(request).executeAsync().use { response ->
response.body.byteStream().buffered().use { byteStream ->
response.body.byteStream().use { byteStream ->
try {
var totalBytesRead = 0L
var counter = 0
Expand Down Expand Up @@ -145,7 +145,6 @@ fun getByteStreamAudio(
byteChannel.close()
}
}
}
} catch (e: IOException) {
println("Exception during decryption or streaming: ${e.message}")
}
Expand Down

0 comments on commit 09e36df

Please sign in to comment.