Stop downloading of audio files but still be able to play it - ios

I am currently working on an App which requires me to download a certain audio file. I am using AFNetworking for downloading and it works very well. What I want to achieve is when I download a file, I can stop it manually but still be able to play the audio file to where I stopped the downloading.
I have tried to work on it but what I always get is that when the downloading of the file is stopped, I can't play the audio. It maybe because the file is incomplete and will be considered as corrupted. The audio formats that I am downloading are m4a and AIFF.
Is this possible? Please help me on achieving it. Thanks.

Related

Online streaming of .ogg audio file in iOS

I want to play a .ogg audio file in iOS. This is the link of URL :-
http://strm.pistache.org:8443/pistache-tel.ogg
I have found some code from Github but that are not doing online streaming.
Can anyone knows the solution for playing .oog file from URL?
There is not any Direct API of IOS to achieve this, but you can use some Library created to Play .OGG files or you can yourself made one of that using ibvorbis 1.3.3
Check out IDZAQAudioPlayer.
https://github.com/iosdevzone/IDZAQAudioPlayer

core audio offline rendering issue on iOS 8

I want to apply reverb effect on a sound file and want to save it on disk using Core Audio. I successfully apply the effect and played it using kAudioUnitSubType_RemoteIO. Now I want to save it on disk so I use kAudioUnitSubType_GenericOutput and call AudioUnitRender and I used same code listed below.
core audio offline rendering GenericOutput
Now Problem is that when I run same code from above link on iOS7 it works fine.
When I run it on iOS 8 device it simply save a file having no sound.
Can any one help me?
Thanks

How to save the generated tone to the audio file in iOS?

I have read the tone generator in ios from http://www.eslacker.com/?p=198. After that, I want to improve it to can save the tone generator to the audio file. So , the tone generator can be ringtone. How can I got it? Thanks before :D
You could possibly have it upload the file as simple PCM to your website for conversion, allow the user to download it to his/her computer, and tell them how to sync it, but there is not a chance in hell apple would make it easy to make ringtones with only an iphone. After all, they make money by only letting you easily make ringtones from songs you buy on iTunes, but won't let you use ones ripped from CDs without lots of workarounds. You can do it from a desktop by cropping the sound to 30 seconds, converting it to AAC, and giving it the file extension .m4r, and then importing it into itunes and syncing. I have no idea how to do it without a jailbroken iDevice that can access the root filesystem and change the .plist files and database files that control synced media. You could run ffmpeg on a webserver and use that to make and crop ringtones. Or port and include ffmpeg inside your app and have it convert it and save it in the space that you can share between apps and manage with itunes.

How to properly close an AVAudioRecorder file after a crash

I'm wondering if anyone has any ideas on how to properly close an audio file that was open and actively recording when the application experienced a crash. A simple way to test this is to start a recording using the simulator, then press stop in Xcode.
What I believe is happening is that the audio file was never closed, so any attempts to open it again for playback causes an error in AVAudioPlayer. So now the file is pretty much useless. I'm hoping to be able to recover it.
Depending on the audio file format, the information required to properly close the file may have been lost during the app crash and/or termination.
However, for some audio file formats, there may exist tools (non-Apple, commercial, etc.) that attempt to extract audio data from some types of corrupt or broken files.

Check is the downloaded mp4 file is proparly downloaded to play. - iphone sdk

I have developed the code for downloading the mp4 video from server. It does work perfectly sometime but sometime the video which is downloaded is not proper so its not playing.
Sometime it that downloaded video is off just 2kb which is not the correct or might be not downloaded properly.
So is there any way to check is the downloaded mp4 file is correct?
Thanks in advance.
I am not a iPhone developer, but I would suggest computing a checksum on the file downloaded and compare that to a checksum that can be requested from where the file is downloaded.
Check for instance Compute a checksum on the iPhone from NSData for a checksum example.
I encountered a similar issue when using AVAssetExportSession to cache a video that was being streamed from the server. I solved this by using isPlayable on AVAsset. If the property returned false I would remove the cached video and stream it from the server instead. Hope this solves your problem.

Resources