Код: Выделить всё
do {
let audioSession = AVAudioSession.sharedInstance()
try audioSession.setCategory(.playback, mode: .default, options: .mixWithOthers)
try audioSession.setActive(true)
} catch {
print("Failed to set audio session category: \(error)")
}
// Set up the audio URL (replace with actual URL)
audioURL = URL(string: category.mediaUrl!)
// Set up AVPlayer
playerItem = AVPlayerItem(url: audioURL)
audioPlayer = AVPlayer(playerItem: playerItem)
audioPlayer.volume = 1.0
var nowPlayingInfo = [String: Any]()
nowPlayingInfo[MPMediaItemPropertyTitle] = category.name
MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo
Я не вижу элементов управления, чтобы остановить или воспроизводить звук.
Что мне делать, чтобы эти элементы управления отображались на экране? < /p>
Подробнее здесь: https://stackoverflow.com/questions/794 ... background