Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Recording of shoutcast stream with Socket.TCP

$
0
0

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 closed
and after this:
[INFO] :   Error (0): Unable to read from socket, IO error
The file on external storage keeps empty :-)

I must notify, I'm beginner in area of buffers and streams …

Any suggestions?

Rainer


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>