I make an audio part of an audio application already in the application I can play them, but now the problem with playing audio downloaded from the server and stored in the Realm database is recorded as the file path

file: /// Users / User / Library / Developer / CoreSimulator / Devices / EE8A846B- 56D9-4B2B-9B52-FCC5CC16B7CA / data / Containers / Data / Application / C057C9A4-77DB-4615-AA78-C0A256ECD2D2 / Documents / Dumont.mp3

How to lose it?

    1 answer 1

    Announce player

    let player:AVPlayer = AVPlayer() 

    feed him a file

     let pathToFile = "тут ваш путь из базы" player.replaceCurrentItem(with: AVPlayerItem(url: URL(fileURLWithPath: pathToFile))) player.play() 
    • Did not help. By the way, before that there is a TableView from where the data about the selected track should come - Zhan
    • show how you create the player. and what error gives AVPlayerItem - Max Mikheyenko