 //MARK: - AVAudioPlayerDelegate
 
 extension AudioPlayer: AVAudioPlayerDelegate {
-    @objc func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool) {
+    @objc public func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool) {
         completionHandler?(player.url, flag)
     }
 }

import Foundation
import AVFoundation

class AudioPlayer: NSObject {
    static let shared = AudioPlayer()
    
    private var player: AVAudioPlayer?
    private var completionHandler: ((URL?, Bool) -> Void)?
    
    //play long audio file such as background music, song music, etc.
    //This method can enter background mode and recover properly in foreground mode
    func play(file: URL?, delay: TimeInterval = 0, numberOfLoops: Int = 0, volume: Float = 1, completionHandler: ((URL?, Bool) -> Void)? = nil) {
        guard let file = file else {
            return
        }

        }
    }
    
    public func pause() {
        player?.pause()
    }
    
    public func stop() {
        player?.stop()
    }
    
