Good, my question is how I could play an .opus file from my application in swift, the file is remote on a server and I would have to take that file and play it in the application, how could I do it? since I've tried it in every way and there's no way it works
func escucharCancion(){
let url = URL(string: "http://solivellaluisalberto.000webhostapp.com/prueba.opus")
do {
let audioData = try Data(contentsOf: url!)
try audioPlayer = AVAudioPlayer(data: audioData)
audioPlayer.prepareToPlay()
} catch {
}
}
The problem is that being .opus does not load the song, but when it's .mp3 it works perfectly.
I have not done debug, but I know that the error is when trying to pass to Data the .opus file, when it is .mp3 if it is passed to Data correctly from the URL, but with the .opus does not work