The problem seems to be with the App Transport security, after enabling it, it worked fine with the following sets of code in iOS 13,
Also the above URL that you have provided seems to have associated https link, please use either https link or allow App Transport security
let avPlayerVC = AVPlayerViewController()
let url = URL(string: "https://transom.org/wp-content/uploads/2004/03/stereo_40kbps.mp3?_=7")!
let asset = AVURLAsset(url: url)
let item = AVPlayerItem(asset: asset)
let player = AVPlayer(playerItem: item)
avPlayerVC.player = player
present(avPlayerVC, animated: true) {
player.play()
}
But here I have used AVPlayerViewController and used the same instance of AVPlayer as you used in your code.
I don't know how you are using the AVPlayer in your case, but the above case worked fine.
The problem seems to be with the App Transport security, after enabling it, it worked fine with the following sets of code in iOS 11,
<br>
Also the above URL that you have provided seems to have associated https link, please use either https link or allow App Transport security
let avPlayerVC = AVPlayerViewController()
let url = URL(string: "https://transom.org/wp-content/uploads/2004/03/stereo_40kbps.mp3?_=7")!
let asset = AVURLAsset(url: url)
let item = AVPlayerItem(asset: asset)
let player = AVPlayer(playerItem: item)
avPlayerVC.player = player
present(avPlayerVC, animated: true) {
player.play()
}
But here I have used AVPlayerViewController and used the same instance of AVPlayer as you used in your code.<br>
I don't know how you are using the AVPlayer in your case, but the above case worked fine.