Hi coders,
in my radio project I tried to record a live stream (mp3/shoutcast) to locale storage.
Here my full code
My problem is the exit strategy. In line 59 I can see the write process, but if I try to close() the process in line
connected : function(e) { Ti.Stream.pump(e.socket, readCallback, 1024, true); Ti.Stream.write(socket, Ti.createBuffer({ value : 'GET ' + _args.path + ' HTTP/1.1\r\n\r\n' }), writeCallback); setTimeout(function() { socket && socket.close(); instream && instream.close(); outstream && outstream.close(); }, _args.duration); },I see on console the writing to file and after timeout:
[WARN] : W/System.err: java.net.SocketException: Socket closedand after this:
[INFO] : Error (0): Unable to read from socket, IO errorThe file on external storage keeps empty :-)
I must notify, I'm beginner in area of buffers and streams …
Any suggestions?
Rainer