multiplatform: voice playing fix (#3046)
This commit is contained in:
parent
5fddf64adb
commit
4b88a2abfd
@ -134,7 +134,7 @@ actual object AudioPlayer: AudioPlayerInterface {
|
||||
|
||||
// Returns real duration of the track
|
||||
private fun start(fileSource: CryptoFile, seek: Int? = null, onProgressUpdate: (position: Int?, state: TrackState) -> Unit): Int? {
|
||||
val absoluteFilePath = getAppFilePath(fileSource.filePath)
|
||||
val absoluteFilePath = if (fileSource.isAbsolutePath) fileSource.filePath else getAppFilePath(fileSource.filePath)
|
||||
if (!File(absoluteFilePath).exists()) {
|
||||
Log.e(TAG, "No such file: ${fileSource.filePath}")
|
||||
return null
|
||||
@ -272,10 +272,10 @@ actual object AudioPlayer: AudioPlayerInterface {
|
||||
}
|
||||
}
|
||||
|
||||
override fun duration(filePath: String): Int? {
|
||||
override fun duration(unencryptedFilePath: String): Int? {
|
||||
var res: Int? = null
|
||||
kotlin.runCatching {
|
||||
helperPlayer.setDataSource(filePath)
|
||||
helperPlayer.setDataSource(unencryptedFilePath)
|
||||
helperPlayer.prepare()
|
||||
helperPlayer.start()
|
||||
helperPlayer.stop()
|
||||
|
@ -2089,6 +2089,10 @@ data class CryptoFile(
|
||||
val filePath: String,
|
||||
val cryptoArgs: CryptoFileArgs?
|
||||
) {
|
||||
|
||||
val isAbsolutePath: Boolean
|
||||
get() = File(filePath).isAbsolute
|
||||
|
||||
companion object {
|
||||
fun plain(f: String): CryptoFile = CryptoFile(f, null)
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ interface AudioPlayerInterface {
|
||||
fun stop(fileName: String?)
|
||||
fun pause(audioPlaying: MutableState<Boolean>, pro: MutableState<Int>)
|
||||
fun seekTo(ms: Int, pro: MutableState<Int>, filePath: String?)
|
||||
fun duration(filePath: String): Int?
|
||||
fun duration(unencryptedFilePath: String): Int?
|
||||
}
|
||||
|
||||
expect object AudioPlayer: AudioPlayerInterface
|
||||
|
@ -42,7 +42,7 @@ actual object AudioPlayer: AudioPlayerInterface {
|
||||
/*LALAL*/
|
||||
}
|
||||
|
||||
override fun duration(filePath: String): Int? {
|
||||
override fun duration(unencryptedFilePath: String): Int? {
|
||||
/*LALAL*/
|
||||
return null
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user