0
votes

I tried to run a remote mpga format audio file with AVPlayer in ios and doesn't play. Below code works fine for remote mp3 files. Can i change the MIME type for the file loaded or are there any options to play the mpga file in ios.

   let audioUrl = "https://example-files.online-convert.com/audio/mpga/example.mpga"   
   let url = URL(string: audioUrl)
   let player: AVPlayer = AVPlayer(url: url!)

   player.play()

console shows

nw_endpoint_flow_copy_multipath_subflow_counts Called on non-Multipath connection
1
I would say this log isn't necessarily relevant. I was getting this error when trying to playback on the simulator but it wasn't happening on a real device. - Ali Alaoi
But the mpga file isn't playing. mp3 works fine. Have you tried mpga file with a real device? - Husni Abdul Nazer

1 Answers

0
votes
let audioUrl = "https://example-files.online-convert.com/audio/mpga/example.mpga"
if let url = URL(string: audioUrl){   
   let playerItem = AVPlayerItem(url: url)
   let player: AVPlayer(playerItem: playerItem)
   player.play() 
}