ios - Can not play audio in didReceiveData method of Multipeer Connectivity -


my aim stream voice data multiple devices using multipeer connnectivity.

i using avcapturesession access voice data microphone using avcapturedevice type avmediatypeaudio.

in custom avcaptureaudiodataoutput class getting audio data , want stream connected peers.

//sending data using multipeer connectivity  - (void)captureoutput:(avcaptureoutput *)captureoutput didoutputsamplebuffer:(cmsamplebufferref)samplebuffer fromconnection:(avcaptureconnection *)connection {      //  nslog(@"---a u d o :%@",samplebuffer);      audiobufferlist audiobufferlist;     nsmutabledata *data= [nsmutabledata data];     cmblockbufferref blockbuffer;     cmsamplebuffergetaudiobufferlistwithretainedblockbuffer(samplebuffer, null, &audiobufferlist, sizeof(audiobufferlist), null, null, 0, &blockbuffer);      for( int y=0; y< audiobufferlist.mnumberbuffers; y++ ){         audiobuffer audiobuffer = audiobufferlist.mbuffers[y];         float32 *frame = (float32*)audiobuffer.mdata;          [data appendbytes:frame length:audiobuffer.mdatabytesize];     }      cfrelease(blockbuffer);     [_session senddata:data topeers:_session.connectedpeers withmode:mcsessionsenddatareliable error:nil]; } 

in receiver application getting nsdata in didrecieveddata delegate method in mcsessiondelegate.

but not getting way play raw nsdata in reciever application.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -