ios - stream a .caf audio file from server -


i working on project in recording voice , uploading server. uploaded file format .caf (core audio format)

now, when try play file from server using avplayer giving error message below.

error domain=avfoundationerrordomain code=-11819 "cannot complete action" userinfo=0x2f31e0 {nslocalizedrecoverysuggestion=try again later., nslocalizeddescription=cannot complete action}

i have checked file on server , not corrupted.

my question is: can .caf file support streaming ? if not in format need convert recorded file support streaming ?

use setting in avaudiosession

use .mp4 play audio both side:

     avaudiosession * audiosession = [avaudiosession sharedinstance];                 [audiosession setcategory:avaudiosessioncategoryplayandrecord error: &error];                 [audiosession setactive:yes error: &error];                  nsmutabledictionary* recordsetting = [[nsmutabledictionary alloc] init];                 [recordsetting setvalue :[nsnumber numberwithint:kaudioformatmpeg4aac] forkey:avformatidkey];                 [recordsetting setvalue:[nsnumber numberwithfloat:44100.0] forkey:avsampleratekey];                  [recordsetting setvalue:[nsnumber numberwithint: 2] forkey:avnumberofchannelskey];                  nsurl *recordedtmpfile = [nsurl fileurlwithpath:yourdirectorypath];                 //file=[nsstring stringwithformat:@"%@",recordedtmpfile];                 nslog(@" filr url%@",recordedtmpfile);                // nslog(@" filr url%@",file);                 recorder = [[ avaudiorecorder alloc] initwithurl:recordedtmpfile settings:recordsetting error:&error];                 [recorder setdelegate:self];                 [recorder preparetorecord];                 [recorder record];   [[avaudiosession sharedinstance] setcategory:avaudiosessioncategoryplayback error:nil];  

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -