i'm trying to play audio file with AVAudioPlayer with this code:
let urlString = "http://192.168.1.19:8080/download/2"
let url = URL(string: urlString)!
print("the url = \(url)")
do {
let data = try Data.init(contentsOf: url)
self.audioPlayer = try AVAudioPlayer.init(data: data)
self.audioPlayer.prepareToPlay()
self.audioPlayer.play()
} catch {
print("couldn't load file")
}
audio format is Ogg Vorbis (.ogg) and it always failed to load. Any solution to play this .ogg file ?
ffmpeg
pretty good tool to deal with media files). – rgkobashi