INNER CODE UNIT · Java

startRecording

rom1v/sndcpy · app/src/main/java/com/rom1v/sndcpy/RecordService.java:158

    private void startRecording() {
        final AudioRecord recorder = createAudioRecord(mediaProjection);

        recorderThread = new Thread(new Runnable() {
            @Override
            public void run() {
                try (LocalSocket socket = connect()) {
                    handler.sendEmptyMessage(MSG_CONNECTION_ESTABLISHED);

                    recorder.startRecording();
                    int BUFFER_MS = 15; // do not buffer more than BUFFER_MS milliseconds
                    byte[] buf = new byte[SAMPLE_RATE * CHANNELS * BUFFER_MS / 1000];
                    while (true) {
                        int r = recorder.read(buf, 0, buf.length);
                        socket.getOutputStream().write(buf, 0, r);
                    }
                } catch (IOException e) {
                    // ignore

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…