简体   繁体   中英

Playing mpga format files with AVPlayer in ios swift

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
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() 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM