[英]how to stream, save and play an mp3 file in iOS
我有一个包含mp3的URL列表,我想流式传输并保存它们,而且我想按给定的顺序播放它们。
AVPlayerItem *item=[AVPlayerItem playerItemWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"YOUR URL"]]]; AVPlayerItem * item = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:[NSString stringWithFormat:@“ YOUR URL”]]]];
AVPlayer *audioPlayer = [AVPlayer playerWithPlayerItem:songItem]; 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]; 重要说明:您只需要在接口(.h文件)中声明AVPlayer * audioPlayer,然后就可以像audioPlayer = [AVPlayer playerWithPlayerItem:songItem]一样使用。 [audioPlayer play];
[audioPlayer播放];
Happy coding... 祝您编程愉快...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.