문제

I am using the AFNetworking suite in my app. In the app you can record a message, which uploads to a server. I need to be able to play that audio file either by streaming it or chaching it, an ideas on how to do either?

Cheers

도움이 되었습니까?

해결책

Honestly, I would just use AVPlayer and load the remote URL. Per Apple's documentation:

AVPlayer works equally well with local and remote media files, providing you with appropriate information about readiness to play or about the need to await additional data before continuing.

It's certainly possible to use AFNetworking to do this, but I trust that Apple's built-in AVPlayer will be more than suitable to your needs, and certainly worth a shot before rolling your own.

다른 팁

If you want to play a mp3 that is located on the server you can use Matt Galagher's Audiostreamer (http://cocoawithlove.com/2009/06/revisiting-old-post-streaming-and.html).

If you want to play a locally saved file you can use AVAudioPlayer (http://developer.apple.com/library/IOS/#documentation/AVFoundation/Reference/AVAudioPlayerClassReference/Reference/Reference.html).

If that is not what you want please give us some more datails.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top