简体   繁体   中英

how to stream, save and play an mp3 file in iOS

我有一个包含mp3的URL列表,我想流式传输并保存它们,而且我想按给定的顺序播放它们。

AVPlayerItem *item=[AVPlayerItem playerItemWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"YOUR URL"]]];

AVPlayer *audioPlayer = [AVPlayer playerWithPlayerItem:songItem];

Important note : you have to declare AVPlayer *audioPlayer in interface only(.h file), then you can use like audioPlayer = [AVPlayer playerWithPlayerItem:songItem]; [audioPlayer play];

Happy coding...

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