VoiceStudio is the open-source, fully-local ElevenLabs alternative — voice cloning, voice design, video dubbing, dictation, transcription & audiobook creation in 646 languages.
Python aiaudiobookcudadubbingelevenlabs-alternativehuggingfacelocal-firstmlxomnivoice-studiospeech-to-texttext-to-speechtranscriptiontranslatettsvoice-aivoice-cloningvoice-generationvoicestudioworkflow
fix(ios): show the player only once it can play
velixio881f90c892bb
diff --git a/mobile/ios/VoiceStudio/Platform/Audio.swift b/mobile/ios/VoiceStudio/Platform/Audio.swiftindex 64c918597..9f7a5a8ea 100644--- a/mobile/ios/VoiceStudio/Platform/Audio.swift+++ b/mobile/ios/VoiceStudio/Platform/Audio.swift@@ -22,13 +22,17 @@ import UniformTypeIdentifierstry Task.checkCancellation()let path = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString).appendingPathExtension(ext)try data.write(to: path, options: .atomic)+ let asset = AVURLAsset(url: path)+ let duration: Double, waveform: [Float]+ do {+ duration = try await asset.load(.duration).seconds+ waveform = try await Self.waveform(url: path)+ try Task.checkCancellation()+ guard revision == self.revision else { throw CancellationError() }+ } catch { try? FileManager.default.removeItem(at: path); throw error }+ // `file` shows the player view, so it is set only once the player can play.if let old = file { try? FileManager.default.removeItem(at: old) }file = path- let asset = AVURLAsset(url: path)- let duration = try await asset.load(.duration).seconds- let waveform = try await Self.waveform(url: path)- try Task.checkCancellation()- guard revision == self.revision else { throw CancellationError() }self.duration = duration.isFinite ? duration : 0; position = 0self.waveform = waveformplayer = AVPlayer(playerItem: AVPlayerItem(asset: asset))