c# - Monotouch: trying to play audio from a file that is genarated on the fly using AVAudioPlayer -


i facing following issue.. want record audio file mic using avaudiorecorder , stream output avaudioplayer real time. tryed opening stream

filestream f = new filestream(filename, filemode.open, fileaccess.read, fileshare.readwrite);

where filename name of file recorder writing. tryed initialize avaudioplayer:

avaudioplayer player = avaudioplayer.fromdata(nsdata.fromstream(f));

that returned null player, wrapped filestream bufferedstream like

bufferedstream bf = new bufferedstream(f);

then initialized player using above line of code, instead of passing f stream passed bf stream.

that made player @ least obtain value other null, couldn't hear anything.

is there chance has encountered same problem, , knows solution? can use avaudioplayer way or doing wrong way?

thanks in advance.

i know older question, answering in case else runs across question.

to playback just-recorded audio create audio player url based on file name recorded to:

avaudioplayer player = avaudioplayer.fromurl(nsurl.fromfilename(filename)); player.preparetoplay(); player.play(); 

hopefully helps someone.


Comments