mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Fix the delay when switching between voice messages (#1985)
This commit is contained in:
@@ -119,7 +119,6 @@ class AudioPlayer: NSObject, AudioPlayerProtocol {
|
|||||||
isStopped = true
|
isStopped = true
|
||||||
internalAudioPlayer?.pause()
|
internalAudioPlayer?.pause()
|
||||||
internalAudioPlayer?.seek(to: .zero)
|
internalAudioPlayer?.seek(to: .zero)
|
||||||
try? AVAudioSession.sharedInstance().setActive(false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func seek(to progress: Double) async {
|
func seek(to progress: Double) async {
|
||||||
|
|||||||
@@ -284,16 +284,15 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
|||||||
|
|
||||||
let audioPlayerState = audioPlayerState(for: itemID)
|
let audioPlayerState = audioPlayerState(for: itemID)
|
||||||
|
|
||||||
// Detach all other states
|
|
||||||
await mediaPlayerProvider.detachAllStates(except: audioPlayerState)
|
|
||||||
// Ensure this one is attached
|
// Ensure this one is attached
|
||||||
if !audioPlayerState.isAttached {
|
if !audioPlayerState.isAttached {
|
||||||
audioPlayerState.attachAudioPlayer(audioPlayer)
|
audioPlayerState.attachAudioPlayer(audioPlayer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Detach all other states
|
||||||
|
await mediaPlayerProvider.detachAllStates(except: audioPlayerState)
|
||||||
|
|
||||||
guard audioPlayer.mediaSource == source, audioPlayer.state != .error else {
|
guard audioPlayer.mediaSource == source, audioPlayer.state != .error else {
|
||||||
audioPlayer.stop()
|
|
||||||
|
|
||||||
// Load content
|
// Load content
|
||||||
do {
|
do {
|
||||||
MXLog.info("Loading voice message audio content from source for itemID \(itemID)")
|
MXLog.info("Loading voice message audio content from source for itemID \(itemID)")
|
||||||
|
|||||||
Reference in New Issue
Block a user