// // AuthFuncStartupSoundHandling.swift // WOKA // // Created by MacBook Pro on 21/05/24. // import UIKit import AVFoundation extension AuthFunc{ // MARK: - Handle The Sound Globally func playStartUpsound(){ guard let path = Bundle.main.path(forResource: K.StaticFilesString.onBoardMainSound, ofType:"m4a") else { return } let url = URL(fileURLWithPath: path) let playerItem = AVPlayerItem(url: url) // Initialize AVQueuePlayer with the player item player = AVQueuePlayer(items: [playerItem]) // Create AVPlayerLooper playerLooper = AVPlayerLooper(player: player!, templateItem: playerItem) player?.play() } // Stops the sound func stopSound() { player?.removeAllItems() } // Pauses the sound func pauseSound() { player?.pause() } }