52 lines
1.1 KiB
Swift
52 lines
1.1 KiB
Swift
//
|
|
// AuthFunc.swift
|
|
// WOKA
|
|
//
|
|
// Created by Bilal on 26/04/2024.
|
|
//
|
|
|
|
import Foundation
|
|
import AVFoundation
|
|
|
|
class AuthFunc{
|
|
|
|
/**
|
|
This is not for external use!
|
|
This should only be used for login, registration, Auth Process process & userData Extraction.
|
|
*/
|
|
var player: AVQueuePlayer?
|
|
var playerLooper: AVPlayerLooper?
|
|
var userType = UserType.adult
|
|
|
|
static let shareInstance = AuthFunc()
|
|
|
|
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()
|
|
}
|
|
|
|
func stopSound(){
|
|
player?.removeAllItems()
|
|
}
|
|
|
|
func pauseSound(){
|
|
player?.pause()
|
|
}
|
|
|
|
}
|
|
|
|
enum UserType {
|
|
case adult
|
|
case kid
|
|
}
|