I'm trying to play MP3 file via AVPlayer:
let url = URL(string: "http://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)
player.play()
But I'm getting the next log:
2017-09-26 21:57:07.906598+0300 MyApp[7558:1177816] CredStore - performQuery - Error copying matching creds. Error=-25300, query={
class = inet;
"m_Limit" = "m_LimitAll";
"r_Attributes" = 1;
sync = syna;
}
I guess it's because of iOS 11 and Xcode 9, but I have no idea how to solve this problem.
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,
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.
same error.
I've solved with server-side work.
remove HSTS header "Strict-Transport-Security: max-age=31536000" from http response, disappear error and work fine. I don't know the cause..
request : https://abc.../aaaa.mp3
I've faced the same issue, we've tried to set all the headers on server side to inactive/active
Finally unset range
was set to inactive
and then it worked.