简体   繁体   中英

AVAudioPlayer is not playing full file

i am download a audio file from server. As it is downloading i want to start playing it so that user should not wait for long time so to handle this i am using AVAudioPlayer. But now as client gona release the app. we just found that AVAudioPlayer is not playing full file. It only plays that part of the file that is already downloaded at the time of initialising the AVAudioPlayer. So the remaining part that is attached to the file after the initialising the AVAudioPlayer does not get played. Any solution for this problem.

Use AVPlayer for streaming.

var player:AVPlayer!
var steamingURL:NSURL = NSURL(string:playerURL)
player = AVPlayer(URL: steamingURL)
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