From 872931f5077d4ae724fb24257bc5c6a422b62a01 Mon Sep 17 00:00:00 2001 From: ronaldheft Date: Sun, 21 Aug 2022 11:05:16 -0400 Subject: [PATCH] Guard against player actions before player is initialized --- ios/App/Shared/player/AudioPlayer.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ios/App/Shared/player/AudioPlayer.swift b/ios/App/Shared/player/AudioPlayer.swift index 5c8db6a1..6a16c494 100644 --- a/ios/App/Shared/player/AudioPlayer.swift +++ b/ios/App/Shared/player/AudioPlayer.swift @@ -167,6 +167,8 @@ class AudioPlayer: NSObject { // MARK: - Methods public func play(allowSeekBack: Bool = false) { + guard self.isInitialized() else { return } + if allowSeekBack { let diffrence = Date.timeIntervalSinceReferenceDate - lastPlayTime var time: Int? @@ -202,6 +204,8 @@ class AudioPlayer: NSObject { } public func pause() { + guard self.isInitialized() else { return } + self.audioPlayer.pause() self.status = 0 self.rate = 0.0